sumitagrawl commented on code in PR #4008:
URL: https://github.com/apache/ozone/pull/4008#discussion_r1037910586
##########
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:
Its getting removed from deletedTable also, its processing as below,
Old:
Iteration1: Dir1 <-- delete, Dir2,Dir3 <-- moved to deleted table
Iteration2: Dir2 and Dir3 deleted as no further files
New:
Request have 3 entry
Dir1<-- delete, Dir2,Dir3 <-- move to deletedTable
Dir2 <-- delete
Dir3<-- delete
So here same as old, it move to deletedTable and same is next removed. So it
will not count 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]