lirui-apache opened a new issue, #7792:
URL: https://github.com/apache/iceberg/issues/7792

   ### Apache Iceberg version
   
   0.13.1
   
   ### Query engine
   
   Spark
   
   ### Please describe the bug 🐞
   
   Currently CachingCatalog only supports cache expiration after access, which 
means stale entries are not expired if they're constantly accessed. I wonder if 
it makes sense to also support expiration after write. For example I was 
expecting the following pseudo test code to pass while it doesn't.
   ```java
       // configure a catalog named iceberg and expiration interval set to 10s
       long expireInterval = Duration.ofSeconds(10).toMillis();
       SparkCatalog sparkCatalog = (SparkCatalog) 
spark().sessionState().catalogManager().catalog("iceberg");
       sql("create table iceberg.default.foo(x int) using iceberg");
       assertTrue(sparkCatalog.tableExists(Identifier.of(new String[] { 
"default" }, "foo")));
       // table dropped by some other user
       hiveMetastore.getClientPool().run(client -> {
         client.dropTable("default", "foo");
         return null;
       });
       long deadline = System.currentTimeMillis() + expireInterval + 5000;
       // try to re-create the table
       while (true) {
         try {
           sql("create table iceberg.default.foo(x int) using iceberg");
           break;
         } catch (Exception e) {
           if (System.currentTimeMillis() > deadline) {
             throw new TimeoutException();
           }
           if (e instanceof TableAlreadyExistsException) {
             Thread.sleep(1000);
           } else {
             throw e;
           }
         }
       }
   ```


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