sadanand48 commented on code in PR #4008:
URL: https://github.com/apache/ozone/pull/4008#discussion_r1037842901


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java:
##########
@@ -148,61 +150,52 @@ public BackgroundTaskResult call() throws Exception {
                  deleteTableIterator = ozoneManager.getMetadataManager().
             getDeletedDirTable().iterator()) {
 
+          List<Pair<String, OmKeyInfo>> allSubDirList
+              = new ArrayList<>((int) remainNum);
           long startTime = Time.monotonicNow();
           while (remainNum > 0 && deleteTableIterator.hasNext()) {
             pendingDeletedDirInfo = deleteTableIterator.next();
-            // step-0: Get one pending deleted directory
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Pending deleted dir name: {}",
-                  pendingDeletedDirInfo.getValue().getKeyName());
-            }
-            final String[] keys = pendingDeletedDirInfo.getKey()
-                .split(OM_KEY_PREFIX);
-            final long volumeId = Long.parseLong(keys[1]);
-            final long bucketId = Long.parseLong(keys[2]);
-
-            // step-1: get all sub directories under the deletedDir
-            List<OmKeyInfo> subDirs = ozoneManager.getKeyManager()
-                .getPendingDeletionSubDirs(volumeId, bucketId,
-                    pendingDeletedDirInfo.getValue(), remainNum);
-            remainNum = remainNum - subDirs.size();
-
-            if (LOG.isDebugEnabled()) {
-              for (OmKeyInfo dirInfo : subDirs) {
-                LOG.debug("Moved sub dir name: {}", dirInfo.getKeyName());
-              }
-            }
-
-            // step-2: get all sub files under the deletedDir
-            List<OmKeyInfo> subFiles = ozoneManager.getKeyManager()
-                .getPendingDeletionSubFiles(volumeId, bucketId,
-                    pendingDeletedDirInfo.getValue(), remainNum);
-            remainNum = remainNum - subFiles.size();
-
-            if (LOG.isDebugEnabled()) {
-              for (OmKeyInfo fileInfo : subFiles) {
-                LOG.debug("Moved sub file name: {}", fileInfo.getKeyName());
-              }
-            }
-
-          // step-3: Since there is a boundary condition of 'numEntries' in
-          // each batch, check whether the sub paths count reached batch size
-          // limit. If count reached limit then there can be some more child
-          // paths to be visited and will keep the parent deleted directory
-          // for one more pass.
-            String purgeDeletedDir = remainNum > 0 ?
-                pendingDeletedDirInfo.getKey() : null;
 
-            PurgePathRequest request = wrapPurgeRequest(volumeId, bucketId,
-                purgeDeletedDir, subFiles, subDirs);
+            PurgePathRequest request = prepareDeleteDirRequest(
+                remainNum, pendingDeletedDirInfo.getValue(),

Review Comment:
   The above PurgePathRequest will move subdirs to the DeletedDirectoryTable 
and on the next iteration these will get picked up and added to count but we 
are also counting below the same subdirectory  in the second newly added while 
loop  again as deleted which can cause some directories to be counted twice.



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