Skip to content

Commit

Permalink
HDDS-9927. Ozone List keys CLI should co-ordinate between max limit a…
Browse files Browse the repository at this point in the history
…nd listCacheSize.
  • Loading branch information
Sadanand Shenoy committed Jan 3, 2024
1 parent b9e74f6 commit 8f42936
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ public String getOwner() {
return owner;
}

public int getListCacheSize() {
return listCacheSize;
}

/**
* Builder for OmBucketInfo.
/**
Expand Down Expand Up @@ -405,6 +409,10 @@ public void setReplicationConfig(ReplicationConfig replicationConfig)
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ private void listKeysInsideBucket(OzoneClient client, OzoneAddress address)

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
Expand Down

0 comments on commit 8f42936

Please sign in to comment.