xBis7 commented on code in PR #3746:
URL: https://github.com/apache/ozone/pull/3746#discussion_r999978658
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/handlers/BucketHandler.java:
##########
@@ -183,8 +185,22 @@ public static BucketHandler getBucketHandler(
OzoneStorageContainerManager reconSCM,
OmBucketInfo bucketInfo) throws IOException {
- return new FSOBucketHandler(reconNamespaceSummaryManager,
- omMetadataManager, reconSCM, bucketInfo);
+ // If bucketInfo is null then entity type is UNKNOWN
+ if (Objects.isNull(bucketInfo)) {
+ return null;
+ } else {
+ if (bucketInfo.getBucketLayout()
+ .equals(BucketLayout.FILE_SYSTEM_OPTIMIZED)) {
+ return new FSOBucketHandler(reconNamespaceSummaryManager,
+ omMetadataManager, reconSCM, bucketInfo);
+ } else if (bucketInfo.getBucketLayout()
+ .equals(BucketLayout.LEGACY)) {
+ return new LegacyBucketHandler(reconNamespaceSummaryManager,
+ omMetadataManager, reconSCM, bucketInfo);
+ } else {
+ throw new RuntimeException("Unsupported bucket layout.");
Review Comment:
Log an error instead of throwing the exception or catch the exception and
then log an error?
--
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]