rakeshadr commented on pull request #2151:
URL: https://github.com/apache/ozone/pull/2151#issuecomment-822397263
> > Simple answer is, during cluster startup the validation logic will check
all the existing buckets, if any and then will fail the OM startup if there are
any older buckets[simple layout].
>
> Fix me if I am wrong, but the current check doesn't handle case when
bucketMetadata is empty (old data). For example if I set layout prefix to
`simple` explicitly (because I have old data) the cluster will be failed even
if it's a valid scenario.
>
> ```java
> + public static boolean isFSOptimizedBucket(
> + Map<String, String> bucketMetadata) {
> + // layout 'PREFIX' represents optimized FS path
> + boolean metadataLayoutEnabled =
> + org.apache.commons.lang3.StringUtils.equalsIgnoreCase(
> + OMConfigKeys.OZONE_OM_METADATA_LAYOUT_PREFIX,
> + bucketMetadata
> + .get(OMConfigKeys.OZONE_OM_METADATA_LAYOUT));
> +
> + boolean fsEnabled =
> + Boolean.parseBoolean(bucketMetadata
> + .get(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS));
> +
> + return metadataLayoutEnabled && fsEnabled;
> + }
> ```
I'm adding test scenarios explicitly with config values to understand it
better, please feel free to add if I missed anything. Thanks!
**Scenario-1)** Created a bucket with older cluster. Here bucketMetadata is
empty.
Test Step-1) Stops OM server and updated configs
ozone.om.metadata.layout=PREFIX and ozone.om.enable.filesystem.paths=true.
Test Step-2) Starts OM, validate isFSOptimizedBucket and
metadataLayoutEnabled will be false.
Test Result: OM startup will fail.
**Scenario-2)** Created a bucket with older cluster. Here bucketMetadata is
empty.
Test Step-1) Stops OM server and updated configs
ozone.om.metadata.layout=SIMPLE and ozone.om.enable.filesystem.paths=true.
Test Step-2) Starts OM
Test Result: OM won't validate the bucketmetadata layout as the cluster
level layout is SIMPLE. It will start successfully with prefix feature
disabled.
Please add you expectations, thanks @elek
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]