You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Ferdinanddb (via GitHub)" <gi...@apache.org> on 2025/11/19 20:40:43 UTC

[I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Ferdinanddb opened a new issue, #14634:
URL: https://github.com/apache/iceberg/issues/14634

   ### Feature Request / Improvement
   
   I am using Spark (pyspark) 4.0.1 and Iceberg 1.10.0.
   
   Right now, when using the BigLake REST catalog with the vended-credentials mode enabled and Spark to manipulate Iceberg tables, Spark jobs that runs for more than an hour fails with the following error:
   ```
   INFO - [spark-kubernetes-driver] Caused by: com.google.cloud.storage.StorageException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.
   ```
   
   It works fine for jobs that take less than an hour to finish. And it also work fine if I disable the vended-credentials mode, but it means that I need to grant more IAM roles (specifically read role on the GCS bucket where the data is stored, as [described here](https://docs.cloud.google.com/biglake/docs/blms-rest-catalog#required_roles)).
   
   My understanding is that the vended-credentials mode generates an access token that is valid for one hour, and therefore the job will fail if it is still trying to interact with Iceberg tables after an hour.
   
   I contacted the BigLake support some time ago, and it seems that the method `OAuth2RefreshCredentialsHandler.refreshAccessToken()` ([link here](https://github.com/apache/iceberg/blob/cc38966a84775a369bb4e35e8158845a0e8a54a6/gcp/src/main/java/org/apache/iceberg/gcp/gcs/OAuth2RefreshCredentialsHandler.java#L66)) is not used anywhere.
   
   I would assume that this method should be used somewhere in this Iceberg project to not get an error anymore. Sorry in advance if this is not the case.
   
   To reproduce the error, one can create a BigLake REST catalog and spin up a SparkSession using [the following config from their documentation](https://docs.cloud.google.com/biglake/docs/blms-rest-catalog#iceberg-1.10-or-later). The necessary should be done so that the job runs for more than an hour, and then try to read/write an Iceberg table. The job should fail with the same error I get.
   
   ### Query engine
   
   Spark
   
   ### Willingness to contribute
   
   - [ ] I can contribute this improvement/feature independently
   - [x] I would be willing to contribute this improvement/feature with guidance from the Iceberg community
   - [ ] I cannot contribute this improvement/feature at this time


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #14634:
URL: https://github.com/apache/iceberg/issues/14634#issuecomment-3562240492

   > Not all tokens are refreshable in general, and Iceberg specifically has the API that allows fetching credential for this exact situation
   
   It makes sense that not all tokens are refreshable, but that can only be determined by the REST server that issues those tokens.  And yes, `SupportsStorageCredentials` is basically used to pass the **optional** storage credentials from the LoadTable response to the underlying FileIO. However, Iceberg doesn't have anything in place that would automatically just reload the table when tokens are about to expire because this is a decision that would happen at a different layer.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #14634:
URL: https://github.com/apache/iceberg/issues/14634#issuecomment-3561582279

   @vagababov Iceberg by itself doesn't just reload the table when tokens are close to expiration. That's why we implemented refreshing vended credentials which the mechanism I described where the server must indicate that it supports refreshing vended creds by sending the 2 config properties back to a client in the response of LoadTable. If BigLake doesn't do that, then you'll have to talk to them how they envisioned refreshing those credentials. I'll go ahead and close this, since this issue is specific to BigLake REST catalog itself, which the community doesn't maintain.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra closed issue #14634: [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode
URL: https://github.com/apache/iceberg/issues/14634


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "vagababov (via GitHub)" <gi...@apache.org>.
vagababov commented on issue #14634:
URL: https://github.com/apache/iceberg/issues/14634#issuecomment-3561698321

   @nastra  that sounds a bit restricting.
   
   Not all tokens are refreshable in general, and Iceberg specifically has the API that allows fetching credential for this exact situation. `GCSFileIO` is a `SupportsStorageCredentials` and as such, that call back can be used to set new credentials same way if they are refreshed by calling into google OAuth endpoint.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "vagababov (via GitHub)" <gi...@apache.org>.
vagababov commented on issue #14634:
URL: https://github.com/apache/iceberg/issues/14634#issuecomment-3559316024

   @nastra  -- our expectation that actually to refresh credential the system calls [LoadTableCredentials](https://github.com/apache/iceberg/blob/06c1e0a0be75b2dd419b2a97fcb47676cf4da279/open-api/rest-catalog-open-api.yaml#L1197) when the tokens are close to expiration.
   
   The credentials returned from the LoadTable[Credentials] are downscoped tokens and generally are not eligible for refresh.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] [GCP/GCSFileIO] Implement the refreshAccessToken mechanism when using vended-credentials mode [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #14634:
URL: https://github.com/apache/iceberg/issues/14634#issuecomment-3556342891

   > I contacted the BigLake support some time ago, and it seems that the method `OAuth2RefreshCredentialsHandler.refreshAccessToken()` ([link here](https://github.com/apache/iceberg/blob/cc38966a84775a369bb4e35e8158845a0e8a54a6/gcp/src/main/java/org/apache/iceberg/gcp/gcs/OAuth2RefreshCredentialsHandler.java#L66)) is not used anywhere.
   > 
   > I would assume that this method should be used somewhere in this Iceberg project to not get an error anymore. Sorry in advance if this is not the case.
   
   Vended credentials are refreshed when the REST server returns a config as part of the loadTable response and indicates that it supports refreshing vended credentials via `gcs.oauth2.refresh-credentials-endpoint` and `gcs.oauth2.refresh-credentials-enabled`. If the server doesn't return that config in the loadTable response, then the vended credential won't be refreshed. 


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org