Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Lakshya Taragi <[email protected]>
  • Loading branch information
ltaragi committed Apr 12, 2024
1 parent 51c5705 commit 2931a1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;

@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
public class RemoteStoreMigrationSettingsUpdateIT extends ShardAllocationBaseTestCase {
public class RemoteStoreMigrationSettingsUpdateIT extends RemoteStoreMigrationShardAllocationBaseTestCase {

private Client client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static org.opensearch.node.remotestore.RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;

public class ShardAllocationBaseTestCase extends MigrationBaseTestCase {
public class RemoteStoreMigrationShardAllocationBaseTestCase extends MigrationBaseTestCase {
protected static final String TEST_INDEX = "test_index";
protected static final String NAME = "remote_store_migration";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1358,11 +1358,7 @@ public void testRemoteStoreNoUserOverrideExceptReplicationTypeSegmentIndexSettin
ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
.nodes(DiscoveryNodes.builder().add(getRemoteNode()).build())
.build();
Settings settings = Settings.builder()
.put(CLUSTER_REPLICATION_TYPE_SETTING.getKey(), ReplicationType.DOCUMENT)
.put(segmentRepositoryNameAttributeKey, "my-segment-repo-1")
.put(translogRepositoryNameAttributeKey, "my-translog-repo-1")
.build();
Settings settings = Settings.builder().put(translogRepositoryNameAttributeKey, "my-translog-repo-1").build();
request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test");
final Settings.Builder requestSettings = Settings.builder();
requestSettings.put(SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT);
Expand All @@ -1384,18 +1380,15 @@ public void testRemoteStoreNoUserOverrideExceptReplicationTypeSegmentIndexSettin
"my-segment-repo-1",
"my-translog-repo-1",
ReplicationType.SEGMENT.toString(),
IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL
null
);
}

public void testRemoteStoreImplicitOverrideReplicationTypeToSegmentForRemoteStore() {
ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
.nodes(DiscoveryNodes.builder().add(getRemoteNode()).build())
.build();
Settings settings = Settings.builder()
.put(segmentRepositoryNameAttributeKey, "my-segment-repo-1")
.put(translogRepositoryNameAttributeKey, "my-translog-repo-1")
.build();
Settings settings = Settings.builder().put(translogRepositoryNameAttributeKey, "my-translog-repo-1").build();
request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test");
final Settings.Builder requestSettings = Settings.builder();
request.settings(requestSettings.build());
Expand All @@ -1416,19 +1409,15 @@ public void testRemoteStoreImplicitOverrideReplicationTypeToSegmentForRemoteStor
"my-segment-repo-1",
"my-translog-repo-1",
ReplicationType.SEGMENT.toString(),
IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL
null
);
}

public void testRemoteStoreNoUserOverrideIndexSettings() {
ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
.nodes(DiscoveryNodes.builder().add(getRemoteNode()).build())
.build();
Settings settings = Settings.builder()
.put(CLUSTER_REPLICATION_TYPE_SETTING.getKey(), ReplicationType.SEGMENT)
.put(segmentRepositoryNameAttributeKey, "my-segment-repo-1")
.put(translogRepositoryNameAttributeKey, "my-translog-repo-1")
.build();
Settings settings = Settings.builder().put(translogRepositoryNameAttributeKey, "my-translog-repo-1").build();
request = new CreateIndexClusterStateUpdateRequest("create index", "test", "test");
Settings indexSettings = aggregateIndexSettings(
clusterState,
Expand All @@ -1447,7 +1436,7 @@ public void testRemoteStoreNoUserOverrideIndexSettings() {
"my-segment-repo-1",
"my-translog-repo-1",
ReplicationType.SEGMENT.toString(),
IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL
null
);
}

Expand Down Expand Up @@ -1591,15 +1580,7 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode()
Collections.emptySet(),
clusterSettings
);

verifyRemoteStoreIndexSettings(
indexSettings,
null,
null,
null,
ReplicationType.DOCUMENT.toString(),
IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL
);
verifyRemoteStoreIndexSettings(indexSettings, null, null, null, ReplicationType.DOCUMENT.toString(), null);

// remote data node
DiscoveryNode remoteDataNode = getRemoteNode();
Expand Down Expand Up @@ -1633,7 +1614,7 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode()
"my-segment-repo-1",
"my-translog-repo-1",
ReplicationType.SEGMENT.toString(),
IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL
null
);

Map<String, String> missingTranslogAttribute = Map.of(REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, "my-segment-repo-1");
Expand Down Expand Up @@ -2241,7 +2222,7 @@ private void verifyRemoteStoreIndexSettings(
assertEquals(isRemoteSegmentEnabled, indexSettings.get(SETTING_REMOTE_STORE_ENABLED));
assertEquals(remoteSegmentRepo, indexSettings.get(SETTING_REMOTE_SEGMENT_STORE_REPOSITORY));
assertEquals(remoteTranslogRepo, indexSettings.get(SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY));
assertEquals(translogBufferInterval, INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.get(indexSettings));
assertEquals(translogBufferInterval, indexSettings.get(INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.getKey()));
}

private DiscoveryNode getRemoteNode() {
Expand Down

0 comments on commit 2931a1c

Please sign in to comment.