Skip to content

Dragonfly does not allow accessing undeclared keys in lua scripts #272

@dranikpg

Description

@dranikpg

Describe the bug

Discovered when testing #182. The following script:

local conj_ttl = redis.call('ttl', conj_key)
if conj_ttl < timeout then
    -- some code
end

expects conj_ttl always to be a number. Dragonfly instead returns errors as lua tables (aka js-like objects) with a detailed cause.

To Reproduce

Dragonfly:

127.0.0.1:6379> EVAL "return redis.call('ttl', 'nonexistent')" 0
(error) ERR script tried accessing undeclared key

Redis:

127.0.0.1:6379> EVAL "return redis.call('ttl', 'nonexistent')" 0
(integer) -2

Expected behavior

Return sentinel errors in scripts as lua numbers

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions