aryangupta1998 commented on a change in pull request #2533:
URL: https://github.com/apache/ozone/pull/2533#discussion_r714706396
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/OMKeyAclRequest.java
##########
@@ -146,6 +153,36 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
*/
abstract String getPath();
+ public BucketLayout getBucketLayout(OzoneManager ozoneManager) {
+ BucketLayout bucketLayout = BucketLayout.LEGACY;
+ 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);
+ if (buckInfo == null) {
+ LOG.error("Bucket not found: {}/{} ", volume, bucket);
+ return BucketLayout.LEGACY;
+ }
+ bucketLayout = buckInfo.getBucketLayout();
+ } catch (IOException e) {
+ LOG.debug("Failed to get the value for the key: " + buckKey);
+ }
+ } catch (OMException ome) {
+ // Handle exception
Review comment:
Done
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/acl/OMKeyAclRequest.java
##########
@@ -146,6 +153,36 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
*/
abstract String getPath();
+ public BucketLayout getBucketLayout(OzoneManager ozoneManager) {
+ BucketLayout bucketLayout = BucketLayout.LEGACY;
+ 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);
+ if (buckInfo == null) {
+ LOG.error("Bucket not found: {}/{} ", volume, bucket);
+ return BucketLayout.LEGACY;
+ }
+ bucketLayout = buckInfo.getBucketLayout();
+ } catch (IOException e) {
+ LOG.debug("Failed to get the value for the key: " + buckKey);
Review comment:
Done
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java
##########
@@ -240,11 +240,17 @@ public OMResponse handleReadRequest(OMRequest request) {
@Override
public OMClientResponse handleWriteRequest(OMRequest omRequest,
long transactionLogIndex) {
- OMClientRequest omClientRequest =
- OzoneManagerRatisUtils.createClientRequest(omRequest);
- OMClientResponse omClientResponse =
- omClientRequest.validateAndUpdateCache(getOzoneManager(),
- transactionLogIndex, ozoneManagerDoubleBuffer::add);
+ OMClientRequest omClientRequest = null;
+ OMClientResponse omClientResponse = null;
+ try {
+ omClientRequest =
+ OzoneManagerRatisUtils.createClientRequest(omRequest, impl);
+ omClientResponse = omClientRequest
+ .validateAndUpdateCache(getOzoneManager(), transactionLogIndex,
+ ozoneManagerDoubleBuffer::add);
+ } catch (IOException e) {
+ LOG.debug("Exception: " + e);
Review comment:
Done
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/utils/OzoneManagerRatisUtils.java
##########
@@ -140,8 +142,18 @@ public static void setBucketFSOptimized(boolean
enabledFSO) {
* @return OMClientRequest
* @throws IOException
*/
- public static OMClientRequest createClientRequest(OMRequest omRequest) {
+ public static OMClientRequest createClientRequest(OMRequest omRequest,
+ OzoneManager ozoneManager) throws IOException {
Review comment:
Done
--
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]