sadanand48 commented on PR #3750:
URL: https://github.com/apache/ozone/pull/3750#issuecomment-1261301601

   I looked into the code once again for this and I think if it's just the 
logging we're trying to fix here , we are just printing the wrong bucketInfo 
object  , and we could fix this easily just by printing the right object.
   ```java
    if (!bucketInfo.hasBucketLayout()) {
         BucketLayout defaultBucketLayout =
             getDefaultBucketLayout(ozoneManager, volumeName, bucketName);
         omBucketInfo =
             OmBucketInfo.getFromProtobuf(bucketInfo, defaultBucketLayout);
       } else {
         omBucketInfo = OmBucketInfo.getFromProtobuf(bucketInfo);
       }
   ```
   The `bucketLayout` is an optional Enum field in `BucketInfo`  proto  and if 
unset by the client, the default value is the first defined entry in the Enum. 
In this case , the client will not set anything and therefore 
`bucketInfo.bucketLayout = LEGACY` (as this is the first entry), Since client 
has not explicitly set this field , `hasBucketLayout `will return false and it 
will pick the bucket type as defined in the OM default config (inside if 
condition) and assign it to new object `omBucketInfo`. Now omBucketInfo will 
have the bucketType as set by the OM default i.e in this case FSO and it goes 
ahead and creates FSO bucket but the problem is that we're logging based on the 
initial bucketInfo object which has the LEGACY bucket type .
   
   ``` java
   
         LOG.info("created bucket: {} of layout {} in volume: {}", bucketName,
             bucketInfo.getBucketLayout(), volumeName);
   ```
   
   The right fix here should be 
   
   ``` java
   
         LOG.info("created bucket: {} of layout {} in volume: {}", bucketName,
             omBucketInfo.getBucketLayout(), volumeName);
   ```
   
   


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