suvodeep-pyne commented on code in PR #20442:
URL: https://github.com/apache/pinot/pull/20442#discussion_r4765055763


##########
pinot-plugins/pinot-file-system/pinot-s3/src/main/java/org/apache/pinot/plugin/filesystem/S3PinotFS.java:
##########
@@ -264,13 +265,18 @@ public AwsCredentials getAwsCredentials() {
 
   /// Executes the given S3 operation, retrying once after refreshing AWS 
credentials if an [S3Exception] occurs.
   ///
+  /// `AccessDenied` is not retried: a refresh cannot grant a missing 
permission, and it closes the S3 client under
+  /// calls that are still using it.
+  ///
   /// @param action the S3 operation to execute
   /// @param <T> the type of the result returned by the operation
   /// @return the result of the S3 operation
-  /// @throws IOException if the operation fails after credential refresh
+  /// @throws IOException if S3 denies access or the retry fails
   private <T> T retryWithS3CredentialRefresh(Supplier<T> action) throws 
IOException {
     try {
       return action.get();
+    } catch (AccessDeniedException e) {
+      throw new IOException("S3 denied access to the request", e);

Review Comment:
   Follow-up in 56a7609: the message now also names the request Pinot sent, so 
it says what failed, where and why even when S3's own text is generic (MinIO 
answers just "Access Denied."). On AWS:
   ```
   Access denied by S3 for GetObjectRequest(Bucket=<bucket>, Key=<key>), not 
retrying with refreshed credentials: User: arn:aws:iam::<account>:user/<user> 
is not authorized to perform: s3:ListBucket on resource: 
"arn:aws:s3:::<bucket>" because no resource-based policy allows the 
s3:ListBucket action (Service: S3, Status Code: 403, Request ID: ...)
   ```
   `retryWithS3CredentialRefresh` now takes the request it sends. Only the 
resource fields are rendered, since `toString()` would include payloads such as 
a multipart upload's part list.



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