Skip to content

Commit

Permalink
Updating changelog and renaming feature flag setting
Browse files Browse the repository at this point in the history
Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com>
  • Loading branch information
sgup432 committed Mar 6, 2024
1 parent 6af885c commit 1f85b27
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add toString methods to MultiSearchRequest, MultiGetRequest and CreateIndexRequest ([#12163](https://github.com/opensearch-project/OpenSearch/pull/12163))
- Support for returning scores in matched queries ([#11626](https://github.com/opensearch-project/OpenSearch/pull/11626))
- Add shard id property to SearchLookup for use in field types provided by plugins ([#1063](https://github.com/opensearch-project/OpenSearch/pull/1063))
- [Tiered caching] Integrating IndicesRequestCache with CacheService controlled by a feature flag ([#12533](https://github.com/opensearch-project/OpenSearch/pull/12533))
- [Tiered caching] Make IndicesRequestCache implementation configurable [EXPERIMENTAL] ([#12533](https://github.com/opensearch-project/OpenSearch/pull/12533))
- Add kuromoji_completion analyzer and filter ([#4835](https://github.com/opensearch-project/OpenSearch/issues/4835))

### Dependencies
Expand Down
4 changes: 4 additions & 0 deletions distribution/src/config/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,7 @@ ${path.logs}
# Once there is no observed impact on performance, this feature flag can be removed.
#
#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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {

@Override
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.TIERED_CACHING, "true").build();
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static Collection<Object[]> parameters() {

@Override
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.TIERED_CACHING, "true").build();
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ public void apply(Settings value, Settings current, Settings previous) {
TelemetrySettings.TRACER_FEATURE_ENABLED_SETTING,
TelemetrySettings.METRICS_FEATURE_ENABLED_SETTING
),
List.of(FeatureFlags.TIERED_CACHING),
List.of(FeatureFlags.PLUGGABLE_CACHE),
List.of(CacheSettings.getConcreteSettingForCacheType(CacheType.INDICES_REQUEST_CACHE))
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ protected FeatureFlagSettings(
FeatureFlags.WRITEABLE_REMOTE_INDEX_SETTING,
FeatureFlags.DOC_ID_FUZZY_SET_SETTING,
FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING,
FeatureFlags.TIERED_CACHING_SETTING
FeatureFlags.PLUGGABLE_CACHE_SETTING
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ public class FeatureFlags {
public static final String DOC_ID_FUZZY_SET = "opensearch.experimental.optimize_doc_id_lookup.fuzzy_set.enabled";

/**
* Gates the functionality of tiered caching
* Gates the functionality of pluggable cache.
* Enables OpenSearch to use pluggable caches with respective store names via setting.
*/
public static final String TIERED_CACHING = "opensearch.experimental.feature.tiered.caching.enabled";
public static final String PLUGGABLE_CACHE = "opensearch.experimental.feature.pluggable.caching.enabled";

/**
* Should store the settings from opensearch.yml.
Expand Down Expand Up @@ -134,5 +135,5 @@ public static boolean isEnabled(Setting<Boolean> featureFlag) {

public static final Setting<Boolean> DOC_ID_FUZZY_SET_SETTING = Setting.boolSetting(DOC_ID_FUZZY_SET, false, Property.NodeScope);

public static final Setting<Boolean> TIERED_CACHING_SETTING = Setting.boolSetting(TIERED_CACHING, false, Property.NodeScope);
public static final Setting<Boolean> PLUGGABLE_CACHE_SETTING = Setting.boolSetting(PLUGGABLE_CACHE, false, Property.NodeScope);
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public final class IndicesRequestCache implements RemovalListener<IndicesRequest
long sizeInBytes = size.getBytes();
ToLongBiFunction<Key, BytesReference> weigher = (k, v) -> k.ramBytesUsed() + v.ramBytesUsed();
this.cacheEntityLookup = cacheEntityFunction;
if (FeatureFlags.TIERED_CACHING_SETTING.get(settings)) {
if (FeatureFlags.PLUGGABLE_CACHE_SETTING.get(settings)) {
this.cache = cacheService.createCache(
new CacheConfig.Builder<Key, BytesReference>().setSettings(settings)
.setWeigher((k, v) -> k.ramBytesUsed() + v.ramBytesUsed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void testBasicOperationsCacheWithFeatureFlag() throws Exception {
IndexShard indexShard = createIndex("test").getShard(0);
CacheService cacheService = new CacheModule(new ArrayList<>(), Settings.EMPTY).getCacheService();
IndicesRequestCache cache = new IndicesRequestCache(
Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.TIERED_CACHING, "true").build(),
Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.PLUGGABLE_CACHE, "true").build(),
(shardId -> Optional.of(new IndicesService.IndexShardCacheEntity(indexShard))),
cacheService
);
Expand Down

0 comments on commit 1f85b27

Please sign in to comment.