InvisibleProgrammer commented on code in PR #4291:
URL: https://github.com/apache/hive/pull/4291#discussion_r1235137523
##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/CachedClientPool.java:
##########
@@ -21,25 +21,61 @@
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.Scheduler;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
+import javax.annotation.Nullable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.security.UserGroupInformation;
import org.apache.iceberg.CatalogProperties;
import org.apache.iceberg.ClientPool;
+import org.apache.iceberg.exceptions.ValidationException;
import
org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.relocated.com.google.common.collect.Maps;
+import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.util.PropertyUtil;
+import org.apache.iceberg.util.ThreadPools;
import org.apache.thrift.TException;
+import org.immutables.value.Value;
+/**
+ * A ClientPool that caches the underlying HiveClientPool instances.
+ *
+ * <p>The following key elements are supported and can be specified via {@link
+ * CatalogProperties#CLIENT_POOL_CACHE_KEYS}:
+ *
+ * <ul>
+ * <li>ugi - the Hadoop UserGroupInformation instance that represents the
current user using the
+ * cache.
+ * <li>user_name - similar to UGI but only includes the user's name
determined by
+ * UserGroupInformation#getUserName.
+ * <li>conf - name of an arbitrary configuration. The value of the
configuration will be extracted
+ * from catalog properties and added to the cache key. A conf element
should start with a
+ * "conf:" prefix which is followed by the configuration name. E.g.
specifying "conf:a.b.c"
+ * will add "a.b.c" to the key, and so that configurations with
different default catalog
+ * wouldn't share the same client pool. Multiple conf elements can be
specified.
+ * </ul>
+ */
public class CachedClientPool implements ClientPool<IMetaStoreClient,
TException> {
- private static Cache<String, HiveClientPool> clientPoolCache;
+ private static final String CONF_ELEMENT_PREFIX = "conf:";
+
+ private static Cache<Key, HiveClientPool> clientPoolCache;
private final Configuration conf;
private final String metastoreUri;
Review Comment:
Are we talking about the `CONF_ELEMENT_PREFIX` or the `clientPoolCache`
fields. The element prefix is used in the `extractKey` method. And the cache is
used via the `run` methods.
--
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]