TennyZhuang opened a new issue, #437:
URL: https://github.com/apache/iceberg-rust/issues/437

   Background: #301 
   
   The token fetched from the token server may have a TTL, see 
`TokenResponse::expires_in`. In most cases, it's about several hours. Our 
catalog client is a long-lived object, which means that we should handle the 
token expiration event.
   
   There are two ways:
   1. Spawn a background task, and setup a ticker with a specified time 
interval, e.g. `expires_in * 0.9` seconds, and refetch the token when triggered.
     * Pros: Easy to implement
     * Cons: Must trust the local timer skew
     * Cons: Must introduce a timer, which means depending on a specified async 
runtime
   2. Call every methods with a retry wrapper. When meeting an unauthorized 
error, refetch the token and retry the method.
     * Pros: Consistent with iceberg-python
     * Pros: Does not rely on local clock and specific runtime
     * Cons: When expired, thousands of concurrent requests may fail, and then 
all of them will trigger a token refetch, which is not ideal.
       * This can be workaround by some concurrency control, to force only one 
request will refetch the token and others must wait for the result, but it 
introduced complexity.
   
   


-- 
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-unsubscr...@iceberg.apache.org.apache.org

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


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

Reply via email to