lirui-apache commented on code in PR #6698:
URL: https://github.com/apache/iceberg/pull/6698#discussion_r1133688509


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java:
##########
@@ -31,11 +38,106 @@ public void testClientPoolCleaner() throws 
InterruptedException {
     String metastoreUri = 
hiveConf.get(HiveConf.ConfVars.METASTOREURIS.varname, "");
     CachedClientPool clientPool = new CachedClientPool(hiveConf, 
Collections.emptyMap());
     HiveClientPool clientPool1 = clientPool.clientPool();
-    
Assert.assertTrue(CachedClientPool.clientPoolCache().getIfPresent(metastoreUri) 
== clientPool1);
+    Supplier<Object> uri = () -> CachedClientPool.URIElement.of(metastoreUri);
+    Assert.assertTrue(
+        CachedClientPool.clientPoolCache()
+                
.getIfPresent(CachedClientPool.toKey(Collections.singletonList(uri)))
+            == clientPool1);
     TimeUnit.MILLISECONDS.sleep(EVICTION_INTERVAL - 
TimeUnit.SECONDS.toMillis(2));

Review Comment:
   Yeah I think that can be done separately.



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/CachedClientPool.java:
##########
@@ -87,4 +106,125 @@ public <R> R run(Action<R, IMetaStoreClient, TException> 
action, boolean retry)
       throws TException, InterruptedException {
     return clientPool().run(action, retry);
   }
+
+  @VisibleForTesting
+  static Key toKey(List<Supplier<Object>> suppliers) {
+    return 
Key.of(suppliers.stream().map(Supplier::get).collect(Collectors.toList()));
+  }
+
+  @VisibleForTesting
+  static List<Supplier<Object>> extractKeySuppliers(String cacheKeys, 
Configuration conf) {

Review Comment:
   I'm not sure how to represent UGI as a string while maintain the same 
equals/hashCode semantics. The `UserGroupInformation::toString` method won't do 
it because it just returns the user names (including both real and proxy user).



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

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