HDDS-1432. Ozone client list command truncates response without any indication. Contributed by Siddharth Wagle.
This commit is contained in:
parent
b8086aed86
commit
f2ab2795db
@ -1114,11 +1114,16 @@ public void testListKey() throws Exception {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -90,12 +90,19 @@ public Void call() throws Exception {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user