hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuanbo Liu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-11926) Ozone: Implement a common helper to return a range of KVs in levelDB
Date Tue, 06 Jun 2017 03:57:18 GMT

    [ 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: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message