errose28 commented on code in PR #4865:
URL: https://github.com/apache/ozone/pull/4865#discussion_r1231538695


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java:
##########
@@ -94,4 +103,40 @@ protected void execute(OzoneClient client, OzoneAddress 
address)
     }
   }
 
+  private void listKeysInsideVolume(OzoneClient client, OzoneAddress address)
+      throws IOException {
+    String volumeName = address.getVolumeName();
+    OzoneVolume vol = client.getObjectStore().getVolume(volumeName);
+
+    Iterator<? extends OzoneBucket> bucketIterator =
+        vol.listBuckets(null);
+    int maxKeyLimit = listOptions.getLimit();
+    String keyPrefix = "";
+    if (!Strings.isNullOrEmpty(listOptions.getPrefix())) {
+      keyPrefix += listOptions.getPrefix();
+    }
+
+    int totalKeys = 0;
+    while (bucketIterator.hasNext()) {
+      OzoneBucket bucket = bucketIterator.next();
+      Iterator<? extends OzoneKey> keyIterator = bucket.listKeys(keyPrefix,
+          listOptions.getStartItem());
+
+      int counter = printAsJsonArray(keyIterator, maxKeyLimit);
+      totalKeys += counter;
+      maxKeyLimit -= counter;
+
+      // More keys were returned notify about max length
+      if (keyIterator.hasNext() || (bucketIterator.hasNext()
+          && maxKeyLimit <= 0)) {
+        out().println("Listing first " + totalKeys + " entries of the " +
+            "result. Use --length (-l) to override max returned keys.");
+        return;
+      }
+    }
+    if (isVerbose()) {
+      out().printf("Found : %d keys in volume : %s %n",
+          totalKeys, volumeName);
+    }

Review Comment:
   The separate Jira sounds good. There are probably other places where we have 
this problem as well. I guess that makes it optional to fix in this PR or not.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to