hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [hadoop] branch trunk updated: HDDS-1432. Ozone client list command truncates response without any indication. Contributed by Siddharth Wagle.
Date Tue, 16 Apr 2019 19:36:11 GMT
This is an automated email from the ASF dual-hosted git repository.

arp pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f2ab279  HDDS-1432. Ozone client list command truncates response without any indication.
Contributed by Siddharth Wagle.
f2ab279 is described below

commit f2ab2795db0da1c912f86855031604de389411da
Author: Arpit Agarwal <arp@apache.org>
AuthorDate: Tue Apr 16 12:35:49 2019 -0700

    HDDS-1432. Ozone client list command truncates response without any indication. Contributed
by Siddharth Wagle.
---
 .../test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java  | 5 +++++
 .../org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java   | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
index 1b10135..0b53f69 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
@@ -1114,11 +1114,16 @@ public class TestOzoneShell {
     }
 
     out.reset();
+    String msgText = "Listing first 3 entries of the result. " +
+        "Use --length (-l) to override max returned keys.";
     args =
         new String[] {"key", "list", url + "/" + volumeName + "/" + bucketName,
             "--length", "3"};
     execute(shell, args);
     commandOutput = out.toString();
+    assertTrue("Expecting output to start with " + msgText,
+        commandOutput.contains(msgText));
+    commandOutput = commandOutput.replace(msgText, "");
     keys = (List<KeyInfo>) JsonUtils.toJsonList(commandOutput,
         KeyInfo.class);
 
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
index 5642bc7..111ce16 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java
@@ -90,12 +90,19 @@ public class ListKeyHandler extends Handler {
         startKey);
     List<KeyInfo> keyInfos = new ArrayList<>();
 
+    int maxKeyLimit = maxKeys;
     while (maxKeys > 0 && keyIterator.hasNext()) {
       KeyInfo key = OzoneClientUtils.asKeyInfo(keyIterator.next());
       keyInfos.add(key);
       maxKeys -= 1;
     }
 
+    // More keys were returned notify about max length
+    if (keyIterator.hasNext()) {
+      System.out.println("Listing first " + maxKeyLimit + " entries of the " +
+          "result. Use --length (-l) to override max returned keys.");
+    }
+
     if (isVerbose()) {
       System.out.printf("Found : %d keys for bucket %s in volume : %s ",
           keyInfos.size(), bucketName, volumeName);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message