sungwy commented on code in PR #18716:
URL: https://github.com/apache/iceberg/pull/18716#discussion_r4803923478


##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/PrefixedStorage.java:
##########
@@ -152,7 +152,8 @@ private Credentials credentials(GCPProperties properties) {
     // in most cases the convenient way, especially in GCP.
     // See javadoc of 
com.google.auth.oauth2.GoogleCredentials.getApplicationDefault()
     if (properties.oauth2Token().isPresent()) {
-      return GCPAuthUtils.oauth2CredentialsFromGcpProperties(properties, 
closeableGroup);
+      return GCPAuthUtils.oauth2CredentialsFromGcpProperties(
+          properties, storagePrefix, closeableGroup);

Review Comment:
   PrefixedStorage and OAuth2RefreshCredentialsHandler are both in gcp.gcs. 
Could PrefixedStorage build the OAuth2CredentialsWithRefresh itself, so the 
storage prefix never has to go through GCPAuthUtils? 
   
   That would avoid introducing a new public API



##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/OAuth2RefreshCredentialsHandler.java:
##########
@@ -46,11 +47,12 @@ public class OAuth2RefreshCredentialsHandler
   private final String credentialsEndpoint;
   // will be used to refresh the OAuth2 token
   private final String catalogEndpoint;
+  private final String storagePrefix;

Review Comment:
   I'm not sure if this makes sense to me personally. A credentials refresh on 
the endpoint is per table, and returns a list of storage credentials for that 
table on every loadCredentials request. I think it's worth considering creating 
a single `OAuth2RefreshCredentialsHandler` instance for each table/fileIO 
rather than per storagePrefix.
   
   
https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L4228-L4236
   
   Imagine a list of N storage credentials with the same expiry, all expiring 
at the same time. Wouldn't that create N requests, although all the credentials 
would be refreshed through a single request?



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