You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "Zakir032002 (via GitHub)" <gi...@apache.org> on 2026/02/07 09:58:52 UTC
[PR] feat: Add DUMP support for SortedInt type [kvrocks]
Zakir032002 opened a new pull request, #3366:
URL: https://github.com/apache/kvrocks/pull/3366
- 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 #3319
Testing:
- Manual test confirms DUMP no longer returns error
- RESTORE successfully creates Set with preserved data
- All integers maintained in restored Set
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
1) "100"
2) "12"
3) "23"
4) "5"
5) "89"
127.0.0.1:6666> DUMP nonexistent
(nil)
127.0.0.1:6666> exit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(rdb): add DUMP support for SortedInt type [kvrocks]
Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk merged PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add DUMP support for SortedInt type [kvrocks]
Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on code in PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#discussion_r2780488231
##########
src/storage/rdb/rdb.cc:
##########
@@ -930,6 +954,21 @@ Status RDB::SaveHashObject(const std::vector<FieldValue> &field_values) {
}
return Status::OK();
}
+Status RDB::SaveSortedintObject(const std::vector<uint64_t> &ids) {
+ if (ids.size() > 0) {
+ auto status = RdbSaveLen(ids.size());
+ if (!status.IsOK()) return status;
+
+ for (const auto &id : ids) {
+ status = SaveStringObject(std::to_string(id));
+ if (!status.IsOK()) return status;
+ }
+ } else {
+ WARN("the size of sortedint is zero");
+ return {Status::NotOK, "the size of sortedint is zero"};
Review Comment:
```suggestion
return {Status::NotOK, "the size of sortedint is zero"};
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(rdb): add DUMP support for SortedInt type [kvrocks]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#issuecomment-3877903491
## [](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3366) **Quality Gate passed**
Issues
 [3 New issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=3366&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=3366&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_kvrocks&pullRequest=3366&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [63.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3366&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3366&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3366)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add DUMP support for SortedInt type [kvrocks]
Posted by "Zakir032002 (via GitHub)" <gi...@apache.org>.
Zakir032002 commented on PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#issuecomment-3870333145
@git-hulk thank you for review, i have implemented this type in 2 approaches, can you finalise the approach that is preferred for this repo. Here is the another approach #3367 in the pull requests. After that i will add the go test cases according to it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add DUMP support for SortedInt type [kvrocks]
Posted by "Zakir032002 (via GitHub)" <gi...@apache.org>.
Zakir032002 commented on PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#issuecomment-3876836300
now added go test cases and fixed the code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add DUMP support for SortedInt type [kvrocks]
Posted by "Zakir032002 (via GitHub)" <gi...@apache.org>.
Zakir032002 commented on code in PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#discussion_r2787163626
##########
src/storage/rdb/rdb.cc:
##########
@@ -793,6 +798,25 @@ Status RDB::SaveObject(const std::string &key, const RedisType type) {
return {Status::RedisExecErr, s.ToString()};
}
return SaveStringObject(value);
+ redis::Sortedint sortedint_db(storage_, ns_);
Review Comment:
yes , fixing that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: Add DUMP support for SortedInt type [kvrocks]
Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on code in PR #3366:
URL: https://github.com/apache/kvrocks/pull/3366#discussion_r2786773953
##########
src/storage/rdb/rdb.cc:
##########
@@ -793,6 +798,25 @@ Status RDB::SaveObject(const std::string &key, const RedisType type) {
return {Status::RedisExecErr, s.ToString()};
}
return SaveStringObject(value);
+ redis::Sortedint sortedint_db(storage_, ns_);
Review Comment:
Missed the type check condition?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org