aswinshakil commented on code in PR #4946:
URL: https://github.com/apache/ozone/pull/4946#discussion_r1237381573
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -386,16 +389,30 @@ public static DBCheckpoint createOmSnapshotCheckpoint(
omMetadataManager.getTableLock(OmMetadataManagerImpl.DELETED_TABLE)
.writeLock().lock();
+ boolean snapshotDirExist = false;
+
try {
// Create DB checkpoint for snapshot
- dbCheckpoint = store.getSnapshot(snapshotInfo.getCheckpointDirName());
- // Clean up active DB's deletedTable right after checkpoint is taken,
- // with table write lock held
- deleteKeysFromDelKeyTableInSnapshotScope(omMetadataManager,
- snapshotInfo.getVolumeName(), snapshotInfo.getBucketName());
- // Clean up deletedDirectoryTable as well
- deleteKeysFromDelDirTableInSnapshotScope(omMetadataManager,
- snapshotInfo.getVolumeName(), snapshotInfo.getBucketName());
+ String checkpointPrefix = store.getDbLocation().getName();
+ Path snapshotDirPath = Paths.get(store.getSnapshotsParentDir(),
+ checkpointPrefix + snapshotInfo.getCheckpointDir());
+ if (Files.exists(snapshotDirPath)) {
+ snapshotDirExist = true;
+ dbCheckpoint = new RocksDBCheckpoint(snapshotDirPath);
+ } else {
+ dbCheckpoint = store.getSnapshot(snapshotInfo.getCheckpointDirName());
+ }
+
+ if (!snapshotDirExist) {
Review Comment:
Should we do the cleanup even if the checkpoint already exists?
--
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]