[
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: [email protected]
For additional commands, e-mail: [email protected]