From dd2c44d76b84686379f96e87a1d06b2b34bb5463 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Mon, 24 Apr 2023 14:32:27 +0200 Subject: [PATCH 1/3] Emphasize difference between tested configurations Make it clear that `TestCachingHiveMetastore`'s `metastore` and `statsCacheMetastore` differ with `metadataCacheEnabled` and `statsCacheEnabled` -- make it apparent by the later's name and in their initialization. --- .../cache/TestCachingHiveMetastore.java | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java index 841648ab13b5..ccdca56c59b8 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java @@ -33,6 +33,7 @@ import io.trino.plugin.hive.metastore.Partition; import io.trino.plugin.hive.metastore.Table; import io.trino.plugin.hive.metastore.UnimplementedHiveMetastore; +import io.trino.plugin.hive.metastore.cache.CachingHiveMetastore.CachingHiveMetastoreBuilder; import io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore; import io.trino.plugin.hive.metastore.thrift.MockThriftMetastoreClient; import io.trino.plugin.hive.metastore.thrift.ThriftHiveMetastore; @@ -124,7 +125,7 @@ public class TestCachingHiveMetastore private MockThriftMetastoreClient mockClient; private ListeningExecutorService executor; private CachingHiveMetastore metastore; - private CachingHiveMetastore statsCacheMetastore; + private CachingHiveMetastore statsOnlyCacheMetastore; private ThriftMetastoreStats stats; @BeforeMethod @@ -133,7 +134,8 @@ public void setUp() mockClient = new MockThriftMetastoreClient(); ThriftMetastore thriftHiveMetastore = createThriftHiveMetastore(); executor = listeningDecorator(newCachedThreadPool(daemonThreadsNamed(getClass().getSimpleName() + "-%s"))); - metastore = CachingHiveMetastore.builder() + + CachingHiveMetastoreBuilder builder = CachingHiveMetastore.builder() .delegate(new BridgingHiveMetastore(thriftHiveMetastore)) .executor(executor) .metadataCacheEnabled(true) @@ -141,18 +143,14 @@ public void setUp() .cacheTtl(new Duration(5, TimeUnit.MINUTES)) .refreshInterval(new Duration(1, TimeUnit.MINUTES)) .maximumSize(1000) - .partitionCacheEnabled(true) - .build(); - statsCacheMetastore = CachingHiveMetastore.builder() - .delegate(new BridgingHiveMetastore(thriftHiveMetastore)) - .executor(executor) + .partitionCacheEnabled(true); + + metastore = builder.build(); + statsOnlyCacheMetastore = CachingHiveMetastore.builder(builder) .metadataCacheEnabled(false) .statsCacheEnabled(true) // only cache stats - .cacheTtl(new Duration(5, TimeUnit.MINUTES)) - .refreshInterval(new Duration(1, TimeUnit.MINUTES)) - .maximumSize(1000) - .partitionCacheEnabled(true) .build(); + stats = ((ThriftHiveMetastore) thriftHiveMetastore).getStats(); } @@ -552,20 +550,20 @@ public void testGetTableStatisticsWithoutMetadataCache() { assertEquals(mockClient.getAccessCount(), 0); - Table table = statsCacheMetastore.getTable(TEST_DATABASE, TEST_TABLE).orElseThrow(); + Table table = statsOnlyCacheMetastore.getTable(TEST_DATABASE, TEST_TABLE).orElseThrow(); assertEquals(mockClient.getAccessCount(), 1); - assertEquals(statsCacheMetastore.getTableStatistics(table), TEST_STATS); + assertEquals(statsOnlyCacheMetastore.getTableStatistics(table), TEST_STATS); assertEquals(mockClient.getAccessCount(), 2); - assertEquals(statsCacheMetastore.getTableStatistics(table), TEST_STATS); + assertEquals(statsOnlyCacheMetastore.getTableStatistics(table), TEST_STATS); assertEquals(mockClient.getAccessCount(), 2); - assertEquals(statsCacheMetastore.getTableStatisticsStats().getRequestCount(), 2); - assertEquals(statsCacheMetastore.getTableStatisticsStats().getHitRate(), 0.5); + assertEquals(statsOnlyCacheMetastore.getTableStatisticsStats().getRequestCount(), 2); + assertEquals(statsOnlyCacheMetastore.getTableStatisticsStats().getHitRate(), 0.5); - assertEquals(statsCacheMetastore.getTableStats().getRequestCount(), 0); - assertEquals(statsCacheMetastore.getTableStats().getHitRate(), 1.0); + assertEquals(statsOnlyCacheMetastore.getTableStats().getRequestCount(), 0); + assertEquals(statsOnlyCacheMetastore.getTableStats().getHitRate(), 1.0); } @Test @@ -720,26 +718,26 @@ public void testGetPartitionStatisticsWithoutMetadataCache() { assertEquals(mockClient.getAccessCount(), 0); - Table table = statsCacheMetastore.getTable(TEST_DATABASE, TEST_TABLE).orElseThrow(); + Table table = statsOnlyCacheMetastore.getTable(TEST_DATABASE, TEST_TABLE).orElseThrow(); assertEquals(mockClient.getAccessCount(), 1); - Partition partition = statsCacheMetastore.getPartition(table, TEST_PARTITION_VALUES1).orElseThrow(); + Partition partition = statsOnlyCacheMetastore.getPartition(table, TEST_PARTITION_VALUES1).orElseThrow(); assertEquals(mockClient.getAccessCount(), 2); - assertEquals(statsCacheMetastore.getPartitionStatistics(table, ImmutableList.of(partition)), ImmutableMap.of(TEST_PARTITION1, TEST_STATS)); + assertEquals(statsOnlyCacheMetastore.getPartitionStatistics(table, ImmutableList.of(partition)), ImmutableMap.of(TEST_PARTITION1, TEST_STATS)); assertEquals(mockClient.getAccessCount(), 3); - assertEquals(statsCacheMetastore.getPartitionStatistics(table, ImmutableList.of(partition)), ImmutableMap.of(TEST_PARTITION1, TEST_STATS)); + assertEquals(statsOnlyCacheMetastore.getPartitionStatistics(table, ImmutableList.of(partition)), ImmutableMap.of(TEST_PARTITION1, TEST_STATS)); assertEquals(mockClient.getAccessCount(), 3); - assertEquals(statsCacheMetastore.getPartitionStatisticsStats().getRequestCount(), 2); - assertEquals(statsCacheMetastore.getPartitionStatisticsStats().getHitRate(), 1.0 / 2); + assertEquals(statsOnlyCacheMetastore.getPartitionStatisticsStats().getRequestCount(), 2); + assertEquals(statsOnlyCacheMetastore.getPartitionStatisticsStats().getHitRate(), 1.0 / 2); - assertEquals(statsCacheMetastore.getTableStats().getRequestCount(), 0); - assertEquals(statsCacheMetastore.getTableStats().getHitRate(), 1.0); + assertEquals(statsOnlyCacheMetastore.getTableStats().getRequestCount(), 0); + assertEquals(statsOnlyCacheMetastore.getTableStats().getHitRate(), 1.0); - assertEquals(statsCacheMetastore.getPartitionStats().getRequestCount(), 0); - assertEquals(statsCacheMetastore.getPartitionStats().getHitRate(), 1.0); + assertEquals(statsOnlyCacheMetastore.getPartitionStats().getRequestCount(), 0); + assertEquals(statsOnlyCacheMetastore.getPartitionStats().getHitRate(), 1.0); } @Test From 5ebca9015c61bd92707374cc4a621009fd23dc85 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 21 Apr 2023 14:12:38 +0200 Subject: [PATCH 2/3] Allow disabling caching missing tables in CachingMetastore Table absence is harder to less interesting to cache and sometimes undesirable at all. This is similar to `metadata.cache-missing` config we have for JDBC connectors. --- .../metastore/cache/CachingHiveMetastore.java | 48 +++++++++++++++-- .../cache/CachingHiveMetastoreConfig.java | 13 +++++ .../cache/SharedHiveMetastoreCache.java | 1 + .../trino/plugin/hive/AbstractTestHive.java | 1 + .../cache/TestCachingHiveMetastore.java | 51 +++++++++++++++++-- .../cache/TestCachingHiveMetastoreConfig.java | 3 ++ .../thrift/MockThriftMetastoreClient.java | 8 ++- 7 files changed, 117 insertions(+), 8 deletions(-) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java index b8386fd46ed8..ca1a0c43e9c5 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java @@ -80,6 +80,7 @@ import java.util.function.Supplier; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Throwables.throwIfInstanceOf; import static com.google.common.base.Verify.verifyNotNull; import static com.google.common.cache.CacheLoader.asyncReloading; @@ -113,6 +114,7 @@ public enum StatsRecording } protected final HiveMetastore delegate; + private final boolean cacheMissing; private final LoadingCache> databaseCache; private final LoadingCache> databaseNamesCache; private final LoadingCache> tableCache; @@ -146,6 +148,7 @@ public static CachingHiveMetastoreBuilder builder(CachingHiveMetastoreBuilder ot other.refreshMills, other.maximumSize, other.statsRecording, + other.cacheMissing, other.partitionCacheEnabled); } @@ -157,6 +160,7 @@ public static CachingHiveMetastore memoizeMetastore(HiveMetastore delegate, long .statsCacheEnabled(true) .maximumSize(maximumSize) .statsRecording(StatsRecording.DISABLED) + .cacheMissing(true) .build(); } @@ -172,6 +176,7 @@ public static class CachingHiveMetastoreBuilder private OptionalLong refreshMills = OptionalLong.empty(); private Long maximumSize; private StatsRecording statsRecording = StatsRecording.ENABLED; + private Boolean cacheMissing; private boolean partitionCacheEnabled = true; public CachingHiveMetastoreBuilder() {} @@ -186,6 +191,7 @@ private CachingHiveMetastoreBuilder( OptionalLong refreshMills, Long maximumSize, StatsRecording statsRecording, + Boolean cacheMissing, boolean partitionCacheEnabled) { this.delegate = delegate; @@ -197,6 +203,7 @@ private CachingHiveMetastoreBuilder( this.refreshMills = refreshMills; this.maximumSize = maximumSize; this.statsRecording = statsRecording; + this.cacheMissing = cacheMissing; this.partitionCacheEnabled = partitionCacheEnabled; } @@ -272,6 +279,13 @@ public CachingHiveMetastoreBuilder statsRecording(StatsRecording statsRecording) return this; } + @CanIgnoreReturnValue + public CachingHiveMetastoreBuilder cacheMissing(boolean cacheMissing) + { + this.cacheMissing = cacheMissing; + return this; + } + @CanIgnoreReturnValue public CachingHiveMetastoreBuilder partitionCacheEnabled(boolean partitionCacheEnabled) { @@ -285,6 +299,7 @@ public CachingHiveMetastore build() requireNonNull(statsCacheEnabled, "statsCacheEnabled is null"); requireNonNull(delegate, "delegate not set"); requireNonNull(maximumSize, "maximumSize not set"); + requireNonNull(cacheMissing, "cacheMissing not set"); return new CachingHiveMetastore( delegate, metadataCacheEnabled, @@ -295,6 +310,7 @@ public CachingHiveMetastore build() executor, maximumSize, statsRecording, + cacheMissing, partitionCacheEnabled); } } @@ -309,10 +325,12 @@ protected CachingHiveMetastore( Optional executor, long maximumSize, StatsRecording statsRecording, + boolean cacheMissing, boolean partitionCacheEnabled) { checkArgument(metadataCacheEnabled || statsCacheEnabled, "Cache not enabled"); this.delegate = requireNonNull(delegate, "delegate is null"); + this.cacheMissing = cacheMissing; requireNonNull(executor, "executor is null"); CacheFactory cacheFactory; @@ -401,6 +419,28 @@ private AtomicReference refreshTableStatistics(HiveTableNam private static V get(LoadingCache cache, K key) { try { + V value = cache.getUnchecked(key); + checkState(!(value instanceof Optional), "This must not be used for caches with Optional values, as it doesn't implement cacheMissing logic. Use getOptional()"); + return value; + } + catch (UncheckedExecutionException e) { + throwIfInstanceOf(e.getCause(), TrinoException.class); + throw e; + } + } + + private Optional getOptional(LoadingCache> cache, K key) + { + try { + Optional value = cache.getIfPresent(key); + @SuppressWarnings("OptionalAssignedToNull") + boolean valueIsPresent = value != null; + if (valueIsPresent) { + if (value.isPresent() || cacheMissing) { + return value; + } + cache.invalidate(key); + } return cache.getUnchecked(key); } catch (UncheckedExecutionException e) { @@ -524,7 +564,7 @@ private static Map getAll( @Override public Optional getDatabase(String databaseName) { - return get(databaseCache, databaseName); + return getOptional(databaseCache, databaseName); } private Optional loadDatabase(String databaseName) @@ -552,7 +592,7 @@ private Table getExistingTable(String databaseName, String tableName) @Override public Optional getTable(String databaseName, String tableName) { - return get(tableCache, hiveTableName(databaseName, tableName)); + return getOptional(tableCache, hiveTableName(databaseName, tableName)); } @Override @@ -943,7 +983,7 @@ public Optional> getPartitionNamesByFilter( List columnNames, TupleDomain partitionKeysFilter) { - return get(partitionFilterCache, partitionFilter(databaseName, tableName, columnNames, partitionKeysFilter)); + return getOptional(partitionFilterCache, partitionFilter(databaseName, tableName, columnNames, partitionKeysFilter)); } private Optional> loadPartitionNamesByFilter(PartitionFilter partitionFilter) @@ -1168,7 +1208,7 @@ public Set listTablePrivileges(String databaseName, String ta @Override public Optional getConfigValue(String name) { - return get(configValuesCache, name); + return getOptional(configValuesCache, name); } private Optional loadConfigValue(String name) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastoreConfig.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastoreConfig.java index e5b53df08c38..95539c272663 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastoreConfig.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastoreConfig.java @@ -34,6 +34,7 @@ public class CachingHiveMetastoreConfig private Optional metastoreRefreshInterval = Optional.empty(); private long metastoreCacheMaximumSize = 10000; private int maxMetastoreRefreshThreads = 10; + private boolean cacheMissing = true; private boolean partitionCacheEnabled = true; @NotNull @@ -101,6 +102,18 @@ public CachingHiveMetastoreConfig setMaxMetastoreRefreshThreads(int maxMetastore return this; } + public boolean isCacheMissing() + { + return cacheMissing; + } + + @Config("hive.metastore-cache.cache-missing") + public CachingHiveMetastoreConfig setCacheMissing(boolean cacheMissing) + { + this.cacheMissing = cacheMissing; + return this; + } + public boolean isPartitionCacheEnabled() { return partitionCacheEnabled; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/SharedHiveMetastoreCache.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/SharedHiveMetastoreCache.java index c008af2d5aa7..44eb00661c9e 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/SharedHiveMetastoreCache.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/SharedHiveMetastoreCache.java @@ -97,6 +97,7 @@ public SharedHiveMetastoreCache( .statsCacheTtl(statsCacheTtl) .refreshInterval(config.getMetastoreRefreshInterval()) .maximumSize(config.getMetastoreCacheMaximumSize()) + .cacheMissing(config.isCacheMissing()) .partitionCacheEnabled(config.isPartitionCacheEnabled()); } diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java index b1389c02eb88..2d07785cab0e 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/AbstractTestHive.java @@ -807,6 +807,7 @@ protected final void setup(HostAndPort metastoreAddress, String databaseName) .cacheTtl(new Duration(1, MINUTES)) .refreshInterval(new Duration(15, SECONDS)) .maximumSize(10000) + .cacheMissing(new CachingHiveMetastoreConfig().isCacheMissing()) .partitionCacheEnabled(new CachingHiveMetastoreConfig().isPartitionCacheEnabled()) .build(); diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java index ccdca56c59b8..c7f965998d17 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/metastore/cache/TestCachingHiveMetastore.java @@ -124,6 +124,7 @@ public class TestCachingHiveMetastore private MockThriftMetastoreClient mockClient; private ListeningExecutorService executor; + private CachingHiveMetastoreBuilder metastoreBuilder; private CachingHiveMetastore metastore; private CachingHiveMetastore statsOnlyCacheMetastore; private ThriftMetastoreStats stats; @@ -135,7 +136,7 @@ public void setUp() ThriftMetastore thriftHiveMetastore = createThriftHiveMetastore(); executor = listeningDecorator(newCachedThreadPool(daemonThreadsNamed(getClass().getSimpleName() + "-%s"))); - CachingHiveMetastoreBuilder builder = CachingHiveMetastore.builder() + metastoreBuilder = CachingHiveMetastore.builder() .delegate(new BridgingHiveMetastore(thriftHiveMetastore)) .executor(executor) .metadataCacheEnabled(true) @@ -143,10 +144,11 @@ public void setUp() .cacheTtl(new Duration(5, TimeUnit.MINUTES)) .refreshInterval(new Duration(1, TimeUnit.MINUTES)) .maximumSize(1000) + .cacheMissing(new CachingHiveMetastoreConfig().isCacheMissing()) .partitionCacheEnabled(true); - metastore = builder.build(); - statsOnlyCacheMetastore = CachingHiveMetastore.builder(builder) + metastore = metastoreBuilder.build(); + statsOnlyCacheMetastore = CachingHiveMetastore.builder(metastoreBuilder) .metadataCacheEnabled(false) .statsCacheEnabled(true) // only cache stats .build(); @@ -810,6 +812,7 @@ private CachingHiveMetastore createMetastore(MockThriftMetastoreClient mockClien .cacheTtl(new Duration(5, TimeUnit.MINUTES)) .refreshInterval(new Duration(1, TimeUnit.MINUTES)) .maximumSize(1000) + .cacheMissing(new CachingHiveMetastoreConfig().isCacheMissing()) .partitionCacheEnabled(true) .build(); } @@ -859,6 +862,45 @@ public void testNoCacheExceptions() assertEquals(mockClient.getAccessCount(), 2); } + @Test + public void testNoCacheMissing() + { + CachingHiveMetastore metastore = CachingHiveMetastore.builder(metastoreBuilder) + .cacheMissing(false) + .build(); + + mockClient.setReturnTable(false); + assertEquals(mockClient.getAccessCount(), 0); + + // First access + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isEmpty(); + assertEquals(mockClient.getAccessCount(), 1); + + // Second access, second load + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isEmpty(); + assertEquals(mockClient.getAccessCount(), 2); + + // Table get be accessed once it exists + mockClient.setReturnTable(true); + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isPresent(); + assertEquals(mockClient.getAccessCount(), 3); + + // Table existence is cached + mockClient.setReturnTable(true); + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isPresent(); + assertEquals(mockClient.getAccessCount(), 3); + + // Table is returned even if no longer exists + mockClient.setReturnTable(false); + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isPresent(); + assertEquals(mockClient.getAccessCount(), 3); + + // After cache invalidation, table absence is apparent + metastore.invalidateTable(TEST_DATABASE, TEST_TABLE); + assertThat(metastore.getTable(TEST_DATABASE, TEST_TABLE)).isEmpty(); + assertEquals(mockClient.getAccessCount(), 4); + } + @Test public void testCachingHiveMetastoreCreationWithTtlOnly() { @@ -973,6 +1015,7 @@ public Map> getPartitionsByNames(Table table, List>> databaseTablePartitionColumnStatistics = new HashMap<>(); private boolean throwException; + private boolean returnTable = true; public MockThriftMetastoreClient() { @@ -145,6 +146,11 @@ public void setThrowException(boolean throwException) this.throwException = throwException; } + public void setReturnTable(boolean returnTable) + { + this.returnTable = returnTable; + } + public int getAccessCount() { return accessCount.get(); @@ -207,7 +213,7 @@ public Table getTable(String dbName, String tableName) if (throwException) { throw new RuntimeException(); } - if (!dbName.equals(TEST_DATABASE) || !tableName.equals(TEST_TABLE)) { + if (!returnTable || !dbName.equals(TEST_DATABASE) || !tableName.equals(TEST_TABLE)) { throw new NoSuchObjectException(); } return new Table( From 60776c02903aa90cd79800e4f33beccaa5009317 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 21 Apr 2023 18:03:51 +0200 Subject: [PATCH 3/3] Remove default configuration in Caching metastore builder Enforce the caller provides configuration, so that `CachingHiveMetastoreConfig` is the only source of default configuration. --- .../plugin/hive/metastore/cache/CachingHiveMetastore.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java index ca1a0c43e9c5..f9d545b7e250 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/cache/CachingHiveMetastore.java @@ -161,6 +161,7 @@ public static CachingHiveMetastore memoizeMetastore(HiveMetastore delegate, long .maximumSize(maximumSize) .statsRecording(StatsRecording.DISABLED) .cacheMissing(true) + .partitionCacheEnabled(true) .build(); } @@ -177,7 +178,7 @@ public static class CachingHiveMetastoreBuilder private Long maximumSize; private StatsRecording statsRecording = StatsRecording.ENABLED; private Boolean cacheMissing; - private boolean partitionCacheEnabled = true; + private Boolean partitionCacheEnabled; public CachingHiveMetastoreBuilder() {} @@ -192,7 +193,7 @@ private CachingHiveMetastoreBuilder( Long maximumSize, StatsRecording statsRecording, Boolean cacheMissing, - boolean partitionCacheEnabled) + Boolean partitionCacheEnabled) { this.delegate = delegate; this.executor = executor; @@ -300,6 +301,7 @@ public CachingHiveMetastore build() requireNonNull(delegate, "delegate not set"); requireNonNull(maximumSize, "maximumSize not set"); requireNonNull(cacheMissing, "cacheMissing not set"); + requireNonNull(partitionCacheEnabled, "partitionCacheEnabled not set"); return new CachingHiveMetastore( delegate, metadataCacheEnabled,