fx19880617 commented on a change in pull request #6272:
URL: https://github.com/apache/incubator-pinot/pull/6272#discussion_r525582760
##########
File path:
pinot-plugins/pinot-file-system/pinot-s3/src/main/java/org/apache/pinot/plugin/filesystem/S3PinotFS.java
##########
@@ -491,17 +511,32 @@ public boolean touch(URI uri)
String path = sanitizePath(uri.getPath());
Map<String, String> mp = new HashMap<>();
mp.put("lastModified", String.valueOf(System.currentTimeMillis()));
- CopyObjectRequest request =
-
CopyObjectRequest.builder().copySource(encodedUrl).destinationBucket(uri.getHost()).destinationKey(path)
-
.metadata(mp).metadataDirective(MetadataDirective.REPLACE).build();
+ CopyObjectRequest.Builder copyReqBuilder =
CopyObjectRequest.builder().copySource(encodedUrl)
+ .destinationBucket(uri.getHost()).destinationKey(path)
+ .metadata(mp).metadataDirective(MetadataDirective.REPLACE);
+ CopyObjectRequest request;
+
+ if (!disableAcl) {
+ request =
copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build();
+ } else {
+ request = copyReqBuilder.build();
+ }
_s3Client.copyObject(request);
long newUpdateTime =
getS3ObjectMetadata(uri).lastModified().toEpochMilli();
return newUpdateTime > s3ObjectMetadata.lastModified().toEpochMilli();
} catch (NoSuchKeyException e) {
String path = sanitizePath(uri.getPath());
-
_s3Client.putObject(PutObjectRequest.builder().bucket(uri.getHost()).key(path).build(),
- RequestBody.fromBytes(new byte[0]));
+ PutObjectRequest.Builder putReqBuilder =
PutObjectRequest.builder().bucket(uri.getHost()).key(path);
+ PutObjectRequest putObjectRequest;
+
+ if (!disableAcl) {
+ putObjectRequest =
putReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build();
Review comment:
just set builder here and build the request later.
##########
File path:
pinot-plugins/pinot-file-system/pinot-s3/src/main/java/org/apache/pinot/plugin/filesystem/S3PinotFS.java
##########
@@ -491,17 +511,32 @@ public boolean touch(URI uri)
String path = sanitizePath(uri.getPath());
Map<String, String> mp = new HashMap<>();
mp.put("lastModified", String.valueOf(System.currentTimeMillis()));
- CopyObjectRequest request =
-
CopyObjectRequest.builder().copySource(encodedUrl).destinationBucket(uri.getHost()).destinationKey(path)
-
.metadata(mp).metadataDirective(MetadataDirective.REPLACE).build();
+ CopyObjectRequest.Builder copyReqBuilder =
CopyObjectRequest.builder().copySource(encodedUrl)
+ .destinationBucket(uri.getHost()).destinationKey(path)
+ .metadata(mp).metadataDirective(MetadataDirective.REPLACE);
+ CopyObjectRequest request;
+
+ if (!disableAcl) {
+ request =
copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build();
Review comment:
set builder here and build the request later.
##########
File path:
pinot-plugins/pinot-file-system/pinot-s3/src/main/java/org/apache/pinot/plugin/filesystem/S3PinotFS.java
##########
@@ -445,7 +458,14 @@ public void copyFromLocalFile(File srcFile, URI dstUri)
LOGGER.info("Copy {} from local to {}", srcFile.getAbsolutePath(), dstUri);
URI base = getBase(dstUri);
String prefix = sanitizePath(base.relativize(dstUri).getPath());
- PutObjectRequest putObjectRequest =
PutObjectRequest.builder().bucket(dstUri.getHost()).key(prefix).build();
+ PutObjectRequest.Builder putReqBuilder =
PutObjectRequest.builder().bucket(dstUri.getHost()).key(prefix);
+ PutObjectRequest putObjectRequest;
+
+ if (!disableAcl) {
+ putObjectRequest =
putReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build();
Review comment:
set builder here and build the request later.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]