Skip to content

Commit ab5091f

Browse files
committed
Fix a couple more tests
Having remote store enabled no longer necessarily implies that remote translog is enabled. Signed-off-by: Michael Froh <[email protected]>
1 parent f28256b commit ab5091f

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,14 @@ public static void updateRemoteStoreSettings(
11831183
.put(SETTING_REMOTE_SEGMENT_STORE_REPOSITORY, segmentRepo);
11841184
if (translogRepo != null) {
11851185
settingsBuilder.put(SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, translogRepo);
1186+
} else if (isMigratingToRemoteStore(clusterSettings)) {
1187+
ValidationException validationException = new ValidationException();
1188+
validationException.addValidationErrors(
1189+
Collections.singletonList(
1190+
"Cluster is migrating to remote store but remote translog is not configured, failing index creation"
1191+
)
1192+
);
1193+
throw new IndexCreationException(indexName, validationException);
11861194
}
11871195
} else {
11881196
ValidationException validationException = new ValidationException();

server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode()
17021702
assertEquals(error.getMessage(), "failed to create index [test-index]");
17031703
assertThat(
17041704
error.getCause().getMessage(),
1705-
containsString("Cluster is migrating to remote store but no remote node found, failing index creation")
1705+
containsString("Cluster is migrating to remote store but remote translog is not configured, failing index creation")
17061706
);
17071707
}
17081708

@@ -1771,6 +1771,7 @@ private IndexMetadata testRemoteCustomData(boolean remoteStoreEnabled, PathType
17711771
Settings.Builder settingsBuilder = Settings.builder();
17721772
if (remoteStoreEnabled) {
17731773
settingsBuilder.put(NODE_ATTRIBUTES.getKey() + REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, "test");
1774+
settingsBuilder.put(NODE_ATTRIBUTES.getKey() + REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY, "test");
17741775
}
17751776
settingsBuilder.put(RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), pathType.toString());
17761777
Settings settings = settingsBuilder.build();

server/src/test/java/org/opensearch/index/seqno/ReplicationTrackerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,7 @@ public void testInSyncIdsAreIgnoredIfNotValidatedByClusterManagerWithRemoteTrans
15701570
Settings settings = Settings.builder()
15711571
.put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT)
15721572
.put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, "true")
1573+
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, "translog-repo")
15731574
.build();
15741575
final ReplicationTracker tracker = newTracker(primaryId, settings);
15751576
tracker.updateFromClusterManager(randomNonNegativeLong(), ids(active.keySet()), routingTable(initializing.keySet(), primaryId));

server/src/test/java/org/opensearch/index/shard/IndexShardTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,7 @@ public void testShardStatsWithRemoteStoreEnabled() throws IOException {
18251825
Settings.builder()
18261826
.put(IndexMetadata.SETTING_REPLICATION_TYPE, "SEGMENT")
18271827
.put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true)
1828+
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, "translog-repo")
18281829
.build()
18291830
);
18301831
RemoteSegmentTransferTracker remoteSegmentTransferTracker = shard.getRemoteStoreStatsTrackerFactory()

server/src/test/java/org/opensearch/index/store/remote/metadata/RemoteSegmentMetadataHandlerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void setup() throws IOException {
5050
.put(IndexMetadata.SETTING_VERSION_CREATED, org.opensearch.Version.CURRENT)
5151
.put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT)
5252
.put(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, true)
53+
.put(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY, "translog-repo")
5354
.build();
5455

5556
indexShard = newStartedShard(false, indexSettings, new NRTReplicationEngineFactory());

0 commit comments

Comments
 (0)