aswinshakil commented on code in PR #4543:
URL: https://github.com/apache/ozone/pull/4543#discussion_r1160067141
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java:
##########
@@ -227,165 +164,32 @@ public BackgroundTaskResult call() throws Exception {
// place holder by returning empty results of this call back.
return BackgroundTaskResult.EmptyTaskResult.newResult();
}
- }
-
- private PurgePathRequest prepareDeleteDirRequest(
- long remainNum, OmKeyInfo pendingDeletedDirInfo, String delDirName,
- List<Pair<String, OmKeyInfo>> subDirList) throws IOException {
- // step-0: Get one pending deleted directory
- if (LOG.isDebugEnabled()) {
- LOG.debug("Pending deleted dir name: {}",
- pendingDeletedDirInfo.getKeyName());
- }
-
- final String[] keys = delDirName.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, remainNum);
- remainNum = remainNum - subDirs.size();
-
- OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
- for (OmKeyInfo dirInfo : subDirs) {
- String ozoneDbKey = omMetadataManager.getOzonePathKey(volumeId,
- bucketId, dirInfo.getParentObjectID(), dirInfo.getFileName());
- String ozoneDeleteKey = omMetadataManager.getOzoneDeletePathKey(
- dirInfo.getObjectID(), ozoneDbKey);
- subDirList.add(Pair.of(ozoneDeleteKey, dirInfo));
- 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, remainNum);
- remainNum = remainNum - subFiles.size();
- if (LOG.isDebugEnabled()) {
- for (OmKeyInfo fileInfo : subFiles) {
- LOG.debug("Moved sub file name: {}", fileInfo.getKeyName());
+ private boolean checkDirPartOfPreviousSnapshot(
+ KeyValue<String, OmKeyInfo> pendingDeletedDirInfo) throws IOException {
+ String key = pendingDeletedDirInfo.getKey();
+ OmKeyInfo deletedDirInfo = pendingDeletedDirInfo.getValue();
+ OmSnapshotManager omSnapshotManager =
+ getOzoneManager().getOmSnapshotManager();
+ OmMetadataManagerImpl metadataManager = (OmMetadataManagerImpl)
+ getOzoneManager().getMetadataManager();
+
+ OmSnapshot latestSnapshot =
+ metadataManager.getLatestSnapshot(deletedDirInfo.getVolumeName(),
+ deletedDirInfo.getBucketName(), omSnapshotManager);
+
+ if (latestSnapshot != null) {
+ Table<String, OmDirectoryInfo> prevDirTable =
+ latestSnapshot.getMetadataManager().getDirectoryTable();
+ // In OMKeyDeleteResponseWithFSO OzonePathKey is converted to
+ // OzoneDeletePathKey. Changing it back to check the previous DirTable.
+ String prevDbKey = metadataManager.getOzoneDeletePathToOzonePath(key);
+ OmDirectoryInfo prevDirInfo = prevDirTable.get(prevDbKey);
+ return prevDirInfo != null &&
+ prevDirInfo.getObjectID() == prevDirInfo.getObjectID();
Review Comment:
Yup. I was changing the variable name and made typo. Will fix it.
--
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]