SharonIV0x86 opened a new issue, #2907:
URL: https://github.com/apache/kvrocks/issues/2907

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Motivation
   
   Currently, in the functions below, 
   -  [TDigest::CDF](https://github.com/apache/kvrocks/pull/2887)
   -  
[TDigest::Quantile](https://github.com/apache/kvrocks/blob/36a5776a438334629029ef8e22fb414c1f9bbba5/src/types/redis_tdigest.cc#L190C1-L223C1)
   
   
   we repeat the same block of code to:
   - Append namespace prefix to the key
   - Acquire a lock
   - Fetch TDigest metadata
   - Merge unmerged nodes (if any)
   - Update metadata and write it back
   - Refresh the snapshot
   
   As new TDigest features are added, the same preprocessing steps (metadata 
preparation and merging) will likely be needed repeatedly. And this will most 
likely cause code duplication of around 20-30 lines across multiple functions.
   
   ### Solution
   
   This can be avoided by using a helper function to do this work and keep 
things simple.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to