swamirishi commented on code in PR #9423:
URL: https://github.com/apache/ozone/pull/9423#discussion_r2599909091
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -2295,15 +2296,36 @@ private <T extends WithParentObjectId> DeleteKeysResult
gatherSubPathsWithIterat
List<OmKeyInfo> keyInfos = new ArrayList<>();
String seekFileInDB = metadataManager.getOzonePathKey(volumeId, bucketId,
parentInfo.getObjectID(), "");
try (TableIterator<String, ? extends KeyValue<String, T>> iterator =
table.iterator(seekFileInDB)) {
- while (iterator.hasNext() && remainingNum > 0) {
+ String startKey = null;
+ String lastLoopExclusiveKey =
getLexicographicallyHigherString(seekFileInDB);
+ List<DeleteKeysResult.ExclusiveRange> keyRanges = new ArrayList<>();
+ boolean processedAllKeys = true;
+ while (iterator.hasNext()) {
KeyValue<String, T> entry = iterator.next();
KeyValue<String, OmKeyInfo> keyInfo =
deleteKeyTransformer.apply(entry);
+ String tableKey = entry.getKey();
+ if (remainingNum <= 0) {
+ lastLoopExclusiveKey = tableKey;
+ processedAllKeys = false;
+ break;
+ }
if (deleteKeyFilter.apply(keyInfo)) {
keyInfos.add(keyInfo.getValue());
remainingNum--;
+ if (startKey == null) {
+ startKey = tableKey;
+ }
+ } else {
+ if (startKey != null) {
+ keyRanges.add(new DeleteKeysResult.ExclusiveRange(startKey,
tableKey));
+ }
+ startKey = null;
}
}
- return new DeleteKeysResult(keyInfos, !iterator.hasNext());
+ if (startKey != null) {
+ keyRanges.add(new DeleteKeysResult.ExclusiveRange(startKey,
lastLoopExclusiveKey));
+ }
+ return new DeleteKeysResult(keyInfos, keyRanges, processedAllKeys);
Review Comment:
yeah my bad
--
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]