swamirishi commented on code in PR #9270:
URL: https://github.com/apache/ozone/pull/9270#discussion_r2511248377


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java:
##########
@@ -262,31 +269,30 @@ void optimizeDirDeletesAndSubmitRequest(
       List<Pair<String, OmKeyInfo>> allSubDirList,
       List<PurgePathRequest> purgePathRequestList,
       String snapTableKey, long startTime,
-      long remainingBufLimit, KeyManager keyManager,
+      KeyManager keyManager,
       CheckedFunction<KeyValue<String, OmKeyInfo>, Boolean, IOException> 
reclaimableDirChecker,
       CheckedFunction<KeyValue<String, OmKeyInfo>, Boolean, IOException> 
reclaimableFileChecker,
       Map<VolumeBucketId, BucketNameInfo> bucketNameInfoMap,
-      UUID expectedPreviousSnapshotId, long rnCnt) throws InterruptedException 
{
+      UUID expectedPreviousSnapshotId, long rnCnt, AtomicInteger remainNum) 
throws InterruptedException {
 
     // Optimization to handle delete sub-dir and keys to remove quickly
     // This case will be useful to handle when depth of directory is high
     int subdirDelNum = 0;
     int subDirRecursiveCnt = 0;
-    int consumedSize = 0;
-    while (subDirRecursiveCnt < allSubDirList.size() && remainingBufLimit > 0) 
{
+    while (subDirRecursiveCnt < allSubDirList.size() && remainNum.get() > 0) {
       try {
         Pair<String, OmKeyInfo> stringOmKeyInfoPair = 
allSubDirList.get(subDirRecursiveCnt++);
         Boolean subDirectoryReclaimable = 
reclaimableDirChecker.apply(Table.newKeyValue(stringOmKeyInfoPair.getKey(),
             stringOmKeyInfoPair.getValue()));
         Optional<PurgePathRequest> request = prepareDeleteDirRequest(
             stringOmKeyInfoPair.getValue(), stringOmKeyInfoPair.getKey(), 
subDirectoryReclaimable, allSubDirList,
-            keyManager, reclaimableFileChecker, remainingBufLimit);
+            keyManager, reclaimableFileChecker, remainNum);
         if (!request.isPresent()) {
           continue;
         }
         PurgePathRequest requestVal = request.get();
-        consumedSize += requestVal.getSerializedSize();
-        remainingBufLimit -= consumedSize;
+        int cost = 1 + requestVal.getDeletedSubFilesCount() + 
requestVal.getMarkDeletedSubDirsCount();

Review Comment:
   Why reduce value here?



-- 
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]

Reply via email to