feat(tdigest): add support of TDIGEST.RESET command#2826
feat(tdigest): add support of TDIGEST.RESET command#2826PragmaTwice merged 11 commits intoapache:unstablefrom
Conversation
|
@PragmaTwice I updated the Reset function so that it resets the metadata fields and writes the new metadata back. From what I understand, this should only clear the high-level info, removing references to the centroids without actually deleting them. The centroids should still exist until compaction eventually cleans them up. But when I run |
|
@LindaSummer Hi, could you help to review this PR when you have time? |
Hi @PragmaTwice , Of course! Best Regards, |
Hi @SharonIV0x86 , Thanks very much for your effort!😊 If I understand correctly, the compaction is handled by rocksdb and we should delete related keys to free the reference of related keys. In my subkey design, I use a flag prefix for centroid keys. It could be deleted by some method like deletebyprefix. I'm now without a computer by my side, I would provide the function link of prefix deletion today after back home.😊 For the infinite loop issue, I will try to find the cause if you don't mind.😊 Best Regards, |
|
@LindaSummer The looping issue is fixed and it works as expected. |
|
@LindaSummer If possible also provide your implementation too, as you mentioned it can be used by some method like |
LindaSummer
left a comment
There was a problem hiding this comment.
Hi @SharonIV0x86 ,
Thanks very much for your contribution! 😊
Left with some comments.
By the way, could you add some go integration test for this command to cover the new code in this PR if possible?
Best Regards,
Edward
Added go integration tests for TDIGEST.RESET Made requested changes. Added go test case
b2e04c0 to
abc04c7
Compare
|
@LindaSummer I cross-checked with the
Now this aligns with the functionality of |
LindaSummer
left a comment
There was a problem hiding this comment.
Hi @SharonIV0x86 ,
Thanks for your effort.😊
Generally LGTM.
Leave with some nitpick comments.
Best Regards,
Edward
|
@LindaSummer Made the changes, pls check now and lmk so i can proceed with opening a PR for modifying docs. |
LindaSummer
left a comment
There was a problem hiding this comment.
Hi @SharonIV0x86 ,
Thanks for your contribution!
Left one comment.
Other parts are LGTM.
Best Regards,
Edward
fix(cluster): resolve forbidden slot range cleanup bug during the slot migration (apache#2829) Made smoll fixes. Made smoll changes
3cc1cff to
79718dd
Compare
| } | ||
| }; // Stop forbidding writing slot to accept write commands | ||
| if (slot_range == srv_->slot_migrator->GetForbiddenSlotRange()) srv_->slot_migrator->ReleaseForbiddenSlotRange(); | ||
| if (slot_range.HasOverlap(srv_->slot_migrator->GetForbiddenSlotRange())) { |
There was a problem hiding this comment.
Hi @SharonIV0x86 ,
It seems that this file change should not be shown in this PR.
Could you take a review on your commit?
Best Regards,
Edward
There was a problem hiding this comment.
This seems like a mistake, maybe merging the base branch with this can fix it?
| constexpr auto kInfoObservations = "Observations"; | ||
| constexpr auto kInfoTotalCompressions = "Total compressions"; | ||
| } // namespace | ||
|
|
There was a problem hiding this comment.
Hi @SharonIV0x86 ,
Could you help keep this blank line for namespace section if you don't mind? 😊
Best Regards,
Edward
|
LGTM Thanks very much for your contribution!😊 Best Regards, |
Kept a blank line for namespace.
Done. |
|



This closes #2804
This PR
is a Work In Progress andadds the support for theTDIGEST.RESETcommand https://redis.io/docs/latest/commands/tdigest.reset/.I’m currently working on implementing the
TDIGEST.RESETcommand. However, I noticed that there doesn’t seem to be a built-in way to delete centroids from aTDigest. And in order to reset a digest we need to delete the centroids that its containing, correct me if im wrong.Also, to do this, one way i see is that we can manually delete them by iterating over the stored centroids and removing them one by one.
Additionally there seems to be already a
Reset()function defined.kvrocks/src/types/tdigest.cc
Line 117 in b8db0e7
And i am really confused about the two implementation of the
TDigestin kvrocks, one intypes/redis_tdigest.ccand one intype/tdigest.cc.The existing
TDigestcommands uses theTDigestimplementation fromtypes/redis_tdigest.ccand it currently has noReset()function defined.So any assistance or reviews on this PR are highly appreciated as i am new to the codebase.
To the best of my knowledge
DummyCentroidsclass is being used as a class to iterate over centroids inQuantilefunction, maybe if its possible we can add some functionality in this class to delete a centroid.