-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-13901. OmSnaphshotLocalDataManager should throw IOException if unable to resolve to a previous snapshot id #9269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -657,6 +657,13 @@ private LockDataProviderInitResult initialize( | |||||||||
| currentIteratedSnapshotId, snapId, toResolveSnapshotId)); | ||||||||||
| } | ||||||||||
| UUID previousId = previousIds.iterator().next(); | ||||||||||
| // If the previousId is null and if toResolveSnapshotId is not null then should throw an exception since | ||||||||||
| // the snapshot can never be resolved against the toResolveSnapshotId. | ||||||||||
| if (previousId == null) { | ||||||||||
| throw new IOException(String.format( | ||||||||||
| "Snapshot %s versions previousId is null thus %s cannot be resolved against id %s", | ||||||||||
| currentIteratedSnapshotId, snapId, toResolveSnapshotId)); | ||||||||||
| } | ||||||||||
| HierarchicalResourceLock previousToPreviousReadLockAcquired = acquireLock(previousId, true); | ||||||||||
| try { | ||||||||||
| // Get the version node for the snapshot and update the version node to the successor to point to the | ||||||||||
|
|
@@ -705,6 +712,12 @@ private LockDataProviderInitResult initialize( | |||||||||
| // Set the previous snapshot version to the relativePreviousVersionNode which was captured. | ||||||||||
| versionMeta.setPreviousSnapshotVersion(relativePreviousVersionNode.getVersion()); | ||||||||||
| } | ||||||||||
| } else if (toResolveSnapshotId != null) { | ||||||||||
| // If the previousId is null and if toResolveSnapshotId is not null then should throw an exception since | ||||||||||
| // the snapshot can never be resolved against the toResolveSnapshotId. | ||||||||||
|
Comment on lines
+716
to
+717
|
||||||||||
| // If the previousId is null and if toResolveSnapshotId is not null then should throw an exception since | |
| // the snapshot can never be resolved against the toResolveSnapshotId. | |
| // If the current snapshot's previousSnapshotId is null but toResolveSnapshotId is not null, | |
| // throw an exception since the snapshot cannot be resolved against toResolveSnapshotId. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on lines 660-661 is misleading in this context. At this point in the code, we're inside a while loop iterating through the chain, and
previousIdwas just extracted frompreviousIds.iterator().next(). The comment states 'If the previousId is null' but this is checking after we've already verifiedpreviousIdsis not empty (line 654). The comment would be more accurate if it stated 'If previousId is null after extracting from the set, it indicates the chain is broken and cannot continue to toResolveSnapshotId.'