Skip to content

Commit

Permalink
Adding integ settings and correcting the flow to contain only enabled…
Browse files Browse the repository at this point in the history
… setting at cluster level

Signed-off-by: Bharathwaj G <[email protected]>
  • Loading branch information
bharath-techie committed Jun 7, 2024
1 parent 90a560d commit 2018b0c
Show file tree
Hide file tree
Showing 18 changed files with 1,026 additions and 457 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
import org.opensearch.index.ShardIndexingPressureMemoryManager;
import org.opensearch.index.ShardIndexingPressureSettings;
import org.opensearch.index.ShardIndexingPressureStore;
import org.opensearch.index.compositeindex.CompositeIndexSettings;
import org.opensearch.index.remote.RemoteStorePressureSettings;
import org.opensearch.index.remote.RemoteStoreStatsTrackerFactory;
import org.opensearch.index.store.remote.filecache.FileCacheSettings;
Expand Down Expand Up @@ -748,13 +747,8 @@ public void apply(Settings value, Settings current, Settings previous) {
SearchService.CLUSTER_ALLOW_DERIVED_FIELD_SETTING,
RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_METADATA,

// Composite index settings
CompositeIndexSettings.COMPOSITE_INDEX_ENABLED_SETTING,
CompositeIndexSettings.COMPOSITE_INDEX_MAX_FIELDS_SETTING,
CompositeIndexSettings.COMPOSITE_INDEX_MAX_DIMENSIONS_SETTING,
CompositeIndexSettings.STAR_TREE_DEFAULT_MAX_LEAF_DOCS,
CompositeIndexSettings.DEFAULT_METRICS_LIST,
CompositeIndexSettings.DEFAULT_DATE_INTERVALS
// Composite index setting
IndicesService.COMPOSITE_INDEX_ENABLED_SETTING
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.opensearch.index.SearchSlowLog;
import org.opensearch.index.TieredMergePolicyProvider;
import org.opensearch.index.cache.bitset.BitsetFilterCache;
import org.opensearch.index.compositeindex.CompositeIndexConfig;
import org.opensearch.index.engine.EngineConfig;
import org.opensearch.index.fielddata.IndexFieldDataService;
import org.opensearch.index.mapper.FieldMapper;
Expand Down Expand Up @@ -238,6 +239,14 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
// Settings for concurrent segment search
IndexSettings.INDEX_CONCURRENT_SEGMENT_SEARCH_SETTING,
IndexSettings.ALLOW_DERIVED_FIELDS,

// Settings for composite index defaults
CompositeIndexConfig.STAR_TREE_DEFAULT_MAX_LEAF_DOCS,
CompositeIndexConfig.COMPOSITE_INDEX_MAX_DIMENSIONS_SETTING,
CompositeIndexConfig.COMPOSITE_INDEX_MAX_FIELDS_SETTING,
CompositeIndexConfig.DEFAULT_METRICS_LIST,
CompositeIndexConfig.DEFAULT_DATE_INTERVALS,

// validate that built-in similarities don't get redefined
Setting.groupSetting("index.similarity.", (s) -> {
Map<String, Settings> groups = s.getAsGroups();
Expand All @@ -250,7 +259,8 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
}
}, Property.IndexScope), // this allows similarity settings to be passed
Setting.groupSetting("index.analysis.", Property.IndexScope), // this allows analysis settings to be passed
Setting.groupSetting("index.composite_index.", Property.IndexScope) // this allows composite index settings to be passed
Setting.groupSetting("index.composite_index.config.", Property.IndexScope) // this allows composite index settings to be
// passed
)
)
);
Expand Down
5 changes: 2 additions & 3 deletions server/src/main/java/org/opensearch/index/IndexModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.opensearch.index.cache.query.DisabledQueryCache;
import org.opensearch.index.cache.query.IndexQueryCache;
import org.opensearch.index.cache.query.QueryCache;
import org.opensearch.index.compositeindex.CompositeIndexSettings;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.engine.EngineConfigFactory;
import org.opensearch.index.engine.EngineFactory;
Expand Down Expand Up @@ -608,7 +607,7 @@ public IndexService newIndexService(
Supplier<TimeValue> clusterDefaultRefreshIntervalSupplier,
RecoverySettings recoverySettings,
RemoteStoreSettings remoteStoreSettings,
CompositeIndexSettings compositeIndexSettings
BooleanSupplier isCompositeIndexCreationEnabled
) throws IOException {
final IndexEventListener eventListener = freeze();
Function<IndexService, CheckedFunction<DirectoryReader, DirectoryReader, IOException>> readerWrapperFactory = indexReaderWrapper
Expand Down Expand Up @@ -668,7 +667,7 @@ public IndexService newIndexService(
clusterDefaultRefreshIntervalSupplier,
recoverySettings,
remoteStoreSettings,
compositeIndexSettings
isCompositeIndexCreationEnabled
);
success = true;
return indexService;
Expand Down
6 changes: 3 additions & 3 deletions server/src/main/java/org/opensearch/index/IndexService.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.opensearch.index.cache.bitset.BitsetFilterCache;
import org.opensearch.index.cache.query.QueryCache;
import org.opensearch.index.compositeindex.CompositeIndexConfig;
import org.opensearch.index.compositeindex.CompositeIndexSettings;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.engine.EngineConfigFactory;
import org.opensearch.index.engine.EngineFactory;
Expand Down Expand Up @@ -227,7 +226,7 @@ public IndexService(
Supplier<TimeValue> clusterDefaultRefreshIntervalSupplier,
RecoverySettings recoverySettings,
RemoteStoreSettings remoteStoreSettings,
CompositeIndexSettings compositeIndexSettings
BooleanSupplier isCompositeIndexCreationEnabled
) {
super(indexSettings);
this.allowExpensiveQueries = allowExpensiveQueries;
Expand Down Expand Up @@ -267,8 +266,9 @@ public IndexService(
}

if (indexSettings.getCompositeIndexConfig().hasCompositeFields()) {
// The validation is done right after the merge of the mapping later in the process ( similar to sort )
this.compositeIndexConfigSupplier = () -> indexSettings.getCompositeIndexConfig()
.validateAndGetCompositeIndexConfig(mapperService::fieldType, compositeIndexSettings);
.validateAndGetCompositeIndexConfig(mapperService::fieldType, isCompositeIndexCreationEnabled);
} else {
this.compositeIndexConfigSupplier = () -> null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@
*/

@ExperimentalApi
public interface CompositeFieldSpec {
void setDefaults(CompositeIndexSettings compositeIndexSettings);
}
public interface CompositeFieldSpec {}
Loading

0 comments on commit 2018b0c

Please sign in to comment.