theoryxu commented on code in PR #4598:
URL: https://github.com/apache/gravitino/pull/4598#discussion_r1728436981
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/IcebergTableOpsManager.java:
##########
@@ -35,16 +43,41 @@ public class IcebergTableOpsManager implements
AutoCloseable {
private static final ImmutableMap<String, String>
ICEBERG_TABLE_OPS_PROVIDER_NAMES =
ImmutableMap.of(
ConfigBasedIcebergTableOpsProvider.CONFIG_BASE_ICEBERG_TABLE_OPS_PROVIDER_NAME,
- ConfigBasedIcebergTableOpsProvider.class.getCanonicalName());
+ ConfigBasedIcebergTableOpsProvider.class.getCanonicalName(),
+
GravitinoBasedIcebergTableOpsProvider.GRAVITINO_BASE_ICEBERG_TABLE_OPS_PROVIDER_NAME,
+ GravitinoBasedIcebergTableOpsProvider.class.getCanonicalName());
private final Cache<String, IcebergTableOps> icebergTableOpsCache;
private final IcebergTableOpsProvider provider;
public IcebergTableOpsManager(Map<String, String> properties) {
- this.icebergTableOpsCache = Caffeine.newBuilder().build();
this.provider = createProvider(properties);
this.provider.initialize(properties);
+ this.icebergTableOpsCache =
+ Caffeine.newBuilder()
+ .expireAfterWrite(
+ (new IcebergConfig(properties))
+
.get(IcebergConfig.ICEBERG_REST_CATALOG_CACHE_EVICTION_INTERVAL),
+ TimeUnit.MILLISECONDS)
+ .removalListener(
+ (k, v, c) -> {
+ LOG.info("Remove IcebergTableOps cache {}.", k);
+ try {
Review Comment:
I modified `GravitinoCatalogProvider` to maintain a `GravitinoAdminClient`
and ensure it closes when `IcebergTableOpsManager` closes.
--
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]