-
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.
Refactor: rename settings, change logic to provide simplicity in over…
…riding settings Signed-off-by: Varun Bansal <bansvaru@amazon.com>
- Loading branch information
Showing
8 changed files
with
354 additions
and
86 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
202 changes: 183 additions & 19 deletions
202
server/src/internalClusterTest/java/org/opensearch/remotestore/CreateRemoteIndexIT.java
Large diffs are not rendered by default.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
...ernalClusterTest/java/org/opensearch/remotestore/CreateRemoteIndexTranslogDisabledIT.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,76 @@ | ||
/* | ||
* 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.remotestore; | ||
|
||
import org.opensearch.action.admin.indices.get.GetIndexRequest; | ||
import org.opensearch.action.admin.indices.get.GetIndexResponse; | ||
import org.opensearch.cluster.metadata.IndexMetadata; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.indices.replication.common.ReplicationType; | ||
import org.opensearch.test.OpenSearchIntegTestCase; | ||
|
||
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED; | ||
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_REPOSITORY; | ||
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE; | ||
import static org.opensearch.indices.IndicesService.CLUSTER_REMOTE_STORE_ENABLED_SETTING; | ||
import static org.opensearch.indices.IndicesService.CLUSTER_REMOTE_STORE_REPOSITORY_SETTING; | ||
import static org.opensearch.indices.IndicesService.CLUSTER_REMOTE_TRANSLOG_REPOSITORY_SETTING; | ||
import static org.opensearch.indices.IndicesService.CLUSTER_REMOTE_TRANSLOG_STORE_ENABLED_SETTING; | ||
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; | ||
|
||
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST) | ||
public class CreateRemoteIndexTranslogDisabledIT extends CreateRemoteIndexIT { | ||
|
||
@Override | ||
protected Settings nodeSettings(int nodeOriginal) { | ||
Settings settings = super.nodeSettings(nodeOriginal); | ||
Settings.Builder builder = Settings.builder() | ||
.put(CLUSTER_REMOTE_STORE_ENABLED_SETTING.getKey(), true) | ||
.put(CLUSTER_REMOTE_STORE_REPOSITORY_SETTING.getKey(), "my-segment-repo-1") | ||
.put(settings); | ||
builder.remove(CLUSTER_REMOTE_TRANSLOG_STORE_ENABLED_SETTING.getKey()); | ||
builder.remove(CLUSTER_REMOTE_TRANSLOG_REPOSITORY_SETTING.getKey()); | ||
return builder.build(); | ||
} | ||
|
||
public void testRemoteStoreEnabledByUserWithRemoteRepo() throws Exception { | ||
final int numReplicas = internalCluster().numDataNodes(); | ||
Settings settings = Settings.builder() | ||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3) | ||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas) | ||
.put(SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT) | ||
.put(SETTING_REMOTE_STORE_ENABLED, true) | ||
.put(SETTING_REMOTE_STORE_REPOSITORY, "my-custom-repo") | ||
.build(); | ||
|
||
assertAcked(client().admin().indices().prepareCreate("test-idx-1").setSettings(settings).get()); | ||
GetIndexResponse getIndexResponse = client().admin() | ||
.indices() | ||
.getIndex(new GetIndexRequest().indices("test-idx-1").includeDefaults(true)) | ||
.get(); | ||
Settings indexSettings = getIndexResponse.settings().get("test-idx-1"); | ||
verifyRemoteStoreIndexSettings(indexSettings, "true", "my-custom-repo", null, null, ReplicationType.SEGMENT.toString(), null); | ||
} | ||
|
||
public void testDefaultRemoteStoreNoUserOverride() throws Exception { | ||
final int numReplicas = internalCluster().numDataNodes(); | ||
Settings settings = Settings.builder() | ||
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3) | ||
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, numReplicas) | ||
.build(); | ||
assertAcked(client().admin().indices().prepareCreate("test-idx-1").setSettings(settings).get()); | ||
GetIndexResponse getIndexResponse = client().admin() | ||
.indices() | ||
.getIndex(new GetIndexRequest().indices("test-idx-1").includeDefaults(true)) | ||
.get(); | ||
Settings indexSettings = getIndexResponse.settings().get("test-idx-1"); | ||
verifyRemoteStoreIndexSettings(indexSettings, "true", "my-segment-repo-1", null, null, ReplicationType.SEGMENT.toString(), null); | ||
} | ||
|
||
} |
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
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
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
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.