echonesis commented on code in PR #11841:
URL: https://github.com/apache/ozone/pull/11841#discussion_r4438401931


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -658,6 +658,16 @@ public UncheckedAutoCloseableSupplier<OmSnapshot> 
getActiveSnapshot(
     return getSnapshot(volumeName, bucketName, snapshotName, false);
   }
 
+  /** Opens an active snapshot only if its name still identifies the expected 
UUID. */
+  public UncheckedAutoCloseableSupplier<OmSnapshot> getActiveSnapshot(
+      String volumeName, String bucketName, String snapshotName, UUID 
expectedSnapshotId) throws IOException {
+    Objects.requireNonNull(expectedSnapshotId, "expectedSnapshotId");
+    if (snapshotName == null || snapshotName.isEmpty()) {
+      throw new OMException(INVALID_KEY_NAME);

Review Comment:
   Thanks for the suggestion. Changed this to throw OMException with 
INVALID_REQUEST when expectedSnapshotId is null, and added a test for this case.



-- 
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]

Reply via email to