feat(rdb): add DUMP support for SortedInt type#3366
Merged
git-hulk merged 3 commits intoapache:unstablefrom Feb 10, 2026
Merged
feat(rdb): add DUMP support for SortedInt type#3366git-hulk merged 3 commits intoapache:unstablefrom
git-hulk merged 3 commits intoapache:unstablefrom
Conversation
- Serialize SortedInt as RDB Set for Redis compatibility - Use RangeByValue() to get all integers deterministically - No RESTORE changes (SortedInt dumps restore as Set, like Bitmap→String) - Resolves part of apache#3319 Testing: - Manual test confirms DUMP no longer returns error - RESTORE successfully creates Set with preserved data - All integers maintained in restored Set
Zakir032002
added a commit
to Zakir032002/kvrocks
that referenced
this pull request
Feb 7, 2026
- Implement custom RDB type 22 for SortedInt - Add SaveSortedintObject() and LoadSortedintObject() - Preserve SortedInt type in DUMP/RESTORE cycle - Update RedisObjValue variant to support vector<uint64_t> - All SortedInt commands work after RESTORE This provides full type preservation as an alternative to the coercion approach in PR apache#3366. Closes apache#3319
git-hulk
reviewed
Feb 9, 2026
Member
git-hulk
left a comment
There was a problem hiding this comment.
@Zakir032002 Could you please add Go test cases?
Contributor
Author
Co-authored-by: hulk <hulk.website@gmail.com>
git-hulk
reviewed
Feb 10, 2026
Contributor
Author
|
now added go test cases and fixed the code |
git-hulk
approved these changes
Feb 10, 2026
PragmaTwice
approved these changes
Feb 10, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Testing:
Manuel test:
root@codespaces-6e5713:/workspaces/kvrocks# # Connect to Kvrocks
redis-cli -p 6666
127.0.0.1:6666> SIADD testkey 100 200 300
(integer) 0 // already exists
127.0.0.1:6666> SICARD testkey
(integer) 3
127.0.0.1:6666> TYPE testkey
sortedint
127.0.0.1:6666> DUMP testkey
"\x02\x03\xc0d\xc1\xc8\x00\xc1,\x01\x06\x00\xb2\x01\xaa\xe2\x06h\xba\x8d"
127.0.0.1:6666> SIADD mykey 5 12 23 89 100
(integer) 0
127.0.0.1:6666> DUMP mykey
"\x02\x05\xc0\x05\xc0\x0c\xc0\x17\xc0Y\xc0d\x06\x00\xa8\x19U\x90\x8f\x011o"
127.0.0.1:6666> RESTORE newkey 0 "\x02\x05\xc0\x05\xc0\x0c\xc0\x17\xc0Y\xc0d\x06\x00\xa8\x19U\x90\x8f\x011o"
OK
127.0.0.1:6666> TYPE newkey
set
127.0.0.1:6666> SMEMBERS newkey
127.0.0.1:6666> DUMP nonexistent
(nil)
127.0.0.1:6666> exit