[
https://issues.apache.org/jira/browse/HDFS-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16038072#comment-16038072
]
Yuanbo Liu commented on HDFS-11926:
-----------------------------------
[~cheersyang] Thanks for the patch.
1. LevelDBKeyFilters.java
line 53 ~ 70, we can refactor it as below:
{code}
public PreKeyFilter(String expectedPrevKey) {
this.expectedPrevKey = expectedPrevKey;
if (Strings.isNullOrEmpty(expectedPrevKey)) {
this.preKeyFound = true;
}
}
@Override
public boolean filterKey(byte[] preKey, byte[] currentKey, byte[] nextKey) {
if (preKey != null && expectedPrevKey != null &&
expectedPrevKey.equals(DFSUtil.bytes2String(preKey))) {
preKeyFound = true;
}
return preKeyFound;
}
}
{code}
2. PreKeyFilter is corresponding to startKey
{quote}
getRangeKVs(byte[] startKey, int count, LevelDBKeyFilter... filters)
{quote}
It's a bit confusing that both startKey and PreKeyFilter are given while
invoking this method.
3. If the startKey is not a existing key(not null or empty), the
{{getRangeKVs}} method returns the whole keys, would it be better to return an
empty list here?
> Ozone: Implement a common helper to return a range of KVs in levelDB
> --------------------------------------------------------------------
>
> Key: HDFS-11926
> URL: https://issues.apache.org/jira/browse/HDFS-11926
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: ozone
> Reporter: Weiwei Yang
> Assignee: Weiwei Yang
> Priority: Blocker
> Attachments: HDFS-11926-HDFS-7240.001.patch,
> HDFS-11926-HDFS-7240.002.patch
>
>
> There are quite some *LIST* operations need to get a range of keys or values
> from levelDB, and filter entries with key prefix.
> # HDFS-11782 listKeys
> # HDFS-11779 listBuckets
> # HDFS-11773 listVolumes
> # HDFS-11679 listContainers
> we need to implement a common utility for them.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]