Skip to content

Commit 105aeb5

Browse files
peteralfonsiPeter Alfonsi
and
Peter Alfonsi
authored
[Tiered Caching] Remove PLUGGABLE_CACHE feature flag (#17344)
* Remove PLUGGABLE_CACHE feature flag Signed-off-by: Peter Alfonsi <petealft@amazon.com> * changelog Signed-off-by: Peter Alfonsi <petealft@amazon.com> * move changelog entry Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * fix IT init failure Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> * rerun gradle Signed-off-by: Peter Alfonsi <petealft@amazon.com> --------- Signed-off-by: Peter Alfonsi <petealft@amazon.com> Signed-off-by: Peter Alfonsi <peter.alfonsi@gmail.com> Co-authored-by: Peter Alfonsi <petealft@amazon.com>
1 parent ffa46ca commit 105aeb5

File tree

19 files changed

+61
-220
lines changed

19 files changed

+61
-220
lines changed

CHANGELOG-3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7373
- Remove package org.opensearch.action.support.master ([#4856](https://github.com/opensearch-project/OpenSearch/issues/4856))
7474
- Remove transport-nio plugin ([#16887](https://github.com/opensearch-project/OpenSearch/issues/16887))
7575
- Remove deprecated 'gateway' settings used to defer cluster recovery ([#3117](https://github.com/opensearch-project/OpenSearch/issues/3117))
76+
- Remove FeatureFlags.PLUGGABLE_CACHE as the feature is no longer experimental ([#17344](https://github.com/opensearch-project/OpenSearch/pull/17344))
7677

7778
### Fixed
7879
- Fix 'org.apache.hc.core5.http.ParseException: Invalid protocol version' under JDK 16+ ([#4827](https://github.com/opensearch-project/OpenSearch/pull/4827))

distribution/src/config/opensearch.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ ${path.logs}
122122
#
123123
#opensearch.experimental.optimization.datetime_formatter_caching.enabled: false
124124
#
125-
# Gates the functionality of enabling Opensearch to use pluggable caches with respective store names via setting.
126-
#
127-
#opensearch.experimental.feature.pluggable.caching.enabled: false
128-
#
129125
# Gates the functionality of star tree index, which improves the performance of search aggregations.
130126
#
131127
#opensearch.experimental.feature.composite_index.star_tree.enabled: true

modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
import org.opensearch.common.cache.settings.CacheSettings;
1313
import org.opensearch.common.cache.store.OpenSearchOnHeapCache;
1414
import org.opensearch.common.settings.Settings;
15-
import org.opensearch.common.util.FeatureFlags;
1615
import org.opensearch.test.OpenSearchIntegTestCase;
1716

1817
public class TieredSpilloverCacheBaseIT extends OpenSearchIntegTestCase {
1918

2019
public Settings defaultSettings(String onHeapCacheSizeInBytesOrPercentage, int numberOfSegments) {
2120
return Settings.builder()
22-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
2321
.put(
2422
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
2523
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME

modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCachePlugin.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.opensearch.common.cache.ICache;
1313
import org.opensearch.common.settings.Setting;
1414
import org.opensearch.common.settings.Settings;
15-
import org.opensearch.common.util.FeatureFlags;
1615
import org.opensearch.plugins.CachePlugin;
1716
import org.opensearch.plugins.Plugin;
1817

@@ -64,9 +63,7 @@ public List<Setting<?>> getSettings() {
6463
);
6564
settingList.add(TOOK_TIME_POLICY_CONCRETE_SETTINGS_MAP.get(cacheType));
6665
settingList.add(TOOK_TIME_DISK_TIER_POLICY_CONCRETE_SETTINGS_MAP.get(cacheType));
67-
if (FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings)) {
68-
settingList.add(DISK_CACHE_ENABLED_SETTING_MAP.get(cacheType));
69-
}
66+
settingList.add(DISK_CACHE_ENABLED_SETTING_MAP.get(cacheType));
7067
settingList.add(
7168
TieredSpilloverCacheSettings.TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(cacheType.getSettingPrefix())
7269
);

modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCachePluginTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import org.opensearch.common.cache.ICache;
1212
import org.opensearch.common.settings.Settings;
13-
import org.opensearch.common.util.FeatureFlags;
1413
import org.opensearch.test.OpenSearchTestCase;
1514

1615
import java.util.Map;
@@ -24,10 +23,8 @@ public void testGetCacheFactoryMap() {
2423
assertEquals(TieredSpilloverCachePlugin.TIERED_CACHE_SPILLOVER_PLUGIN_NAME, tieredSpilloverCachePlugin.getName());
2524
}
2625

27-
public void testGetSettingsWithFeatureFlagOn() {
28-
TieredSpilloverCachePlugin tieredSpilloverCachePlugin = new TieredSpilloverCachePlugin(
29-
Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE_SETTING.getKey(), true).build()
30-
);
26+
public void testGetSettings() {
27+
TieredSpilloverCachePlugin tieredSpilloverCachePlugin = new TieredSpilloverCachePlugin(Settings.builder().build());
3128
assertFalse(tieredSpilloverCachePlugin.getSettings().isEmpty());
3229
}
3330
}

modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.opensearch.common.settings.Setting;
3131
import org.opensearch.common.settings.Settings;
3232
import org.opensearch.common.unit.TimeValue;
33-
import org.opensearch.common.util.FeatureFlags;
3433
import org.opensearch.env.NodeEnvironment;
3534
import org.opensearch.test.OpenSearchTestCase;
3635
import org.junit.Before;
@@ -183,7 +182,6 @@ public void testComputeIfAbsentWithFactoryBasedCacheCreation() throws Exception
183182
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
184183
)
185184
.put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 1)
186-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
187185
.build();
188186
String storagePath = getStoragePath(settings);
189187
ICache<String, String> tieredSpilloverICache = new TieredSpilloverCache.TieredSpilloverCacheFactory().create(
@@ -283,7 +281,6 @@ public void testComputeIfAbsentWithSegmentedCache() throws Exception {
283281
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
284282
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
285283
)
286-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
287284
.build();
288285
String storagePath = getStoragePath(settings);
289286
ICache<String, String> tieredSpilloverICache = new TieredSpilloverCache.TieredSpilloverCacheFactory().create(
@@ -406,7 +403,6 @@ public void testWithFactoryCreationWithOnHeapCacheNotPresent() {
406403
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
407404
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
408405
)
409-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
410406
.build();
411407

412408
IllegalArgumentException ex = assertThrows(
@@ -491,7 +487,6 @@ public void testComputeIfAbsentWithEvictionsFromOnHeapCache() throws Exception {
491487
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
492488
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
493489
)
494-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
495490
.put(
496491
TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_SIZE.getConcreteSettingForNamespace(
497492
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()
@@ -1276,7 +1271,6 @@ public void testConcurrencyForEvictionFlowFromOnHeapToDiskTier() throws Exceptio
12761271
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
12771272
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
12781273
)
1279-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
12801274
.put(
12811275
TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_SIZE.getConcreteSettingForNamespace(
12821276
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()
@@ -2160,7 +2154,6 @@ public void testWithInvalidSegmentNumber() throws Exception {
21602154
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
21612155
)
21622156
.put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 1)
2163-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
21642157
.put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 3)
21652158
.build();
21662159
String storagePath = getStoragePath(settings);
@@ -2226,7 +2219,6 @@ public void testWithVeryLowDiskCacheSize() throws Exception {
22262219
).getKey(),
22272220
1L
22282221
)
2229-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
22302222
.put(TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(), 2)
22312223
.build();
22322224
String storagePath = getStoragePath(settings);
@@ -2285,7 +2277,6 @@ public void testTieredCacheDefaultSegmentCount() {
22852277
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
22862278
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
22872279
)
2288-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
22892280
.build();
22902281
String storagePath = getStoragePath(settings);
22912282

@@ -2419,7 +2410,6 @@ public void testSegmentSizesWhenUsingFactory() {
24192410
).getKey(),
24202411
heapSizeFromImplSetting + "b"
24212412
)
2422-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
24232413
.put(
24242414
TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace(CacheType.INDICES_REQUEST_CACHE.getSettingPrefix()).getKey(),
24252415
numSegments
@@ -2466,7 +2456,6 @@ public void testSegmentSizesWhenNotUsingFactory() {
24662456
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
24672457
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
24682458
)
2469-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
24702459
// The size setting from the OpenSearchOnHeapCache implementation should not be honored
24712460
.put(
24722461
OpenSearchOnHeapCacheSettings.MAXIMUM_SIZE_IN_BYTES.getConcreteSettingForNamespace(
@@ -2697,7 +2686,6 @@ private TieredSpilloverCache<String, String> initializeTieredSpilloverCache(
26972686
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
26982687
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
26992688
)
2700-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
27012689
.put(settings)
27022690
.build()
27032691
)
@@ -2750,7 +2738,6 @@ private CacheConfig<String, String> getCacheConfig(
27502738
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
27512739
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME
27522740
)
2753-
.put(FeatureFlags.PLUGGABLE_CACHE, "true")
27542741
.put(settings)
27552742
.build()
27562743
)

plugins/cache-ehcache/src/internalClusterTest/java/org/opensearch/cache/EhcacheDiskCacheIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.opensearch.common.cache.settings.CacheSettings;
2727
import org.opensearch.common.settings.Settings;
2828
import org.opensearch.common.unit.TimeValue;
29-
import org.opensearch.common.util.FeatureFlags;
3029
import org.opensearch.env.NodeEnvironment;
3130
import org.opensearch.index.cache.request.RequestCacheStats;
3231
import org.opensearch.index.query.QueryBuilders;
@@ -71,11 +70,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
7170
return Arrays.asList(EhcacheCachePlugin.class);
7271
}
7372

74-
@Override
75-
protected Settings featureFlagSettings() {
76-
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build();
77-
}
78-
7973
private Settings defaultSettings(long sizeInBytes, TimeValue expirationTime) {
8074
if (expirationTime == null) {
8175
expirationTime = TimeValue.MAX_VALUE;

plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.opensearch.common.metrics.CounterMetric;
2727
import org.opensearch.common.settings.Settings;
2828
import org.opensearch.common.unit.TimeValue;
29-
import org.opensearch.common.util.FeatureFlags;
3029
import org.opensearch.common.util.io.IOUtils;
3130
import org.opensearch.core.common.bytes.BytesArray;
3231
import org.opensearch.core.common.bytes.BytesReference;
@@ -1221,7 +1220,6 @@ private EhcacheDiskCache<String, String> setupMaxSizeTest(long maxSizeFromSettin
12211220
MockRemovalListener<String, String> listener = new MockRemovalListener<>();
12221221
try (NodeEnvironment env = newNodeEnvironment(Settings.builder().build())) {
12231222
Settings settings = Settings.builder()
1224-
.put(FeatureFlags.PLUGGABLE_CACHE, true)
12251223
.put(
12261224
CacheSettings.getConcreteStoreNameSettingForCacheType(CacheType.INDICES_REQUEST_CACHE).getKey(),
12271225
EhcacheDiskCache.EhcacheDiskCacheFactory.EHCACHE_DISK_CACHE_NAME

server/src/internalClusterTest/java/org/opensearch/indices/CacheStatsAPIIndicesRequestCacheIT.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package org.opensearch.indices;
1010

11-
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
12-
1311
import org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest;
1412
import org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse;
1513
import org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
@@ -24,7 +22,6 @@
2422
import org.opensearch.common.cache.stats.ImmutableCacheStatsHolder;
2523
import org.opensearch.common.settings.Settings;
2624
import org.opensearch.common.unit.TimeValue;
27-
import org.opensearch.common.util.FeatureFlags;
2825
import org.opensearch.common.xcontent.XContentFactory;
2926
import org.opensearch.common.xcontent.XContentHelper;
3027
import org.opensearch.core.xcontent.MediaTypeRegistry;
@@ -34,13 +31,10 @@
3431
import org.opensearch.index.cache.request.RequestCacheStats;
3532
import org.opensearch.index.query.QueryBuilders;
3633
import org.opensearch.test.OpenSearchIntegTestCase;
37-
import org.opensearch.test.ParameterizedStaticSettingsOpenSearchIntegTestCase;
3834
import org.opensearch.test.hamcrest.OpenSearchAssertions;
3935
import org.opensearch.transport.client.Client;
4036

4137
import java.io.IOException;
42-
import java.util.Arrays;
43-
import java.util.Collection;
4438
import java.util.HashMap;
4539
import java.util.List;
4640
import java.util.Map;
@@ -50,16 +44,7 @@
5044

5145
// Use a single data node to simplify logic about cache stats across different shards.
5246
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 1)
53-
public class CacheStatsAPIIndicesRequestCacheIT extends ParameterizedStaticSettingsOpenSearchIntegTestCase {
54-
public CacheStatsAPIIndicesRequestCacheIT(Settings settings) {
55-
super(settings);
56-
}
57-
58-
@ParametersFactory
59-
public static Collection<Object[]> parameters() {
60-
return Arrays.<Object[]>asList(new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "true").build() });
61-
}
62-
47+
public class CacheStatsAPIIndicesRequestCacheIT extends OpenSearchIntegTestCase {
6348
/**
6449
* Test aggregating by indices, indices+shards, shards, or no levels, and check the resulting stats
6550
* are as we expect.

server/src/internalClusterTest/java/org/opensearch/indices/IndicesRequestCacheIT.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.opensearch.common.settings.Settings;
5757
import org.opensearch.common.time.DateFormatter;
5858
import org.opensearch.common.unit.TimeValue;
59-
import org.opensearch.common.util.FeatureFlags;
6059
import org.opensearch.core.index.Index;
6160
import org.opensearch.core.index.shard.ShardId;
6261
import org.opensearch.env.NodeEnvironment;
@@ -110,9 +109,7 @@ public IndicesRequestCacheIT(Settings settings) {
110109
public static Collection<Object[]> parameters() {
111110
return Arrays.asList(
112111
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() },
113-
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() },
114-
new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "true").build() },
115-
new Object[] { Settings.builder().put(FeatureFlags.PLUGGABLE_CACHE, "false").build() }
112+
new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }
116113
);
117114
}
118115

server/src/main/java/org/opensearch/common/cache/service/CacheService.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.opensearch.common.cache.store.config.CacheConfig;
1919
import org.opensearch.common.settings.Setting;
2020
import org.opensearch.common.settings.Settings;
21-
import org.opensearch.common.util.FeatureFlags;
2221

2322
import java.util.HashMap;
2423
import java.util.Map;
@@ -47,10 +46,9 @@ public CacheService(Map<String, ICache.Factory> cacheStoreTypeFactories, Setting
4746

4847
public <K, V> ICache<K, V> createCache(CacheConfig<K, V> config, CacheType cacheType) {
4948
String storeName = getStoreNameFromSetting(cacheType, settings);
50-
if (!pluggableCachingEnabled(cacheType, settings)) {
51-
// Condition 1: In case feature flag is off, we default to onHeap.
52-
// Condition 2: In case storeName is not explicitly mentioned, we assume user is looking to use older
53-
// settings, so we again fallback to onHeap to maintain backward compatibility.
49+
if (!storeNamePresent(cacheType, settings)) {
50+
// In case storeName is not explicitly mentioned, we assume user is looking to use older
51+
// settings, so we fallback to onHeap to maintain backward compatibility.
5452
// It is guaranteed that we will have this store name registered, so
5553
// should be safe.
5654
storeName = OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME;
@@ -73,11 +71,11 @@ public NodeCacheStats stats(CommonStatsFlags flags) {
7371
}
7472

7573
/**
76-
* Check if pluggable caching is on, and if a store type is present for this cache type.
74+
* Check if a store type is present for this cache type.
7775
*/
78-
public static boolean pluggableCachingEnabled(CacheType cacheType, Settings settings) {
76+
public static boolean storeNamePresent(CacheType cacheType, Settings settings) {
7977
String storeName = getStoreNameFromSetting(cacheType, settings);
80-
return FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings) && storeName != null && !storeName.isBlank();
78+
return storeName != null && !storeName.isBlank();
8179
}
8280

8381
private static String getStoreNameFromSetting(CacheType cacheType, Settings settings) {

0 commit comments

Comments
 (0)