Skip to content

Commit

Permalink
[Remote Store] Add support to add nested settings for remote store (o…
Browse files Browse the repository at this point in the history
…pensearch-project#4060)

* Add support to add nested settings for remote store

Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
sachinpkale authored and Sachin Kale committed Sep 2, 2022
1 parent 019d30b commit 1bddbd5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ public Iterator<Setting<?>> settings() {
Property.Final
);

public static final String SETTING_REMOTE_STORE = "index.remote_store";
public static final String SETTING_REMOTE_STORE_ENABLED = "index.remote_store.enabled";
/**
* Used to specify if the index data should be persisted in the remote store.
*/
public static final Setting<Boolean> INDEX_REMOTE_STORE_SETTING = Setting.boolSetting(
SETTING_REMOTE_STORE,
public static final Setting<Boolean> INDEX_REMOTE_STORE_ENABLED_SETTING = Setting.boolSetting(
SETTING_REMOTE_STORE_ENABLED,
false,
Property.IndexScope,
Property.Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
FeatureFlags.REPLICATION_TYPE,
IndexMetadata.INDEX_REPLICATION_TYPE_SETTING,
FeatureFlags.REMOTE_STORE,
IndexMetadata.INDEX_REMOTE_STORE_SETTING
IndexMetadata.INDEX_REMOTE_STORE_ENABLED_SETTING
);

public static final IndexScopedSettings DEFAULT_SCOPED_SETTINGS = new IndexScopedSettings(Settings.EMPTY, BUILT_IN_INDEX_SETTINGS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
this.indexMetadata = indexMetadata;
numberOfShards = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, null);
replicationType = ReplicationType.parseString(settings.get(IndexMetadata.SETTING_REPLICATION_TYPE));
isRemoteStoreEnabled = settings.getAsBoolean(IndexMetadata.SETTING_REMOTE_STORE, false);
isRemoteStoreEnabled = settings.getAsBoolean(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, false);

this.searchThrottled = INDEX_SEARCH_THROTTLED.get(settings);
this.queryStringLenient = QUERY_STRING_LENIENT_SETTING.get(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_UPGRADED;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED;
import static org.opensearch.common.util.set.Sets.newHashSet;
import static org.opensearch.snapshots.SnapshotUtils.filterIndices;

Expand Down Expand Up @@ -227,7 +227,7 @@ public ClusterState execute(ClusterState currentState) {
logger.warn("Remote store restore is not supported for non-existent index. Skipping: {}", index);
continue;
}
if (currentIndexMetadata.getSettings().getAsBoolean(SETTING_REMOTE_STORE, false)) {
if (currentIndexMetadata.getSettings().getAsBoolean(SETTING_REMOTE_STORE_ENABLED, false)) {
if (currentIndexMetadata.getState() != IndexMetadata.State.CLOSE) {
throw new IllegalStateException(
"cannot restore index ["
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public void testRemoteStoreExplicitSetting() {
"index",
Settings.builder()
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
.put(IndexMetadata.SETTING_REMOTE_STORE, true)
.put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true)
.build()
);
IndexSettings settings = new IndexSettings(metadata, Settings.EMPTY);
Expand All @@ -788,12 +788,12 @@ public void testUpdateRemoteStoreFails() {
IllegalArgumentException error = expectThrows(
IllegalArgumentException.class,
() -> settings.updateSettings(
Settings.builder().put("index.remote_store", randomBoolean()).build(),
Settings.builder().put("index.remote_store.enabled", randomBoolean()).build(),
Settings.builder(),
Settings.builder(),
"index"
)
);
assertEquals(error.getMessage(), "final index setting [index.remote_store], not updateable");
assertEquals(error.getMessage(), "final index setting [index.remote_store.enabled], not updateable");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,7 @@ public void restoreShard(
public void testRestoreShardFromRemoteStore() throws IOException {
IndexShard target = newStartedShard(
true,
Settings.builder().put(IndexMetadata.SETTING_REMOTE_STORE, true).build(),
Settings.builder().put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true).build(),
new InternalEngineFactory()
);

Expand Down

0 comments on commit 1bddbd5

Please sign in to comment.