[
https://issues.apache.org/jira/browse/HDDS-6520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kaijie Chen resolved HDDS-6520.
-------------------------------
Resolution: Not A Problem
The original code was changed.
> Refactor RDBTable#getRangeKVs()
> -------------------------------
>
> Key: HDDS-6520
> URL: https://issues.apache.org/jira/browse/HDDS-6520
> Project: Apache Ozone
> Issue Type: Improvement
> Reporter: Kaijie Chen
> Assignee: Kaijie Chen
> Priority: Minor
> Labels: pull-request-available
>
> Refactor {{{}RDBTable#getRangeKVs(){}}}, cleanup code and make getting
> prevKey more efficient.
> h3. Question
> Why {{RDBTable#getRangeKVs()}} should return empty list if {{startKey}} is
> not found?
> It makes getting all key-value pairs awkward.
> h4. *Current*
> For example, if the keys in table are {{{}[10, 20, 30, 40, 50, 60, 70,
> 80]{}}}, and we use {{count = 3}} in each iteration.
> # startKey = {{{}None{}}}, result = {{[10, 20, 30]}}
> # startKey = {{{}30{}}}, result = {{[30, 40, 50] (can't use 31 as strartKey
> or we will get empty result)}}
> # startKey = {{{}50{}}}, result = {{[50, 60, 70] }}
> # startKey = {{{}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.
> h4. *Approach 1*
> If we can seek for the next key if {{startKey}} does not exist, we can use
> {{31}} in the 2nd iteration and get {{{}[40, 50, 60]{}}}.
> # startKey = {{{}None{}}}, result = {{[10, 20, 30]}}
> # startKey = {{{}31{}}}, result = {{[40, 50, 60]}}
> # startKey = {{{}61{}}}, result = {{[70, 80]}}
> Verified CI can pass if we remove the {{startKey}} exist check.
> [https://github.com/apache/ozone/pull/3339#issuecomment-1118150272]
> h4. *Approach 2*
> Or if we can change {{startKey}} to {{{}prevKey{}}}, the iterations will look
> more straightforward.
> # prevKey = {{{}None{}}}, result = {{[10, 20, 30]}}
> # prevKey = {{{}30{}}}, result = {{[40, 50, 60]}}
> # prevKey = {{{}60{}}}, result = {{[70, 80]}}
> However, this approach may require additional changes in the the codebase.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]