This is an automated email from the ASF dual-hosted git repository.
agupta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new fbca103861 HDDS-9927. Ozone List keys CLI should co-ordinate between
max limit and listCacheSize. (#5912)
fbca103861 is described below
commit fbca10386125c064c99e35bed56dc6daa1c93e7b
Author: Sadanand Shenoy <[email protected]>
AuthorDate: Mon Jan 8 14:54:56 2024 +0530
HDDS-9927. Ozone List keys CLI should co-ordinate between max limit and
listCacheSize. (#5912)
---
.../src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java | 8 ++++++++
.../java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
index cd5b180472..441d9143b5 100644
---
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
+++
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java
@@ -301,6 +301,10 @@ public class OzoneBucket extends WithMetadata {
return owner;
}
+ public int getListCacheSize() {
+ return listCacheSize;
+ }
+
/**
* Builder for OmBucketInfo.
/**
@@ -405,6 +409,10 @@ public class OzoneBucket extends WithMetadata {
proxy.setReplicationConfig(volumeName, name, replicationConfig);
}
+ public void setListCacheSize(int listCacheSize) {
+ this.listCacheSize = listCacheSize;
+ }
+
/**
* Creates a new key in the bucket, with default replication type RATIS and
* with replication factor THREE.
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java
index b40873108d..00652b58a9 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java
@@ -77,10 +77,13 @@ public class ListKeyHandler extends VolumeBucketHandler {
OzoneVolume vol = client.getObjectStore().getVolume(volumeName);
OzoneBucket bucket = vol.getBucket(bucketName);
+ int maxKeyLimit = listOptions.getLimit();
+ if (maxKeyLimit < bucket.getListCacheSize()) {
+ bucket.setListCacheSize(maxKeyLimit);
+ }
Iterator<? extends OzoneKey> keyIterator = bucket.listKeys(
keyPrefix, listOptions.getStartItem());
- int maxKeyLimit = listOptions.getLimit();
int counter = printAsJsonArray(keyIterator, maxKeyLimit);
// More keys were returned notify about max length
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]