[ 
https://issues.apache.org/jira/browse/HDFS-11779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16029206#comment-16029206
 ] 

Nandakumar commented on HDFS-11779:
-----------------------------------

Thanks for the updated patch [~cheersyang].

Please correct me, if my understanding is wrong

While making the first call of listBucket the client doesn't have any knowledge 
on prevBucket, so this value will be null.
In that case {{prevKey}} in {{MetadataManagerImpl#listBuckets}} is also null
{code}
if (!Strings.isNullOrEmpty(prevBucket)) {
  prevKey = getBucketKey(volumeName, prevBucket);
}
{code}
So the {{startKey}} of {{LevelDBStore#getRangeKVs}} is also null, and the 
iteration will start from beginning of level DB
{code}
if (startKey != null) {
  dbIter.seek(startKey);
} else {
  dbIter.seekToFirst();
}
{code}
Can we use {{getVolumeKey(volumeName)}} as {{prevKey}} in 
{{MetadataManagerImpl#listBuckets}}, so that we can skip iterating over the 
other previous volumes?

NIT:
According to javadoc of LevelDBStore#getRangeKVs {{If the given startKey is not 
valid, it returns an empty list}}.
This is not true, according to javadoc of DBIterator#seek {{Repositions the 
iterator so the key of the next BlockElement returned greater than or equal to 
the specified targetKey}}.
So even if the startKey is not valid, we will proceed with the next valid key. 
We are returning an empty list only if the filters doesn't match.
The javadoc can be corrected here.

> Ozone: KSM: add listBuckets
> ---------------------------
>
>                 Key: HDFS-11779
>                 URL: https://issues.apache.org/jira/browse/HDFS-11779
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: ozone
>    Affects Versions: HDFS-7240
>            Reporter: Anu Engineer
>            Assignee: Weiwei Yang
>         Attachments: HDFS-11779-HDFS-7240.001.patch, 
> HDFS-11779-HDFS-7240.002.patch, HDFS-11779-HDFS-7240.003.patch, 
> HDFS-11779-HDFS-7240.004.patch, HDFS-11779-HDFS-7240.005.patch, 
> HDFS-11779-HDFS-7240.006.patch, HDFS-11779-HDFS-7240.007.patch
>
>
> Lists buckets of a given volume. Similar to listVolumes, paging supported via 
> prevKey, prefix and maxKeys.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to