errose28 commented on code in PR #4865:
URL: https://github.com/apache/ozone/pull/4865#discussion_r1231473559
##########
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:
Looks like `-l` for the existing list command does not support `-1` as an
override to list all keys. It should probably have that, but that can be done
in a follow up PR. These two things combined mean the length message will
always be there and jq will never work unless `-l` is set to something like 100
billion.
--
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]