Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,23 @@ public SharedHiveMetastoreCache(
// Disable caching on workers, because there currently is no way to invalidate such a cache.
// Note: while we could skip CachingHiveMetastoreModule altogether on workers, we retain it so that catalog
// configuration can remain identical for all nodes, making cluster configuration easier.
boolean metadataCacheEnabled = config.getMetastoreCacheTtl().toMillis() > 0;
boolean statsCacheEnabled = config.getStatsCacheTtl().toMillis() > 0;
Duration metastoreCacheTtl = config.getMetastoreCacheTtl();
Duration statsCacheTtl = config.getStatsCacheTtl();
if (metastoreCacheTtl.compareTo(statsCacheTtl) > 0) {
statsCacheTtl = metastoreCacheTtl;
}

boolean metadataCacheEnabled = metastoreCacheTtl.toMillis() > 0;
boolean statsCacheEnabled = statsCacheTtl.toMillis() > 0;
enabled = (metadataCacheEnabled || statsCacheEnabled) &&
nodeManager.getCurrentNode().isCoordinator() &&
config.getMetastoreCacheMaximumSize() > 0;

cachingMetastoreBuilder = CachingHiveMetastore.builder()
.metadataCacheEnabled(metadataCacheEnabled)
.statsCacheEnabled(statsCacheEnabled)
.cacheTtl(config.getMetastoreCacheTtl())
.statsCacheTtl(config.getStatsCacheTtl())
.cacheTtl(metastoreCacheTtl)
.statsCacheTtl(statsCacheTtl)
.refreshInterval(config.getMetastoreRefreshInterval())
.maximumSize(config.getMetastoreCacheMaximumSize())
.partitionCacheEnabled(config.isPartitionCacheEnabled());
Expand Down