rakeshadr commented on a change in pull request #2533:
URL: https://github.com/apache/ozone/pull/2533#discussion_r692384544
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/OMKeyAclRequest.java
##########
@@ -146,6 +148,30 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
*/
abstract String getPath();
+ public OmBucketInfo getBucketInfo(OzoneManager ozoneManager) {
+ OmBucketInfo buckInfo = null;
+ try {
+ ObjectParser objectParser = new ObjectParser(getPath(),
+ OzoneManagerProtocolProtos.OzoneObj.ObjectType.KEY);
+
+ String volume = objectParser.getVolume();
+ String bucket = objectParser.getBucket();
+
+ String buckKey =
+ ozoneManager.getMetadataManager().getBucketKey(volume, bucket);
+
+ try {
+ buckInfo =
+ ozoneManager.getMetadataManager().getBucketTable().get(buckKey);
+ } catch (IOException e) {
+ e.printStackTrace();
Review comment:
Please add log message and remove e.printStackTrace() statement.
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/utils/OzoneManagerRatisUtils.java
##########
@@ -437,4 +473,36 @@ private static ServiceException
createLeaderNotReadyException(
return new ServiceException(leaderNotReadyException);
}
+ private static OmBucketInfo getOmBucketInfo(OzoneManager ozoneManager,
+ OmBucketInfo buckInfo, String volName, String buckName) {
+ String buckKey =
+ ozoneManager.getMetadataManager().getBucketKey(volName, buckName);
+ try {
+ buckInfo =
+ ozoneManager.getMetadataManager().getBucketTable().get(buckKey);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return buckInfo;
+ }
+
+ private static BucketLayout getBucketLayout(OmBucketInfo buckInfo) {
+ if (buckInfo != null) {
+ return buckInfo.getBucketLayout();
+ } else {
+ buckInfo = null;
+ // TODO: Handle bucket validation
Review comment:
bucket null is a tricky case. Since this bucketTable is not inside
BUCKET_LOCK the consistency won't be guaranteed. I think, if the bucket is
coming as null then how about acquiring a BUCK_LOCK and re-read the bucket key
again?
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/utils/OzoneManagerRatisUtils.java
##########
@@ -437,4 +473,36 @@ private static ServiceException
createLeaderNotReadyException(
return new ServiceException(leaderNotReadyException);
}
+ private static OmBucketInfo getOmBucketInfo(OzoneManager ozoneManager,
+ OmBucketInfo buckInfo, String volName, String buckName) {
+ String buckKey =
+ ozoneManager.getMetadataManager().getBucketKey(volName, buckName);
+ try {
+ buckInfo =
+ ozoneManager.getMetadataManager().getBucketTable().get(buckKey);
+ } catch (IOException e) {
+ e.printStackTrace();
Review comment:
@aryangupta1998
Please add log message and remove e.printStackTrace() statement.
--
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]