chihsuan commented on code in PR #11973:
URL: https://github.com/apache/ozone/pull/11973#discussion_r4513688187


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -1972,11 +1973,13 @@ public OmMultipartUploadListParts listParts(String 
volumeName,
       int partNumberMarker, int maxParts) throws IOException {
     MultipartUploadListPartsRequest.Builder multipartUploadListPartsRequest =
         MultipartUploadListPartsRequest.newBuilder();
-    multipartUploadListPartsRequest.setVolume(volumeName)
+    multipartUploadListPartsRequest.setVolume(
+        volumeName == null ? OzoneConfigKeys.OZONE_S3_VOLUME_NAME_DEFAULT : 
volumeName)
         .setBucket(bucketName).setKey(keyName).setUploadID(uploadID)
         .setPartNumbermarker(partNumberMarker).setMaxParts(maxParts);
 
     OMRequest omRequest = createOMRequest(Type.ListMultiPartUploadParts)
+        .setAssumeS3Context(volumeName == null)

Review Comment:
   Could we handle the `null` volume in `RpcClient`, like the other S3 volume 
PRs? Then the OM protocol never sees a `null` volume. An overload with the S3 
context flag should work.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -2475,11 +2475,22 @@ public void abortMultipartUpload(String volumeName,
     ozoneManagerClient.abortMultipartUpload(omKeyArgs);
   }
 
+  private String resolveS3VolumeForMultipartListing(String volumeName) throws 
IOException {
+    if (volumeName == null) {
+      if 
(OzoneManagerVersion.S3_VOLUME_CONTEXT_RESOLUTION.isSupportedBy(getOmVersion()))
 {
+        return null;
+      }
+      volumeName = getS3VolumeContext().getOmVolumeArgs().getVolume();
+    }
+    verifyVolumeName(volumeName);
+    return volumeName;

Review Comment:
   `S3ClientProtocol` already handles older OMs, so I think we can drop this 
fallback. It follows an older pattern that HDDS-17485 plans to remove.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java:
##########
@@ -1067,14 +1067,16 @@ private ServiceListResponse 
getServiceList(ServiceListRequest request)
   }
 
   private MultipartUploadListPartsResponse listParts(
-      MultipartUploadListPartsRequest multipartUploadListPartsRequest)
+      MultipartUploadListPartsRequest multipartUploadListPartsRequest, boolean 
assumeS3Context)
       throws IOException {
 
     MultipartUploadListPartsResponse.Builder response =
         MultipartUploadListPartsResponse.newBuilder();
 
+    String volumeName = assumeS3Context
+        ? impl.getS3VolumeContext(true).getOmVolumeArgs().getVolume() : 
multipartUploadListPartsRequest.getVolume();

Review Comment:
   nit: Other read paths resolve the volume inside `OzoneManager`. Could we do 
the same here? Then `getS3VolumeContext` can stay package-private.



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/MultipartKeyHandler.java:
##########
@@ -64,7 +63,9 @@ Response handleGetRequest(ObjectEndpoint.ObjectRequestContext 
context, String ke
       }
       ServerSideEncryption.rejectCustomerKey(getHeaders(), keyPath);
       int partMarker = parsePartNumberMarker(partNumberMarker);
-      Response response = listParts(context.getVolume(), 
context.getBucketName(), keyPath, uploadId,
+      String volumeName = 
S3Owner.hasBucketOwnershipVerificationConditions(getHeaders())
+          ? context.getBucket().getVolumeName() : null;

Review Comment:
   Once #11740 lands, we could reuse its `getCachedVolumeName()` here and in 
`ListMultipartUploadsHandler`. That keeps this volume lookup in one place 
instead of two.



-- 
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]

Reply via email to