Skip to content

Error when trying to change type of key #1

@hltbra

Description

@hltbra

There's no check at the moment of what type is the key before trying write operations such as SET/HSET/ZADD/SADD.

$ redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> type foo
"string"
127.0.0.1:6379> sadd foo 1
(error) ERR "Traceback (most recent call last):\n  File \"/Users/hugo/projects/dredis/dredis/server.py\", line 34, in execute_cmd\n    result = run_command(keyspace, cmd, args)\n  File \"dredis/commands.py\", line 384, in run_command\n    return REDIS_COMMANDS[cmd.upper()](keyspace, *str_args)\n  File \"dredis/commands.py\", line 34, in newfn\n    return fn(keyspace, *args, **kwargs)\n  File \"dredis/commands.py\", line 170, in cmd_sadd\n    count += keyspace.sadd(key, value)\n  File \"dredis/keyspace.py\", line 90, in sadd\n    value_path.write(value)\n  File \"dredis/path.py\", line 29, in write\n    with open(self._path, 'w') as f:\nIOError: [Errno 2] No such file or directory: 'dredis-data/0/foo/values/c4ca4238a0b923820dcc509a6f75849b'\n"

Metadata

Metadata

Assignees

No one assigned

    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