-
Notifications
You must be signed in to change notification settings - Fork 607
Description
Problem Descriptions
When i have 2 databases, i create the same key to both databases, the key exists in both dbs. Then if i move the key from the source db to the destination db using "MOVE" command, the command will fail (return 0 as i expected). This is a correct behaviour according to the Redis "MOVE" command specification. However, if the operation failed, it should keep the key in the source DB, the KEYDB open source code actually deleted the key from the source db when the "MOVE" operation failed.
Tried with the latest Redis OSS, and it is actually NOT deleting the key from the source DB if the MOVE command failed. I believe it is a KeyDB OSS bug.
To reproduce
Here are the steps to reproduce from cli command line:
127.0.0.1:7001> select 0
OK
127.0.0.1:7001> set key hello
OK
127.0.0.1:7001> get key
"hello"
127.0.0.1:7001> select 1
OK
127.0.0.1:7001[1]> get key
(nil)
127.0.0.1:7001[1]> set key Hello
OK
127.0.0.1:7001[1]> get key
"Hello"
127.0.0.1:7001[1]> select 0
OK
127.0.0.1:7001> move key 1
(integer) 0
127.0.0.1:7001> select 0
OK
127.0.0.1:7001> get key
(nil)
NOTE: as you can see if the MOVE command failed, cli returns "(integer)0", it indicates that the operation failed, the key in the source db should be kept. However, "select 0; get key" return '(nil)' and indicates the key from the source db was deleted.
Expected behavior
if key is NOT moved, the key should not be deleted from the source db. (Verified in Redis open source, the behaviour is correct, however it doesn't work the same way in keydb).