From 4e237d60fc8366eb57dd024b3bb06dcfb1f28518 Mon Sep 17 00:00:00 2001 From: Peter Alfonsi Date: Fri, 7 Mar 2025 15:59:38 -0800 Subject: [PATCH] [Tiered Caching] Remove PLUGGABLE_CACHE feature flag (#17344) * Remove PLUGGABLE_CACHE feature flag Signed-off-by: Peter Alfonsi * changelog Signed-off-by: Peter Alfonsi * move changelog entry Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * fix IT init failure Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi * rerun gradle Signed-off-by: Peter Alfonsi --------- Signed-off-by: Peter Alfonsi Signed-off-by: Peter Alfonsi Co-authored-by: Peter Alfonsi --- CHANGELOG.md | 1 + distribution/src/config/opensearch.yml | 4 -- .../tier/TieredSpilloverCacheBaseIT.java | 2 - .../tier/TieredSpilloverCachePlugin.java | 5 +- .../tier/TieredSpilloverCachePluginTests.java | 7 +- .../tier/TieredSpilloverCacheTests.java | 13 ---- .../opensearch/cache/EhcacheDiskCacheIT.java | 6 -- .../store/disk/EhCacheDiskCacheTests.java | 2 - .../CacheStatsAPIIndicesRequestCacheIT.java | 17 +---- .../indices/IndicesRequestCacheIT.java | 5 +- .../common/cache/service/CacheService.java | 14 ++-- .../cache/store/OpenSearchOnHeapCache.java | 12 +--- .../common/settings/ClusterSettings.java | 21 +++--- .../common/settings/FeatureFlagSettings.java | 1 - .../opensearch/common/util/FeatureFlags.java | 9 --- .../indices/IndicesRequestCache.java | 6 +- .../cache/service/CacheServiceTests.java | 35 ++-------- .../store/OpenSearchOnHeapCacheTests.java | 54 +++++++-------- .../indices/IndicesRequestCacheTests.java | 67 ++----------------- 19 files changed, 61 insertions(+), 220 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f10ae94a988..a83bc843a9bb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Deprecated ### Removed +- Remove FeatureFlags.PLUGGABLE_CACHE as the feature is no longer experimental ([#17344](https://github.com/opensearch-project/OpenSearch/pull/17344)) ### Fixed - Fix case insensitive and escaped query on wildcard ([#16827](https://github.com/opensearch-project/OpenSearch/pull/16827)) diff --git a/distribution/src/config/opensearch.yml b/distribution/src/config/opensearch.yml index ce8d9079049e5..ea03b3ecd019f 100644 --- a/distribution/src/config/opensearch.yml +++ b/distribution/src/config/opensearch.yml @@ -122,10 +122,6 @@ ${path.logs} # #opensearch.experimental.optimization.datetime_formatter_caching.enabled: false # -# Gates the functionality of enabling Opensearch to use pluggable caches with respective store names via setting. -# -#opensearch.experimental.feature.pluggable.caching.enabled: false -# # Gates the functionality of star tree index, which improves the performance of search aggregations. # #opensearch.experimental.feature.composite_index.star_tree.enabled: false diff --git a/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java b/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java index 01371ca8eeefb..75895b1fc4c11 100644 --- a/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java +++ b/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java @@ -12,14 +12,12 @@ import org.opensearch.common.cache.settings.CacheSettings; import org.opensearch.common.cache.store.OpenSearchOnHeapCache; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.test.OpenSearchIntegTestCase; public class TieredSpilloverCacheBaseIT extends OpenSearchIntegTestCase { public Settings defaultSettings(String onHeapCacheSizeInBytesOrPercentage, int numberOfSegments) { return Settings.builder() - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME diff --git a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCachePlugin.java b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCachePlugin.java index d1d033fae8cd2..3c4079fefd612 100644 --- a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCachePlugin.java +++ b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCachePlugin.java @@ -12,7 +12,6 @@ import org.opensearch.common.cache.ICache; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.plugins.CachePlugin; import org.opensearch.plugins.Plugin; @@ -64,9 +63,7 @@ public List> getSettings() { ); settingList.add(TOOK_TIME_POLICY_CONCRETE_SETTINGS_MAP.get(cacheType)); settingList.add(TOOK_TIME_DISK_TIER_POLICY_CONCRETE_SETTINGS_MAP.get(cacheType)); - if (FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings)) { - settingList.add(DISK_CACHE_ENABLED_SETTING_MAP.get(cacheType)); - } + settingList.add(DISK_CACHE_ENABLED_SETTING_MAP.get(cacheType)); settingList.add( TieredSpilloverCacheSettings.TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(cacheType.getSettingPrefix()) ); diff --git a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCachePluginTests.java b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCachePluginTests.java index 4a96ffe2069ec..54aba3504f42f 100644 --- a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCachePluginTests.java +++ b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCachePluginTests.java @@ -10,7 +10,6 @@ import org.opensearch.common.cache.ICache; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.test.OpenSearchTestCase; import java.util.Map; @@ -24,10 +23,8 @@ public void testGetCacheFactoryMap() { assertEquals(TieredSpilloverCachePlugin.TIERED_CACHE_SPILLOVER_PLUGIN_NAME, tieredSpilloverCachePlugin.getName()); } - public void testGetSettingsWithFeatureFlagOn() { - TieredSpilloverCachePlugin tieredSpilloverCachePlugin = new TieredSpilloverCachePlugin( - Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE_SETTING.getKey(), true).build() - ); + public void testGetSettings() { + TieredSpilloverCachePlugin tieredSpilloverCachePlugin = new TieredSpilloverCachePlugin(Settings.builder().build()); assertFalse(tieredSpilloverCachePlugin.getSettings().isEmpty()); } } diff --git a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java index f632724d89aae..c8cd2014e519b 100644 --- a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java +++ b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java @@ -30,7 +30,6 @@ import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.env.NodeEnvironment; import org.opensearch.test.OpenSearchTestCase; import org.junit.Before; @@ -183,7 +182,6 @@ public void testComputeIfAbsentWithFactoryBasedCacheCreation() throws Exception TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) .put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 1) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .build(); String storagePath = getStoragePath(settings); ICache tieredSpilloverICache = new TieredSpilloverCache.TieredSpilloverCacheFactory().create( @@ -283,7 +281,6 @@ public void testComputeIfAbsentWithSegmentedCache() throws Exception { CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .build(); String storagePath = getStoragePath(settings); ICache tieredSpilloverICache = new TieredSpilloverCache.TieredSpilloverCacheFactory().create( @@ -406,7 +403,6 @@ public void testWithFactoryCreationWithOnHeapCacheNotPresent() { CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .build(); IllegalArgumentException ex = assertThrows( @@ -491,7 +487,6 @@ public void testComputeIfAbsentWithEvictionsFromOnHeapCache() throws Exception { CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put( TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_SIZE.getConcreteSettingForNamespace( CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() @@ -1276,7 +1271,6 @@ public void testConcurrencyForEvictionFlowFromOnHeapToDiskTier() throws Exceptio CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put( TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_SIZE.getConcreteSettingForNamespace( CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() @@ -2160,7 +2154,6 @@ public void testWithInvalidSegmentNumber() throws Exception { TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) .put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 1) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 3) .build(); String storagePath = getStoragePath(settings); @@ -2226,7 +2219,6 @@ public void testWithVeryLowDiskCacheSize() throws Exception { ).getKey(), 1L ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 2) .build(); String storagePath = getStoragePath(settings); @@ -2285,7 +2277,6 @@ public void testTieredCacheDefaultSegmentCount() { CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .build(); String storagePath = getStoragePath(settings); @@ -2365,7 +2356,6 @@ public void testSegmentSizesWhenUsingFactory() { ).getKey(), heapSizeFromImplSetting + "b" ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put( TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), numSegments @@ -2412,7 +2402,6 @@ public void testSegmentSizesWhenNotUsingFactory() { CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") // The size setting from the OpenSearchOnHeapCache implementation should not be honored .put( OpenSearchOnHeapCacheSettings.MAXIMUM_SIZE_IN_BYTES.getConcreteSettingForNamespace( @@ -2697,7 +2686,6 @@ private TieredSpilloverCache initializeTieredSpilloverCache( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put(settings) .build() ) @@ -2750,7 +2738,6 @@ private CacheConfig getCacheConfig( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME ) - .put(FeatureFlags.PLUGGABLE_CACHE, "true") .put(settings) .build() ) diff --git a/plugins/cache-ehcache/src/internalClusterTest/java/org/opensearch/cache/EhcacheDiskCacheIT.java b/plugins/cache-ehcache/src/internalClusterTest/java/org/opensearch/cache/EhcacheDiskCacheIT.java index 909a493c0734f..1de0528bde845 100644 --- a/plugins/cache-ehcache/src/internalClusterTest/java/org/opensearch/cache/EhcacheDiskCacheIT.java +++ b/plugins/cache-ehcache/src/internalClusterTest/java/org/opensearch/cache/EhcacheDiskCacheIT.java @@ -27,7 +27,6 @@ import org.opensearch.common.cache.settings.CacheSettings; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.env.NodeEnvironment; import org.opensearch.index.cache.request.RequestCacheStats; import org.opensearch.index.query.QueryBuilders; @@ -71,11 +70,6 @@ protected Collection> nodePlugins() { return Arrays.asList(EhcacheCachePlugin.class); } - @Override - protected Settings featureFlagSettings() { - return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build(); - } - private Settings defaultSettings(long sizeInBytes, TimeValue expirationTime) { if (expirationTime == null) { expirationTime = TimeValue.MAX_VALUE; diff --git a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java index 4e879af052c15..2f58bb5df0ebe 100644 --- a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java +++ b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java @@ -26,7 +26,6 @@ import org.opensearch.common.metrics.CounterMetric; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.common.util.io.IOUtils; import org.opensearch.core.common.bytes.BytesArray; import org.opensearch.core.common.bytes.BytesReference; @@ -1221,7 +1220,6 @@ private EhcacheDiskCache setupMaxSizeTest(long maxSizeFromSettin MockRemovalListener listener = new MockRemovalListener<>(); try (NodeEnvironment env = newNodeEnvironment(Settings.builder().build())) { Settings settings = Settings.builder() - .put(FeatureFlags.PLUGGABLE_CACHE, true) .put( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), EhcacheDiskCache.EhcacheDiskCacheFactory.EHCACHE_DISK_CACHE_NAME diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/CacheStatsAPIIndicesRequestCacheIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/CacheStatsAPIIndicesRequestCacheIT.java index 28bac3c7441b6..3c33dc3adfff0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/CacheStatsAPIIndicesRequestCacheIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/CacheStatsAPIIndicesRequestCacheIT.java @@ -8,8 +8,6 @@ package org.opensearch.indices; -import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; - import org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest; import org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest; @@ -25,7 +23,6 @@ import org.opensearch.common.cache.stats.ImmutableCacheStatsHolder; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.core.xcontent.MediaTypeRegistry; @@ -35,12 +32,9 @@ import org.opensearch.index.cache.request.RequestCacheStats; import org.opensearch.index.query.QueryBuilders; import org.opensearch.test.OpenSearchIntegTestCase; -import org.opensearch.test.ParameterizedStaticSettingsOpenSearchIntegTestCase; import org.opensearch.test.hamcrest.OpenSearchAssertions; import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,16 +44,7 @@ // Use a single data node to simplify logic about cache stats across different shards. @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 1) -public class CacheStatsAPIIndicesRequestCacheIT extends ParameterizedStaticSettingsOpenSearchIntegTestCase { - public CacheStatsAPIIndicesRequestCacheIT(Settings settings) { - super(settings); - } - - @ParametersFactory - public static Collection parameters() { - return Arrays.asList(new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "true").build() }); - } - +public class CacheStatsAPIIndicesRequestCacheIT extends OpenSearchIntegTestCase { /** * Test aggregating by indices, indices+shards, shards, or no levels, and check the resulting stats * are as we expect. diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java index a16d2065598ba..0468be7d93516 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java @@ -57,7 +57,6 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.time.DateFormatter; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.core.index.Index; import org.opensearch.core.index.shard.ShardId; import org.opensearch.env.NodeEnvironment; @@ -110,9 +109,7 @@ public IndicesRequestCacheIT(Settings settings) { public static Collection parameters() { return Arrays.asList( new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }, - new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "true").build() }, - new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "false").build() } + new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } ); } diff --git a/server/src/main/java/org/opensearch/common/cache/service/CacheService.java b/server/src/main/java/org/opensearch/common/cache/service/CacheService.java index da006264094d2..8fc0fc7d07cac 100644 --- a/server/src/main/java/org/opensearch/common/cache/service/CacheService.java +++ b/server/src/main/java/org/opensearch/common/cache/service/CacheService.java @@ -18,7 +18,6 @@ import org.opensearch.common.cache.store.config.CacheConfig; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import java.util.HashMap; import java.util.Map; @@ -47,10 +46,9 @@ public CacheService(Map cacheStoreTypeFactories, Setting public ICache createCache(CacheConfig config, CacheType cacheType) { String storeName = getStoreNameFromSetting(cacheType, settings); - if (!pluggableCachingEnabled(cacheType, settings)) { - // Condition 1: In case feature flag is off, we default to onHeap. - // Condition 2: In case storeName is not explicitly mentioned, we assume user is looking to use older - // settings, so we again fallback to onHeap to maintain backward compatibility. + if (!storeNamePresent(cacheType, settings)) { + // In case storeName is not explicitly mentioned, we assume user is looking to use older + // settings, so we fallback to onHeap to maintain backward compatibility. // It is guaranteed that we will have this store name registered, so // should be safe. storeName = OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME; @@ -73,11 +71,11 @@ public NodeCacheStats stats(CommonStatsFlags flags) { } /** - * Check if pluggable caching is on, and if a store type is present for this cache type. + * Check if a store type is present for this cache type. */ - public static boolean pluggableCachingEnabled(CacheType cacheType, Settings settings) { + public static boolean storeNamePresent(CacheType cacheType, Settings settings) { String storeName = getStoreNameFromSetting(cacheType, settings); - return FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings) && storeName != null && !storeName.isBlank(); + return storeName != null && !storeName.isBlank(); } private static String getStoreNameFromSetting(CacheType cacheType, Settings settings) { diff --git a/server/src/main/java/org/opensearch/common/cache/store/OpenSearchOnHeapCache.java b/server/src/main/java/org/opensearch/common/cache/store/OpenSearchOnHeapCache.java index e1039c5d9ee55..f3a496f07b3e8 100644 --- a/server/src/main/java/org/opensearch/common/cache/store/OpenSearchOnHeapCache.java +++ b/server/src/main/java/org/opensearch/common/cache/store/OpenSearchOnHeapCache.java @@ -29,7 +29,6 @@ import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.core.common.unit.ByteSizeValue; import java.util.List; @@ -182,7 +181,7 @@ public static class OpenSearchOnHeapCacheFactory implements Factory { public ICache create(CacheConfig config, CacheType cacheType, Map cacheFactories) { Map> settingList = OpenSearchOnHeapCacheSettings.getSettingListForCacheType(cacheType); Settings settings = config.getSettings(); - boolean statsTrackingEnabled = statsTrackingEnabled(config.getSettings(), config.getStatsTrackingEnabled()); + boolean statsTrackingEnabled = config.getStatsTrackingEnabled(); ICacheBuilder builder = new Builder().setDimensionNames(config.getDimensionNames()) .setStatsTrackingEnabled(statsTrackingEnabled) .setExpireAfterAccess(((TimeValue) settingList.get(EXPIRE_AFTER_ACCESS_KEY).get(settings))) @@ -197,7 +196,7 @@ public ICache create(CacheConfig config, CacheType cacheType, /* Use the cache config value if present. This can be passed down from the TieredSpilloverCache when creating individual segments, - but is not passed in from the IRC if pluggable caching is on. + but is not passed in from the IRC if a store name setting is present. */ builder.setMaximumWeightInBytes(config.getMaxSizeInBytes()); } else { @@ -209,7 +208,7 @@ public ICache create(CacheConfig config, CacheType cacheType, builder.setNumberOfSegments(-1); // By default it will use 256 segments. } - if (!CacheService.pluggableCachingEnabled(cacheType, settings)) { + if (!CacheService.storeNamePresent(cacheType, settings)) { // For backward compatibility as the user intent is to use older settings. builder.setMaximumWeightInBytes(config.getMaxSizeInBytes()); builder.setExpireAfterAccess(config.getExpireAfterAccess()); @@ -223,11 +222,6 @@ public ICache create(CacheConfig config, CacheType cacheType, public String getCacheName() { return NAME; } - - private boolean statsTrackingEnabled(Settings settings, boolean statsTrackingEnabledConfig) { - // Don't track stats when pluggable caching is off, or when explicitly set to false in the CacheConfig - return FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings) && statsTrackingEnabledConfig; - } } /** diff --git a/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java b/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java index 92dfd96531877..b16b331118834 100644 --- a/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java +++ b/server/src/main/java/org/opensearch/common/settings/ClusterSettings.java @@ -816,7 +816,16 @@ public void apply(Settings value, Settings current, Settings previous) { ResponseLimitSettings.CAT_SEGMENTS_RESPONSE_LIMIT_SETTING, // Thread pool Settings - ThreadPool.CLUSTER_THREAD_POOL_SIZE_SETTING + ThreadPool.CLUSTER_THREAD_POOL_SIZE_SETTING, + + // Tiered caching settings + CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE), + OpenSearchOnHeapCacheSettings.MAXIMUM_SIZE_IN_BYTES.getConcreteSettingForNamespace( + CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() + ), + OpenSearchOnHeapCacheSettings.EXPIRE_AFTER_ACCESS_SETTING.getConcreteSettingForNamespace( + CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() + ) ) ) ); @@ -837,16 +846,6 @@ public void apply(Settings value, Settings current, Settings previous) { TelemetrySettings.TRACER_FEATURE_ENABLED_SETTING, TelemetrySettings.METRICS_FEATURE_ENABLED_SETTING ), - List.of(FeatureFlags.PLUGGABLE_CACHE), - List.of( - CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE), - OpenSearchOnHeapCacheSettings.MAXIMUM_SIZE_IN_BYTES.getConcreteSettingForNamespace( - CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() - ), - OpenSearchOnHeapCacheSettings.EXPIRE_AFTER_ACCESS_SETTING.getConcreteSettingForNamespace( - CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() - ) - ), List.of(FeatureFlags.READER_WRITER_SPLIT_EXPERIMENTAL), List.of(SearchReplicaAllocationDecider.SEARCH_REPLICA_ROUTING_INCLUDE_GROUP_SETTING) ); diff --git a/server/src/main/java/org/opensearch/common/settings/FeatureFlagSettings.java b/server/src/main/java/org/opensearch/common/settings/FeatureFlagSettings.java index 077c55595d405..8a2d834fa6b2e 100644 --- a/server/src/main/java/org/opensearch/common/settings/FeatureFlagSettings.java +++ b/server/src/main/java/org/opensearch/common/settings/FeatureFlagSettings.java @@ -35,7 +35,6 @@ protected FeatureFlagSettings( FeatureFlags.DATETIME_FORMATTER_CACHING_SETTING, FeatureFlags.TIERED_REMOTE_INDEX_SETTING, FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING, - FeatureFlags.PLUGGABLE_CACHE_SETTING, FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING, FeatureFlags.STAR_TREE_INDEX_SETTING, FeatureFlags.READER_WRITER_SPLIT_EXPERIMENTAL_SETTING, diff --git a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java index 300cd1727fa60..8a7f2708991ff 100644 --- a/server/src/main/java/org/opensearch/common/util/FeatureFlags.java +++ b/server/src/main/java/org/opensearch/common/util/FeatureFlags.java @@ -56,12 +56,6 @@ public class FeatureFlags { */ public static final String TIERED_REMOTE_INDEX = "opensearch.experimental.feature.tiered_remote_index.enabled"; - /** - * Gates the functionality of pluggable cache. - * Enables OpenSearch to use pluggable caches with respective store names via setting. - */ - public static final String PLUGGABLE_CACHE = "opensearch.experimental.feature.pluggable.caching.enabled"; - public static final String READER_WRITER_SPLIT_EXPERIMENTAL = "opensearch.experimental.feature.read.write.split.enabled"; /** @@ -87,8 +81,6 @@ public class FeatureFlags { public static final Setting TIERED_REMOTE_INDEX_SETTING = Setting.boolSetting(TIERED_REMOTE_INDEX, false, Property.NodeScope); - public static final Setting PLUGGABLE_CACHE_SETTING = Setting.boolSetting(PLUGGABLE_CACHE, false, Property.NodeScope); - public static final Setting READER_WRITER_SPLIT_EXPERIMENTAL_SETTING = Setting.boolSetting( READER_WRITER_SPLIT_EXPERIMENTAL, false, @@ -134,7 +126,6 @@ public class FeatureFlags { TELEMETRY_SETTING, DATETIME_FORMATTER_CACHING_SETTING, TIERED_REMOTE_INDEX_SETTING, - PLUGGABLE_CACHE_SETTING, APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING, STAR_TREE_INDEX_SETTING, READER_WRITER_SPLIT_EXPERIMENTAL_SETTING, diff --git a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java index bd56c34d69e78..ad94b1f9c892f 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java +++ b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java @@ -233,9 +233,9 @@ CacheConfig getCacheConfig(Settings settings, NodeEnvironme .setClusterSettings(clusterService.getClusterSettings()) .setStoragePath(nodeEnvironment.nodePaths()[0].path.toString() + "/request_cache"); - if (!CacheService.pluggableCachingEnabled(CacheType.INDICES_REQUEST_CACHE, settings)) { - // If pluggable caching is not enabled, use the max size based on the IRC setting into the config. - // If pluggable caching is enabled, cache implementations instead determine their own sizes based on their own implementation + if (!CacheService.storeNamePresent(CacheType.INDICES_REQUEST_CACHE, settings)) { + // If a store name is absent, use the max size based on the IRC setting into the config. + // If a store name is present, cache implementations instead determine their own sizes based on their own implementation // size settings. configBuilder.setMaxSizeInBytes(sizeInBytes); } diff --git a/server/src/test/java/org/opensearch/common/cache/service/CacheServiceTests.java b/server/src/test/java/org/opensearch/common/cache/service/CacheServiceTests.java index b355161f6f310..6abc062d258ea 100644 --- a/server/src/test/java/org/opensearch/common/cache/service/CacheServiceTests.java +++ b/server/src/test/java/org/opensearch/common/cache/service/CacheServiceTests.java @@ -17,7 +17,6 @@ import org.opensearch.common.cache.store.config.CacheConfig; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.plugins.CachePlugin; import org.opensearch.test.OpenSearchTestCase; @@ -30,7 +29,6 @@ import static org.mockito.Mockito.when; public class CacheServiceTests extends OpenSearchTestCase { - public void testWithCreateCacheForIndicesRequestCacheType() { CachePlugin mockPlugin1 = mock(CachePlugin.class); ICache.Factory factory1 = mock(ICache.Factory.class); @@ -50,38 +48,15 @@ public void testWithCreateCacheForIndicesRequestCacheType() { ); CacheConfig config = mock(CacheConfig.class); ICache mockOnHeapCache = mock(OpenSearchOnHeapCache.class); - when(onHeapCacheFactory.create(eq(config), eq(CacheType.INDICES_REQUEST_CACHE), any(Map.class))).thenReturn(mockOnHeapCache); - - ICache ircCache = cacheService.createCache(config, CacheType.INDICES_REQUEST_CACHE); - assertEquals(mockOnHeapCache, ircCache); - } - - public void testWithCreateCacheForIndicesRequestCacheTypeWithFeatureFlagTrue() { - CachePlugin mockPlugin1 = mock(CachePlugin.class); - ICache.Factory factory1 = mock(ICache.Factory.class); - ICache.Factory onHeapCacheFactory = mock(OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.class); - Map factoryMap = Map.of( - "cache1", - factory1, - OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME, - onHeapCacheFactory - ); - when(mockPlugin1.getCacheFactoryMap()).thenReturn(factoryMap); - - Setting indicesRequestCacheSetting = CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE); - CacheService cacheService = new CacheService( - factoryMap, - Settings.builder().put(indicesRequestCacheSetting.getKey(), "cache1").put(FeatureFlags.PLUGGABLE_CACHE, "true").build() - ); - CacheConfig config = mock(CacheConfig.class); - ICache mockOnHeapCache = mock(OpenSearchOnHeapCache.class); when(factory1.create(eq(config), eq(CacheType.INDICES_REQUEST_CACHE), any(Map.class))).thenReturn(mockOnHeapCache); + ICache otherMockOnHeapCache = mock(OpenSearchOnHeapCache.class); + when(onHeapCacheFactory.create(eq(config), eq(CacheType.INDICES_REQUEST_CACHE), any(Map.class))).thenReturn(otherMockOnHeapCache); ICache ircCache = cacheService.createCache(config, CacheType.INDICES_REQUEST_CACHE); assertEquals(mockOnHeapCache, ircCache); } - public void testWithCreateCacheForIndicesRequestCacheTypeWithFeatureFlagTrueAndStoreNameIsNull() { + public void testWithCreateCacheForIndicesRequestCacheTypeWithStoreNameNull() { CachePlugin mockPlugin1 = mock(CachePlugin.class); ICache.Factory factory1 = mock(ICache.Factory.class); ICache.Factory onHeapCacheFactory = mock(OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.class); @@ -93,7 +68,7 @@ public void testWithCreateCacheForIndicesRequestCacheTypeWithFeatureFlagTrueAndS ); when(mockPlugin1.getCacheFactoryMap()).thenReturn(factoryMap); - CacheService cacheService = new CacheService(factoryMap, Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "true").build()); + CacheService cacheService = new CacheService(factoryMap, Settings.builder().build()); CacheConfig config = mock(CacheConfig.class); ICache mockOnHeapCache = mock(OpenSearchOnHeapCache.class); when(onHeapCacheFactory.create(eq(config), eq(CacheType.INDICES_REQUEST_CACHE), any(Map.class))).thenReturn(mockOnHeapCache); @@ -149,6 +124,6 @@ public void testWithCreateCacheWithInvalidStoreNameAssociatedForCacheType() { IllegalArgumentException.class, () -> cacheService.createCache(config, CacheType.INDICES_REQUEST_CACHE) ); - assertEquals("No store name: [opensearch_onheap] is registered for cache type: INDICES_REQUEST_CACHE", ex.getMessage()); + assertEquals("No store name: [cache] is registered for cache type: INDICES_REQUEST_CACHE", ex.getMessage()); } } diff --git a/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java b/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java index 5a989ad8ab777..e4f74d619a6a3 100644 --- a/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java +++ b/server/src/test/java/org/opensearch/common/cache/store/OpenSearchOnHeapCacheTests.java @@ -22,7 +22,6 @@ import org.opensearch.common.cache.store.settings.OpenSearchOnHeapCacheSettings; import org.opensearch.common.metrics.CounterMetric; import org.opensearch.common.settings.Settings; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.test.OpenSearchTestCase; import java.util.ArrayList; @@ -40,7 +39,7 @@ public void testStats() throws Exception { MockRemovalListener listener = new MockRemovalListener<>(); int maxKeys = between(10, 50); int numEvicted = between(10, 20); - OpenSearchOnHeapCache cache = getCache(maxKeys, listener, true, true); + OpenSearchOnHeapCache cache = getCache(maxKeys, listener, true); // When the pluggable caches setting is on, we should get stats as expected from cache.stats(). @@ -82,49 +81,44 @@ public void testStats() throws Exception { } } - public void testStatsWithoutPluggableCaches() throws Exception { - // When the pluggable caches setting is off, or when we manually set statsTrackingEnabled = false in the config, + public void testWithoutStatsTracking() throws Exception { + // When we manually set statsTrackingEnabled = false in the config, // we should get all-zero stats from cache.stats(), but count() should still work. MockRemovalListener listener = new MockRemovalListener<>(); int maxKeys = between(10, 50); int numEvicted = between(10, 20); - OpenSearchOnHeapCache pluggableCachesOffCache = getCache(maxKeys, listener, false, true); - OpenSearchOnHeapCache manuallySetNoopStatsCache = getCache(maxKeys, listener, true, false); - List> caches = List.of(pluggableCachesOffCache, manuallySetNoopStatsCache); - - for (OpenSearchOnHeapCache cache : caches) { - int numAdded = maxKeys + numEvicted; - for (int i = 0; i < numAdded; i++) { - ICacheKey key = getICacheKey(UUID.randomUUID().toString()); - cache.computeIfAbsent(key, getLoadAwareCacheLoader()); + OpenSearchOnHeapCache manuallySetNoopStatsCache = getCache(maxKeys, listener, false); + int numAdded = maxKeys + numEvicted; + for (int i = 0; i < numAdded; i++) { + ICacheKey key = getICacheKey(UUID.randomUUID().toString()); + manuallySetNoopStatsCache.computeIfAbsent(key, getLoadAwareCacheLoader()); - assertEquals(Math.min(maxKeys, i + 1), cache.count()); - ImmutableCacheStatsHolder stats = cache.stats(); - assertZeroStats(cache.stats()); - } + assertEquals(Math.min(maxKeys, i + 1), manuallySetNoopStatsCache.count()); + ImmutableCacheStatsHolder stats = manuallySetNoopStatsCache.stats(); + assertZeroStats(manuallySetNoopStatsCache.stats()); } } - public void testWithCacheConfigSizeSettings_WhenPluggableCachingOff() { - // The "pluggable caching off" case can happen when the PLUGGABLE_CACHE setting is false, or if the store name is blank. - // The cache should get its size from the config, not the setting, in either case. - Settings.Builder settingsBuilder = Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, false); + public void testWithCacheConfigSizeSettings_WhenStoreNameBlank() { + // If the store name is blank, the cache should get its size from the config, not the setting. long maxSizeFromSetting = between(1000, 2000); long maxSizeFromConfig = between(3000, 4000); - OpenSearchOnHeapCache onHeapCache = setupMaxSizeTest(settingsBuilder, maxSizeFromSetting, maxSizeFromConfig, true); - assertEquals(maxSizeFromConfig, onHeapCache.getMaximumWeight()); - Settings.Builder storeNameBlankSettingsBuilder = Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, true); - onHeapCache = setupMaxSizeTest(storeNameBlankSettingsBuilder, maxSizeFromSetting, maxSizeFromConfig, true); + Settings.Builder storeNameBlankSettingsBuilder = Settings.builder(); + OpenSearchOnHeapCache onHeapCache = setupMaxSizeTest( + storeNameBlankSettingsBuilder, + maxSizeFromSetting, + maxSizeFromConfig, + true + ); assertEquals(maxSizeFromConfig, onHeapCache.getMaximumWeight()); } - public void testWithCacheConfigSettings_WhenPluggableCachingOn() { - // When pluggable caching is on, the cache should get its size from the config if present, and otherwise should get it from the + public void testWithCacheConfigSettings_WhenStoreNameNotBlank() { + // When the store name is not blank, the cache should get its size from the config if present, and otherwise should get it from the // setting. Settings.Builder settingsBuilder = Settings.builder() - .put(FeatureFlags.PLUGGABLE_CACHE, true) .put( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME @@ -178,7 +172,6 @@ private void assertZeroStats(ImmutableCacheStatsHolder stats) { private OpenSearchOnHeapCache getCache( int maxSizeKeys, MockRemovalListener listener, - boolean pluggableCachesSetting, boolean statsTrackingEnabled ) { ICache.Factory onHeapCacheFactory = new OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory(); @@ -189,7 +182,6 @@ private OpenSearchOnHeapCache getCache( .getKey(), maxSizeKeys * keyValueSize + "b" ) - .put(FeatureFlags.PLUGGABLE_CACHE, pluggableCachesSetting) .build(); CacheConfig cacheConfig = new CacheConfig.Builder().setKeyType(String.class) @@ -207,7 +199,7 @@ private OpenSearchOnHeapCache getCache( public void testInvalidateWithDropDimensions() throws Exception { MockRemovalListener listener = new MockRemovalListener<>(); int maxKeys = 50; - OpenSearchOnHeapCache cache = getCache(maxKeys, listener, true, true); + OpenSearchOnHeapCache cache = getCache(maxKeys, listener, true); List> keysAdded = new ArrayList<>(); diff --git a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java index e83ca247b6a1d..24a9a9241dd97 100644 --- a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java +++ b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java @@ -67,7 +67,6 @@ import org.opensearch.common.lucene.index.OpenSearchDirectoryReader; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; -import org.opensearch.common.util.FeatureFlags; import org.opensearch.common.util.io.IOUtils; import org.opensearch.core.common.bytes.AbstractBytesReference; import org.opensearch.core.common.bytes.BytesReference; @@ -199,58 +198,6 @@ public void testBasicOperationsCache() throws Exception { assertEquals(0, cache.numRegisteredCloseListeners()); } - public void testBasicOperationsCacheWithFeatureFlag() throws Exception { - threadPool = getThreadPool(); - Settings settings = Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build(); - cache = getIndicesRequestCache(settings); - writer.addDocument(newDoc(0, "foo")); - DirectoryReader reader = getReader(writer, indexShard.shardId()); - - // initial cache - IndicesService.IndexShardCacheEntity entity = new IndicesService.IndexShardCacheEntity(indexShard); - Loader loader = new Loader(reader, 0); - BytesReference value = cache.getOrCompute(entity, loader, reader, getTermBytes()); - assertEquals("foo", value.streamInput().readString()); - ShardRequestCache requestCacheStats = indexShard.requestCache(); - assertEquals(0, requestCacheStats.stats().getHitCount()); - assertEquals(1, requestCacheStats.stats().getMissCount()); - assertEquals(0, requestCacheStats.stats().getEvictions()); - assertFalse(loader.loadedFromCache); - assertEquals(1, cache.count()); - - // cache hit - entity = new IndicesService.IndexShardCacheEntity(indexShard); - loader = new Loader(reader, 0); - value = cache.getOrCompute(entity, loader, reader, getTermBytes()); - assertEquals("foo", value.streamInput().readString()); - requestCacheStats = indexShard.requestCache(); - assertEquals(1, requestCacheStats.stats().getHitCount()); - assertEquals(1, requestCacheStats.stats().getMissCount()); - assertEquals(0, requestCacheStats.stats().getEvictions()); - assertTrue(loader.loadedFromCache); - assertEquals(1, cache.count()); - assertTrue(requestCacheStats.stats().getMemorySize().bytesAsInt() > value.length()); - assertEquals(1, cache.numRegisteredCloseListeners()); - - // Closing the cache doesn't modify an already returned CacheEntity - if (randomBoolean()) { - reader.close(); - } else { - indexShard.close("test", true, true); // closed shard but reader is still open - cache.clear(entity); - } - cache.cacheCleanupManager.cleanCache(); - assertEquals(1, requestCacheStats.stats().getHitCount()); - assertEquals(1, requestCacheStats.stats().getMissCount()); - assertEquals(0, requestCacheStats.stats().getEvictions()); - assertTrue(loader.loadedFromCache); - assertEquals(0, cache.count()); - assertEquals(0, requestCacheStats.stats().getMemorySize().bytesAsInt()); - - IOUtils.close(reader); - assertEquals(0, cache.numRegisteredCloseListeners()); - } - public void testCacheDifferentReaders() throws Exception { threadPool = getThreadPool(); cache = getIndicesRequestCache(Settings.EMPTY); @@ -856,8 +803,8 @@ public void testAddingToCleanupKeyToCountMapWorksAppropriatelyWithMultipleThread assertFalse(concurrentModificationExceptionDetected.get()); } - public void testCacheMaxSize_WhenPluggableCachingOff() throws Exception { - // If pluggable caching is off, the IRC should put a max size value into the cache config that it uses to create its cache. + public void testCacheMaxSize_WhenStoreNameAbsent() throws Exception { + // If a store name is absent, the IRC should put a max size value into the cache config that it uses to create its cache. threadPool = getThreadPool(); long cacheSize = 1000; Settings settings = Settings.builder().put(INDICES_CACHE_QUERY_SIZE.getKey(), cacheSize + "b").build(); @@ -871,12 +818,11 @@ public void testCacheMaxSize_WhenPluggableCachingOff() throws Exception { allowDeprecationWarning(); } - public void testCacheMaxSize_WhenPluggableCachingOn() throws Exception { - // If pluggable caching is on, and a store name is present, the IRC should NOT put a max size value into the cache config. + public void testCacheMaxSize_WhenStoreNamePresent() throws Exception { + // If and a store name is present, the IRC should NOT put a max size value into the cache config. threadPool = getThreadPool(); Settings settings = Settings.builder() .put(INDICES_CACHE_QUERY_SIZE.getKey(), 1000 + "b") - .put(FeatureFlags.PLUGGABLE_CACHE, true) .put( CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(), OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME @@ -953,10 +899,7 @@ public void testClosingIndexWipesStats() throws Exception { } threadPool = getThreadPool(); - Settings settings = Settings.builder() - .put(INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING.getKey(), "0.001%") - .put(FeatureFlags.PLUGGABLE_CACHE, true) - .build(); + Settings settings = Settings.builder().put(INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING.getKey(), "0.001%").build(); try (NodeEnvironment env = newNodeEnvironment(settings)) { cache = new IndicesRequestCache(settings, (shardId -> { IndexService indexService = null;