Cyrill commented on code in PR #5144:
URL: https://github.com/apache/ozone/pull/5144#discussion_r1305589955
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -2775,7 +2775,32 @@ public OmBucketInfo getBucketInfo(String volume, String
bucket)
bucket, null);
}
metrics.incNumBucketInfos();
- return bucketManager.getBucketInfo(volume, bucket);
+
+ ResolvedBucket resolvedBucket =
+ resolveBucketLink(Pair.of(volume, bucket), true);
Review Comment:
A simple test would fail if we throw an exception there.
```
@Test
public void testDeleteLinkedBucket()
throws Exception {
String volumeName = UUID.randomUUID().toString();
String bucketName = UUID.randomUUID().toString();
String linkedBucketName = UUID.randomUUID().toString();
store.createVolume(volumeName);
OzoneVolume volume = store.getVolume(volumeName);
volume.createBucket(bucketName);
OzoneBucket bucket = volume.getBucket(bucketName);
Assert.assertNotNull(bucket);
volume.createBucket(linkedBucketName,
BucketArgs.newBuilder()
.setSourceBucket(bucketName)
.setSourceVolume(volumeName)
.build());
OzoneBucket linkedBucket = volume.getBucket(linkedBucketName);
Assert.assertNotNull(linkedBucket);
volume.deleteBucket(bucketName);
//now linkedBucketName has become a dangling one
//should still be possible to get its info
OzoneBucket danglingLinkedBucket = volume.getBucket(linkedBucketName);
Assert.assertNotNull(danglingLinkedBucket);
//now delete the dangling linked bucket
volume.deleteBucket(linkedBucketName);
OzoneTestUtils.expectOmException(ResultCodes.BUCKET_NOT_FOUND,
() -> volume.getBucket(bucketName)
);
OzoneTestUtils.expectOmException(ResultCodes.BUCKET_NOT_FOUND,
() -> volume.getBucket(linkedBucketName)
);
}
```
--
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]