kerneltime commented on code in PR #3967:
URL: https://github.com/apache/ozone/pull/3967#discussion_r1173093838
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -125,10 +128,32 @@ public void createVolume(String volumeName, VolumeArgs
volumeArgs)
* @param bucketName - S3 bucket Name.
* @throws IOException - On failure, throws an exception like Bucket exists.
*/
- public void createS3Bucket(String bucketName) throws
- IOException {
+ public void createS3Bucket(String bucketName) throws IOException {
OzoneVolume volume = getS3Volume();
- volume.createBucket(bucketName);
+ String bucketLayoutFromConfig = conf.getTrimmed(
+ OzoneConfigKeys.OZONE_S3G_DEFAULT_BUCKET_LAYOUT_KEY,
+ OzoneConfigKeys.OZONE_S3G_DEFAULT_BUCKET_LAYOUT_DEFAULT);
+ BucketLayout bucketLayout = OmUtils
+ .validateBucketLayout(bucketLayoutFromConfig);
+
+ // Backwards compatibility:
+ // When OM is pre-finalized for the bucket layout feature, it will block
+ // the creation of all bucket types except legacy. If OBS bucket creation
+ // fails for this reason, retry with legacy bucket layout.
+ try {
+ volume.createBucket(bucketName,
+ BucketArgs.newBuilder().setBucketLayout(bucketLayout).build());
+ } catch (OMException ex) {
+ if (ex.getResult() ==
+ OMException.ResultCodes.NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION) {
+ LOG.info("Failed to create OBS bucket since OM is pre-finalized for " +
Review Comment:
The string should be based on the actual bucket type.
--
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]