-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tiered Caching] Segmented cache changes (#16047)
* Segmented cache changes for TieredCache Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Adding change log Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Allow segment number to be power of two Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Moving common tiered cache IT methods to a common base class Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Adding disk took time IT test with multiple segment Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Correcting changelog Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Addressing comments Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Fixing invalid segment count variable name Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Introducing new settings for size for respective cache tier Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Changing the default segmentCount logic Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> * Fixing missing java doc issue Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> --------- Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com> Signed-off-by: Sagar <99425694+sgup432@users.noreply.github.com>
- Loading branch information
Showing
23 changed files
with
2,170 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheBaseIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cache.common.tier; | ||
|
||
import org.opensearch.common.cache.CacheType; | ||
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 | ||
) | ||
.put( | ||
TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_NAME.getConcreteSettingForNamespace( | ||
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() | ||
).getKey(), | ||
OpenSearchOnHeapCache.OpenSearchOnHeapCacheFactory.NAME | ||
) | ||
.put( | ||
TieredSpilloverCacheSettings.TIERED_SPILLOVER_DISK_STORE_NAME.getConcreteSettingForNamespace( | ||
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() | ||
).getKey(), | ||
MockDiskCache.MockDiskCacheFactory.NAME | ||
) | ||
.put( | ||
TieredSpilloverCacheSettings.TIERED_SPILLOVER_SEGMENTS.getConcreteSettingForNamespace( | ||
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() | ||
).getKey(), | ||
numberOfSegments | ||
) | ||
.put( | ||
TieredSpilloverCacheSettings.TIERED_SPILLOVER_ONHEAP_STORE_SIZE.getConcreteSettingForNamespace( | ||
CacheType.INDICES_REQUEST_CACHE.getSettingPrefix() | ||
).getKey(), | ||
onHeapCacheSizeInBytesOrPercentage | ||
) | ||
.build(); | ||
} | ||
|
||
public int getNumberOfSegments() { | ||
return randomFrom(1, 2, 4, 8, 16, 64, 128, 256); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.