kbendick commented on a change in pull request #3801:
URL: https://github.com/apache/iceberg/pull/3801#discussion_r775088658



##########
File path: core/src/test/java/org/apache/iceberg/hadoop/TestCachingCatalog.java
##########
@@ -252,9 +254,9 @@ public void 
testCacheExpirationEagerlyRemovesMetadataTables() throws IOException
     ticker.advance(HALF_OF_EXPIRATION);
     
Assertions.assertThat(catalog.cache().asMap()).doesNotContainKey(tableIdent);
 
-    Arrays.stream(metadataTables(tableIdent)).forEach(metadataTable ->
-        Assert.assertFalse("When a data table expires, its metadata tables 
should expire regardless of age",
-            catalog.cache().asMap().containsKey(metadataTable)));
+    // Removal of metadata tables from cache is async, use awaitility
+    await().untilAsserted(() ->
+        
Assertions.assertThat(catalog.cache().asMap()).doesNotContainKeys(metadataTables(tableIdent)));

Review comment:
       We typically don't expect to see a _huge_ amount of cache usage. It's 
for caching tables that are accessed, and a job usually accesses a table via 
the catalog one time at the start of the job when query planning happens.
   
   There are cases where they can be accessed several times (as mentioned in 
the issue), but it's usually a pretty limited number of values and times to use 
it.
   
   Would it be a terrible idea to use `Caffeine.executor(Runnable::run)` to 
disable async in the actual production code? Ideally the tables we're removing 
in the `RemovalListener` would expire synchronously when the main table they 
reference expires.
   
   Thanks again for your input and the great library @ben-manes!




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