Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"DUMP" command produces content not compatible with Redis #2251

Closed
1 of 2 tasks
krizald opened this issue Apr 15, 2024 · 3 comments · Fixed by #2252
Closed
1 of 2 tasks

"DUMP" command produces content not compatible with Redis #2251

krizald opened this issue Apr 15, 2024 · 3 comments · Fixed by #2252
Assignees
Labels
bug type bug

Comments

@krizald
Copy link

krizald commented Apr 15, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

OS:
Debian 11 bullseye

KV Rock
version:unstable
git_sha1:433dcfb3

Minimal reproduce step

I checked and compiled KV Rocks from unstable (SHA: 433dcfb) and test the new "DUMP" command. My plan is to restore keys from KV Rocks back to Redis 6.2.10/7.2.4 using DUMP/RESTORE

  1. In KV Rocks
set A "ABC"`
dump A

Then I get the content: "\x00\x03ABC\x0c\x00\x8a\x95H\n\x1a\xf2\x0eO"
2. In Redis 6.2.10/7.2.4

restore A 0 "\x00\x03ABC\x0c\x00\x8a\x95H\n\x1a\xf2\x0eO"

I got message: (error) ERR DUMP payload version or checksum are wrong

What did you expect to see?

I ran the same commands in Redis 6.2.10

set A "ABC"
dump A

What I got is:
"\x00\x03ABC\t\x00\x91\x11-\x06\xb4^\xf3\xb7"
And when I restore, it works

What did you see instead?

For same string value "ABC", KV Rocks dumps:
"\x00\x03ABC\x0c\x00\x8a\x95H\n\x1a\xf2\x0eO"
Redis 6.2.10 is
"\x00\x03ABC\t\x00\x91\x11-\x06\xb4^\xf3\xb7"

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@krizald krizald added the bug type bug label Apr 15, 2024
@krizald
Copy link
Author

krizald commented Apr 15, 2024

more over, KV Rocks is compatible with both dump content

127.0.0.1:7381> restore B 0 "\x00\x03ABC\x0c\x00\x8a\x95H\n\x1a\xf2\x0eO"
OK
127.0.0.1:7381> get B
"ABC"
127.0.0.1:7381> restore C 0 "\x00\x03ABC\t\x00\x91\x11-\x06\xb4^\xf3\xb7"
OK
127.0.0.1:7381> get C
"ABC

@krizald krizald changed the title "DUMP" command produces content not compatible with Redis 6.2 "DUMP" command produces content not compatible with Redis Apr 15, 2024
@git-hulk
Copy link
Member

@krizald Thanks for your report, I will take a look while I get time.

@git-hulk
Copy link
Member

@krizald This issue would be fixed in #2252

git-hulk added a commit that referenced this issue Apr 16, 2024
…yload (#2252)

Currently, we're using the maximum RDB version(12) when dumping the payload which is not allowed in the old Redis versions(before Redis 7), so it will throw the error:

```
127.0.0.1:6379> RESTORE a 0 "\x00\xc0{\x0c\x00\x83\x94g!\xfaP\xf9\xf0"
(error) ERR DUMP payload version or checksum are wrong
```

This PR changes the payload's RDB version to 6 to make it work with the old Redis versions. And after applying this PR, it works well in Redis 4/6:

```
127.0.0.1:6379> RESTORE a 0 "\x00\xc0{\x06\x00\xde\x0f;a\xf5/[*"
OK
127.0.0.1:6379> get a
"123"

127.0.0.1:6379> RESTORE a 0 "\x00\xc0{\x06\x00\xde\x0f;a\xf5/[*"
OK
127.0.0.1:6379> get a
"123"
```

Fixes #2251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants