You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/28 18:19:26 UTC

[GitHub] [ozone] sadanand48 commented on pull request #3750: HDDS-7217. OM logs wrong bucket layout

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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org