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 cfa0940101ad1..5ff78367c4d35 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 @@ -53,7 +53,6 @@ import java.util.function.ToLongBiFunction; import org.ehcache.PersistentCacheManager; -import org.ehcache.impl.serialization.StringSerializer; import static org.opensearch.cache.EhcacheDiskCacheSettings.DISK_LISTENER_MODE_SYNC_KEY; import static org.opensearch.cache.EhcacheDiskCacheSettings.DISK_MAX_SIZE_IN_BYTES_KEY; diff --git a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java index a5226012baa77..3f6f04a8d37f6 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java +++ b/server/src/main/java/org/opensearch/indices/IndicesRequestCache.java @@ -128,11 +128,14 @@ public final class IndicesRequestCache implements RemovalListener INDICES_CACHE_QUERY_SIZE = Setting.memorySizeSetting( "indices.requests.cache.size", "1%", - Property.NodeScope + Property.NodeScope, + Property.Deprecated ); public static final Setting INDICES_CACHE_QUERY_EXPIRE = Setting.positiveTimeSetting( "indices.requests.cache.expire", @@ -229,8 +232,7 @@ CacheConfig getCacheConfig(Settings settings, NodeEnvironme 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 - // size - // settings. + // size settings. configBuilder.setMaxSizeInBytes(sizeInBytes); } return configBuilder.build(); diff --git a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java index 3a2b12bc239b2..e83ca247b6a1d 100644 --- a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java +++ b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java @@ -868,6 +868,7 @@ public void testCacheMaxSize_WhenPluggableCachingOff() throws Exception { config = cache.getCacheConfig(settings, env); } assertEquals(cacheSize, (long) config.getMaxSizeInBytes()); + allowDeprecationWarning(); } public void testCacheMaxSize_WhenPluggableCachingOn() throws Exception { @@ -888,6 +889,7 @@ public void testCacheMaxSize_WhenPluggableCachingOn() throws Exception { config = cache.getCacheConfig(settings, env); } assertEquals(0, (long) config.getMaxSizeInBytes()); + allowDeprecationWarning(); } private IndicesRequestCache getIndicesRequestCache(Settings settings) throws IOException { @@ -1133,6 +1135,7 @@ public void testEviction() throws Exception { assertEquals(2, cache.count()); assertEquals(1, indexShard.requestCache().stats().getEvictions()); IOUtils.close(reader, secondReader, thirdReader, environment); + allowDeprecationWarning(); } public void testClearAllEntityIdentity() throws Exception { @@ -1410,6 +1413,7 @@ public void testGetOrComputeConcurrentlyWithMultipleIndices() throws Exception { } IOUtils.close(cache); executorService.shutdownNow(); + allowDeprecationWarning(); } public void testDeleteAndCreateIndexShardOnSameNodeAndVerifyStats() throws Exception { @@ -1578,6 +1582,12 @@ public static String generateString(int length) { return sb.toString(); } + private void allowDeprecationWarning() { + assertWarnings( + "[indices.requests.cache.size] setting was deprecated in OpenSearch and will be removed in a future release! See the breaking changes documentation for the next major version." + ); + } + private class TestBytesReference extends AbstractBytesReference { int dummyValue;