HDDS-14876. Make snapshot diff progress more granular - #10901
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves snapshot diff progress observability across OM, client, and CLI by adding stage-level substatus reporting and (when applicable) progress percentage, plus additional per-stage logging to help operators understand runtime behavior.
Changes:
- Extends the SnapshotDiffResponse wire format to include
subStatusand optionalprogressPercent, and wires these through OM server handling, client-side translation, and CLI JSON/text rendering. - Adds a new FSO-specific stage (
PATH_RESOLUTION_FSO) and refines snapshot diff stage transitions/logging insideSnapshotDiffManager. - Adds/updates unit tests to validate proto serialization behavior and SnapshotDiffResponse rendering.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/protocolPB/TestOzoneManagerRequestHandler.java | Adds tests asserting subStatus/progress are serialized into the OM protocol response (or omitted when subStatus is null). |
| hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDiffManager.java | Updates snapshot diff manager tests and adds coverage for in-progress responses including subStatus/progress details and new PATH_RESOLUTION_FSO state. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java | Serializes SnapshotDiffResponse subStatus/progress into the protobuf response. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java | Adds PATH_RESOLUTION_FSO stage, improves stage logging, and resets progress at the start of object-ID-map generation. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/diff/delta/CompositeDeltaDiffComputer.java | Adds a warning when DAG-based delta computation yields no result and the code falls back to full diff. |
| hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto | Adds PATH_RESOLUTION_FSO enum value and new optional progressPercent field to SnapshotDiffResponse. |
| hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/snapshot/TestSnapshotDiffResponse.java | Expands response-string rendering tests for map-gen vs non-map-gen substatuses and null subStatus behavior. |
| hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/snapshot/SnapshotDiffResponse.java | Adds getters, refines toString formatting, introduces SubStatus.hasProgress(), and adds PATH_RESOLUTION_FSO. |
| hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java | Deserializes subStatus/progress from protobuf into the client SnapshotDiffResponse. |
| hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotDiffHandler.java | Includes subStatus and (only when applicable) progressPercent in CLI JSON output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1312,6 +1334,10 @@ void addToObjectIdMap(Table<String, ? extends WithParentObjectId> fsTable, | |||
| } | |||
| } | |||
| } | |||
There was a problem hiding this comment.
In most cases Total keysProcessed < totalEstimatedKeysToProcess. So, the progress may never reach 100% inside the loop. You can set it after the loop to indicate that the stage has finished.
| } | |
| } | |
| updateProgress(jobKey, 1.0) |
There was a problem hiding this comment.
One edge case appears to remain: when deltaFiles.isEmpty(), the method returns after resetting progress to 0.0, so it never reaches the terminal 1.0 update or emits a stage summary. An empty stage could go directly to 100% and log that it was skipped:
- updateProgress(jobKey, 0.0);
if (deltaFiles.isEmpty()) {
+ updateProgress(jobKey, 1.0);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipped object ID map generation for table '{}' because there are no delta files, jobId: {}",
+ fsTable.getName(), jobId);
+ }
return;
}
+ updateProgress(jobKey, 0.0);| }, | ||
| () -> { | ||
| if (bucketLayout.isFileSystemOptimized()) { | ||
| recordActivity(jobKey, PATH_RESOLUTION_FSO); |
There was a problem hiding this comment.
Progress capture for PATH_RESOLUTION_FSO and DIFF_REPORT_GEN stages is not consistent with the ObjectID generation stages. Could you also explore how we can capture the progress of these stages as well?
There was a problem hiding this comment.
Good idea, opened HDDS-16058 as a follow-up
| } | ||
| } | ||
| } | ||
| updateProgress(jobKey, 1.0); |
There was a problem hiding this comment.
Could we keep the debug log in the same 0-100 unit as the persisted and RPC value? updateProgress(1.0) stores 100.0, but the helper logs the raw 1.0 with a % suffix. The final update therefore logs 1.0%, and a 10% checkpoint logs 0.1%. This appears to be a one-line behavioral fix:
- LOG.debug("Completed processing {}% of keys for snapshot diff job {}", pct, jobKey);
+ LOG.debug("Completed processing {}% of keys for snapshot diff job {}",
+ snapshotDiffJob.getKeysProcessedPct(), jobKey);
What changes were proposed in this pull request?
Improves snapshot diff progress granularity by letting clients track which stage a diff job is in and adding more informative logs. Main changes:
subStatusandprogressPercentthrough the proto layer and CLI output (with a minor formatting fix)PATH_RESOLUTION_FSO)SST_FILE_DELTA_*instead of switching toOBJECT_ID_MAP_GEN_*during object ID map generationBefore / After
Example CLI output when polling an in-progress snapshot diff before this change:
$ ozone sh snapshot diff --get-report /vol/bucket snap1 snap2 Snapshot diff job is IN_PROGRESS. Please retry after 60000 ms. $ ozone sh snapshot diff --get-report --json /vol/bucket snap1 snap2 { "snapshotDiffReport" : { ... }, "jobStatus" : "IN_PROGRESS", "waitTimeInMs" : 60000 }And after:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14876
How was this patch tested?