Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, Execut
// Validating previous snapshot can ensure the chain hasn't changed.
UUID expectedPreviousSnapshotId = purgeDirsRequest.getExpectedPreviousSnapshotID().hasUuid()
? fromProtobuf(purgeDirsRequest.getExpectedPreviousSnapshotID().getUuid()) : null;
validatePreviousSnapshotId(fromSnapshotInfo, omMetadataManager.getSnapshotChainManager(),
expectedPreviousSnapshotId);
if (!validatePreviousSnapshotId(fromSnapshotInfo, omMetadataManager.getSnapshotChainManager(),
expectedPreviousSnapshotId)) {
return new OMDirectoriesPurgeResponseWithFSO(createErrorOMResponse(omResponse,
new OMException("Snapshot validation failed", OMException.ResultCodes.INVALID_REQUEST)));
}
Comment on lines +116 to +118
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'Snapshot validation failed' is too generic and doesn't provide enough context for debugging. Consider adding more specific information about what aspect of validation failed or why the request should be retried.

Suggested change
return new OMDirectoriesPurgeResponseWithFSO(createErrorOMResponse(omResponse,
new OMException("Snapshot validation failed", OMException.ResultCodes.INVALID_REQUEST)));
}
String actualPrevSnapshotId = (fromSnapshotInfo != null && fromSnapshotInfo.getPreviousSnapshot() != null)
? fromSnapshotInfo.getPreviousSnapshot().toString() : "null";
String errorMsg = String.format(
"Snapshot validation failed for fromSnapshot='%s': expected previousSnapshotId=%s, actual previousSnapshotId=%s",
fromSnapshot,
expectedPreviousSnapshotId != null ? expectedPreviousSnapshotId.toString() : "null",
actualPrevSnapshotId
);
return new OMDirectoriesPurgeResponseWithFSO(createErrorOMResponse(omResponse,
new OMException(errorMsg, OMException.ResultCodes.INVALID_REQUEST)));

Copilot uses AI. Check for mistakes.
}
} catch (IOException e) {
LOG.error("Error occurred while performing OMDirectoriesPurge. ", e);
Expand Down