HDDS-6520. Refactor RDBTable#getRangeKVs()#3339
Closed
kaijchen wants to merge 3 commits intoapache:masterfrom
Closed
HDDS-6520. Refactor RDBTable#getRangeKVs()#3339kaijchen wants to merge 3 commits intoapache:masterfrom
kaijchen wants to merge 3 commits intoapache:masterfrom
Conversation
kerneltime
approved these changes
Apr 25, 2022
Member
Author
|
Cc @errose28 for review. |
Member
Author
|
One question here: if startKey does not exist in table, can we start from the key after it? Although it may break compatibility, current CI can be passed: https://github.com/kaijchen/ozone/actions/runs/2273344827 |
Member
Author
This refactor is no longer needed, since the original implementation is changed. The question section should be addressed in another PR. |
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.
What changes were proposed in this pull request?
Refactor
RDBTable#getRangeKVs(), cleanup code and make getting prevKey more efficient.Question
Why
RDBTable#getRangeKVs()should return empty list if startKey is not found?It makes getting all key-value pairs awkward.
Current
For example, if the keys in table are
[10, 20, 30, 40, 50, 60, 70, 80], and we usecount = 3in each iteration.None, result =[10, 20, 30]30, result =[30, 40, 50], (can't use31as startKey)50, result =[50, 60, 70]70, result =[70, 80]And the total results is
[10, 20, 30, 30, 40, 50, 50, 60, 70, 70, 80], note the startKey in each iteration is duplicated.Approach 1
If we can seek for the next key if startKey does not exist, we can use
31in the 2nd iteration and get[40, 50, 60].None, result =[10, 20, 30]31, result =[40, 50, 60]61, result =[70, 80]Verified CI can pass if we remove the startKey exist check. #3339 (comment)
Approach 2
Or if we can change startKey to prevKey, the iterations will look more straightforward.
None, result =[10, 20, 30]30, result =[40, 50, 60]60, result =[70, 80]However, this approach may require additional changes in the the codebase.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6520
How was this patch tested?
CI