swamirishi commented on code in PR #10387:
URL: https://github.com/apache/ozone/pull/10387#discussion_r3386715651
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java:
##########
@@ -392,25 +392,135 @@ private void init(OzoneConfiguration configuration,
SnapshotChainManager chainMa
}
- private void checkOrphanSnapshotVersions(OMMetadataManager metadataManager,
SnapshotChainManager chainManager)
+ /**
+ * Drains the snapshots currently queued in {@link
#snapshotToBeCheckedForOrphans}.
+ * Each queued snapshot becomes a seed for a same-run ancestor cascade.
+ */
+ private void checkQueuedOrphanSnapshotVersions(OMMetadataManager
metadataManager,
+ SnapshotChainManager chainManager)
throws IOException {
- for (Map.Entry<UUID, Integer> entry :
snapshotToBeCheckedForOrphans.entrySet()) {
- UUID snapshotId = entry.getKey();
- int countBeforeCheck = entry.getValue();
- checkOrphanSnapshotVersions(metadataManager, chainManager, snapshotId);
- decrementOrphanCheckCount(snapshotId, countBeforeCheck);
+ Set<UUID> processedSnapshotIds = new HashSet<>();
+ List<UUID> queuedSnapshotIds =
getQueuedSnapshotIdsByCreationTimeDesc(metadataManager, chainManager);
Review Comment:
I would suggest we can directly use a stack here to order the UUIDs as the
order of addition of potential orphans would be LIFO for the algo removing the
need for this sort function making it more efficient. So we can have a separate
linked list which maintains the order of UUID entered and we can directly
iterate the linked list instead of snapshotToBeCheckedForOrphans.entrySet()
reaping the same result making this patch much smaller.
--
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]