hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-11779) Ozone: KSM: add listBuckets
Date Fri, 26 May 2017 02:06:04 GMT

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

Yiqun Lin commented on HDFS-11779:
----------------------------------

Thanks [~cheersyang] for working on this. I just take a quick look now, and caught some nits:

* Can you use {{numBuckets}} to replace the parameter {{count}}? It will be good to understood.
{code}
+  public List<KsmBucketInfo> listBuckets(String volumeName,
+      String startKey, String prefix, int count) throws IOException {
+    try {
+      metrics.incNumBucketLists();
+      return bucketManager.listBuckets(volumeName, startKey, prefix, count);
+    } catch (Exception ex) {
+      metrics.incNumBucketListFails();
+      throw ex;
+    }
{code}
* It seems we don't need to print test directory here, right?
{code}
+public class TestLevelDBStore {
+
+  private LevelDBStore store;
+  private File testDir;
+
+  @Before
+  public void init() throws IOException {
+    testDir = GenericTestUtils.getTestDir(getClass().getSimpleName());
+    System.out.println(testDir.getAbsolutePath());                 <======
+    store = new LevelDBStore(testDir, true);
+  }
{code}
* Can you add more detailed error info when we found the volume bucket is null.
{code}
+  public String[] getVolumeBucket(byte[] bytes) {
+    String[] volumeBucket = new String[2];
+    String bucketKey = DFSUtil.bytes2String(bytes);
+    Path p = null;
+    try {
+      p = new Path(bucketKey);
+    } catch (IllegalArgumentException e) {
+      return null;   <====
+    }
+    // looking for "/volume_name/bucket_name" schema
+    if (p.isRoot()) {
+      return null; <====
+    }else if (p.getParent().isRoot()) {
+      return null; <====
+    } else if (!p.getParent().getParent().isRoot()) {
+      return null;  <====
+    } else {
+      volumeBucket[0] = p.getParent().getName();
+      volumeBucket[1] = p.getName();
+      return volumeBucket;
+    }
+  }
{code}

Will give more detailed review comments soon.

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


Mime
View raw message