smengcl commented on code in PR #4015:
URL: https://github.com/apache/ozone/pull/4015#discussion_r1041494043
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -135,6 +140,18 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
throw new OMException("Bucket is not empty",
OMException.ResultCodes.BUCKET_NOT_EMPTY);
}
+
+ // appending '/' to end to eliminate cases where 2 buckets start with
same
+ // characters.
+ String snapshotBucketKey = bucketKey + OzoneConsts.OM_KEY_PREFIX;
+
+ if (bucketContainSnapshot(omMetadataManager, snapshotBucketKey)) {
+ LOG.debug("bucket: {} contains snapshots associated to it",
+ bucketName);
+ throw new OMException("Bucket contains snapshots associated to it",
+ BUCKET_SNAPSHOT_EXISTS);
Review Comment:
```suggestion
LOG.debug("Bucket '{}' can't be deleted when it has snapshots",
bucketName);
throw new OMException("Bucket '" + bucketName + "' can't be deleted
when it has snapshots",
BUCKET_SNAPSHOT_EXISTS);
```
--
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]