ArafatKhan2198 commented on code in PR #4182:
URL: https://github.com/apache/ozone/pull/4182#discussion_r1137172396
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java:
##########
@@ -397,7 +419,81 @@ private List<ContainerBlockMetadata> getBlocks(
return blockIds;
}
- private BucketLayout getBucketLayout() {
- return BucketLayout.DEFAULT;
+ /**
+ * Builds an object path for a file system optimized bucket.
+ *
+ * @param prevKeyPrefix the previous key prefix of the object path
+ * @return the object path for the file system optimized bucket
+ * @throws IOException if an IO error occurs
+ */
+ private String buildObjectPathForFileSystemBucket(String prevKeyPrefix)
+ throws IOException {
+ if (StringUtils.isEmpty(prevKeyPrefix)) {
+ return "";
+ }
+ // Normalize the path to remove duplicate slashes & make it easier to
parse.
+ String normalizedPath = normalizePath(prevKeyPrefix);
+ String[] names = parseRequestPath(normalizedPath);
+
+ if (names.length < 3) {
+ LOG.error("Invalid path: {} path should contain a directory",
+ prevKeyPrefix);
+ return prevKeyPrefix;
+ }
+ // Extract the volume, bucket, and key names from the path.
+ String volumeName = names[0];
+ String bucketName = names[1];
+ String keyName = names[names.length - 1];
+
+ // Get the bucket handler for the given volume and bucket.
+ BucketHandler handler =
+ getBucketHandler(reconNamespaceSummaryManager, omMetadataManager,
+ reconSCM, volumeName, bucketName);
+
+ // Only keyPaths for FSO bucket need to be converted to
+ // their respective objectId's
+ if (handler.getBucketLayout() != BucketLayout.FILE_SYSTEM_OPTIMIZED) {
+ return prevKeyPrefix;
+ }
+
+ // Get the object IDs for the bucket, volume, and parent directory.
+ long bucketId, volumeId, parentId;
+ bucketId = handler.getBucketObjectId(names);
+ volumeId = handler.getVolumeObjectId(names);
+ parentId = handler.getDirObjectId(names, names.length - 1);
Review Comment:
Good suggestion, Ill make the changes to handle these exceptions.
--
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]