Skip to content

Use the QUICKLIST encoding to dump the list payload to compatible with Redis >= 4#2277

Merged
git-hulk merged 17 commits intoapache:unstablefrom
AntiTopQuark:unstable
Apr 30, 2024
Merged

Use the QUICKLIST encoding to dump the list payload to compatible with Redis >= 4#2277
git-hulk merged 17 commits intoapache:unstablefrom
AntiTopQuark:unstable

Conversation

@AntiTopQuark
Copy link
Contributor

Close #2253

In order to support the compatibility of old versions of redis,

when using the dump command, QUICKLISTencoding is used instead of QUICKLIST2for LIST encoding.

@PragmaTwice
Copy link
Member

Could you write some test cases for your patch? Thank you!

@AntiTopQuark
Copy link
Contributor Author

Could you write some test cases for your patch? Thank you!

Here I just changed a coding method. The previous tests can still be used. I have now added some corner cases.

@PragmaTwice
Copy link
Member

Could you write some test cases for your patch? Thank you!

Here I just changed a coding method. The previous tests can still be used. I have now added some corner cases.

Generally, if we fixed a bug in a patch, we need to add a test case, that should fail without the patch, and succeed after the patch is applied.

@AntiTopQuark AntiTopQuark requested a review from mapleFU April 28, 2024 00:51
@git-hulk
Copy link
Member

@AntiTopQuark Thanks for your efforts.

@git-hulk git-hulk changed the title fix: dumped payload can't use to restore in redis v6.2 Use the QUICKLIST encoding to dump the list payload to compatible with Redis 6 Apr 28, 2024
git-hulk
git-hulk previously approved these changes Apr 29, 2024
@git-hulk
Copy link
Member

I can confirm it also works in Redis 4:

127.0.0.1:6379> RESTORE list 0 "\x0e\x04\x0e\x0e\x00\x00\x00\n\x00\x00\x00\x01\x00\x00\x01d\xff\x0e\x0e\x00\x00\x00\n\x00\x00\x00\x01\x00\x00\x01c\xff\x0e\x0e\x00\x00\x00\n\x00\x00\x00\x01\x00\x00\x01b\xff\x0e\x0e\x00\x00\x00\n\x00\x00\x00\x01\x00\x00\x01a\xff\x06\x003\x06\xd4\x86\x93\xfbvB"
OK
127.0.0.1:6379> lrange list 0 -1
1) "d"
2) "c"
3) "b"
4) "a"

@git-hulk git-hulk changed the title Use the QUICKLIST encoding to dump the list payload to compatible with Redis 6 Use the QUICKLIST encoding to dump the list payload to compatible with Redis >= 4 Apr 29, 2024
@git-hulk git-hulk requested a review from PragmaTwice April 29, 2024 02:34
Copy link
Member

@mapleFU mapleFU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General LGTM. Remaining problems are about code styles

@mapleFU
Copy link
Member

mapleFU commented Apr 29, 2024

I didn't dive into logics of RDB carefully, generally this LGTM

@git-hulk
Copy link
Member

@AntiTopQuark Need to reformat codes.

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@git-hulk git-hulk merged commit 9b2ee7e into apache:unstable Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DUMP command error with list

4 participants