jojochuang commented on code in PR #9150:
URL: https://github.com/apache/ozone/pull/9150#discussion_r2488239788
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java:
##########
@@ -283,6 +320,74 @@ private void init() throws IOException {
}
addVersionNodeWithDependents(snapshotLocalData);
}
+ for (UUID snapshotId : versionNodeMap.keySet()) {
+ incrementOrphanCheckCount(snapshotId);
+ }
+ long snapshotLocalDataManagerServiceInterval =
configuration.getTimeDuration(
+ OZONE_OM_SNAPSHOT_LOCAL_DATA_MANAGER_SERVICE_INTERVAL,
+ OZONE_OM_SNAPSHOT_LOCAL_DATA_MANAGER_SERVICE_INTERVAL_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ if (snapshotLocalDataManagerServiceInterval > 0) {
+ this.scheduler = new Scheduler(LOCAL_DATA_MANAGER_SERVICE_NAME, true, 1);
+ this.scheduler.scheduleWithFixedDelay(
+ () -> {
+ try {
+ checkOrphanSnapshotVersions(omMetadataManager, chainManager);
+ } catch (Exception e) {
+ LOG.error("Exception while checking orphan snapshot versions",
e);
+ }
+ }, snapshotLocalDataManagerServiceInterval,
snapshotLocalDataManagerServiceInterval, TimeUnit.MILLISECONDS);
+ }
+
+ }
+
+ private void checkOrphanSnapshotVersions(OMMetadataManager metadataManager,
SnapshotChainManager chainManager)
Review Comment:
does this method need synchronization or locks?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotLocalDataManager.java:
##########
@@ -283,6 +320,74 @@ private void init() throws IOException {
}
addVersionNodeWithDependents(snapshotLocalData);
}
+ for (UUID snapshotId : versionNodeMap.keySet()) {
+ incrementOrphanCheckCount(snapshotId);
+ }
+ long snapshotLocalDataManagerServiceInterval =
configuration.getTimeDuration(
+ OZONE_OM_SNAPSHOT_LOCAL_DATA_MANAGER_SERVICE_INTERVAL,
+ OZONE_OM_SNAPSHOT_LOCAL_DATA_MANAGER_SERVICE_INTERVAL_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ if (snapshotLocalDataManagerServiceInterval > 0) {
+ this.scheduler = new Scheduler(LOCAL_DATA_MANAGER_SERVICE_NAME, true, 1);
+ this.scheduler.scheduleWithFixedDelay(
+ () -> {
+ try {
+ checkOrphanSnapshotVersions(omMetadataManager, chainManager);
+ } catch (Exception e) {
+ LOG.error("Exception while checking orphan snapshot versions",
e);
+ }
+ }, snapshotLocalDataManagerServiceInterval,
snapshotLocalDataManagerServiceInterval, TimeUnit.MILLISECONDS);
+ }
+
+ }
+
+ private void checkOrphanSnapshotVersions(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);
+ }
+ }
+
+ @VisibleForTesting
+ void checkOrphanSnapshotVersions(OMMetadataManager metadataManager,
SnapshotChainManager chainManager,
+ UUID snapshotId) throws IOException {
+ LOG.info("Checking orphan snapshot versions for snapshot {}", snapshotId);
Review Comment:
"Orphan snapshot versions" seems like a really bad problem, but it's not.
Maybe reword it a bit, like this? Not sure.
```suggestion
LOG.debug("Checking orphan YAML metadata files for snapshot versions for
snapshot {}", snapshotId);
```
Also, shouldn't this be a debug level? Otherwise it would print for each
snapshot every 5 minutes.
--
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]