Skip to content

Commit e087272

Browse files
authored
Initialise RemoteRoutingTableService when we have RoutingTable repository configured (opensearch-project#15645)
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
1 parent f7b78d1 commit e087272

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

server/src/main/java/org/opensearch/node/remotestore/RemoteStoreNodeAttribute.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.opensearch.cluster.metadata.RepositoryMetadata;
1414
import org.opensearch.cluster.node.DiscoveryNode;
1515
import org.opensearch.common.settings.Settings;
16-
import org.opensearch.common.util.FeatureFlags;
1716
import org.opensearch.gateway.remote.RemoteClusterStateService;
1817
import org.opensearch.node.Node;
1918
import org.opensearch.repositories.blobstore.BlobStoreRepository;
@@ -29,8 +28,6 @@
2928
import java.util.Set;
3029
import java.util.stream.Collectors;
3130

32-
import static org.opensearch.common.util.FeatureFlags.REMOTE_PUBLICATION_EXPERIMENTAL;
33-
3431
/**
3532
* This is an abstraction for validating and storing information specific to remote backed storage nodes.
3633
*
@@ -202,7 +199,7 @@ private static boolean isRemoteRoutingTableAttributePresent(Settings settings) {
202199
}
203200

204201
public static boolean isRemoteRoutingTableEnabled(Settings settings) {
205-
return FeatureFlags.isEnabled(REMOTE_PUBLICATION_EXPERIMENTAL) && isRemoteRoutingTableAttributePresent(settings);
202+
return isRemoteRoutingTableAttributePresent(settings);
206203
}
207204

208205
public RepositoriesMetadata getRepositoriesMetadata() {

server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX;
152152
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT;
153153
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_ROUTING_TABLE_REPOSITORY_NAME_ATTRIBUTE_KEY;
154+
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled;
154155
import static org.hamcrest.Matchers.anEmptyMap;
155156
import static org.hamcrest.Matchers.equalTo;
156157
import static org.hamcrest.Matchers.is;
@@ -485,8 +486,8 @@ public void testWriteFullMetadataInParallelSuccess() throws IOException {
485486
assertThat(manifest.getStateUUID(), is(expectedManifest.getStateUUID()));
486487
assertThat(manifest.getPreviousClusterUUID(), is(expectedManifest.getPreviousClusterUUID()));
487488

488-
assertEquals(7, actionListenerArgumentCaptor.getAllValues().size());
489-
assertEquals(7, writeContextArgumentCaptor.getAllValues().size());
489+
assertEquals(8, actionListenerArgumentCaptor.getAllValues().size());
490+
assertEquals(8, writeContextArgumentCaptor.getAllValues().size());
490491

491492
byte[] writtenBytes = capturedWriteContext.get("metadata")
492493
.getStreamProvider(Integer.MAX_VALUE)
@@ -722,7 +723,7 @@ public void testWriteIncrementalMetadataSuccess() throws IOException {
722723
eq(false),
723724
eq(Collections.emptyMap()),
724725
eq(false),
725-
eq(Collections.emptyList()),
726+
anyList(),
726727
Mockito.any(StringKeyDiffProvider.class)
727728
);
728729

@@ -743,7 +744,7 @@ public void testWriteIncrementalMetadataSuccess() throws IOException {
743744
assertThat(manifest.getTemplatesMetadata(), notNullValue());
744745
assertThat(manifest.getCoordinationMetadata(), notNullValue());
745746
assertThat(manifest.getCustomMetadataMap().size(), is(2));
746-
assertThat(manifest.getIndicesRouting().size(), is(0));
747+
assertThat(manifest.getIndicesRouting().size(), is(1));
747748
}
748749

749750
public void testWriteIncrementalMetadataSuccessWhenPublicationEnabled() throws IOException {
@@ -2642,7 +2643,7 @@ public void testRemoteStateUploadStats() throws IOException {
26422643
}
26432644

26442645
public void testRemoteRoutingTableNotInitializedWhenDisabled() {
2645-
if (publicationEnabled) {
2646+
if (isRemoteRoutingTableEnabled(settings)) {
26462647
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof InternalRemoteRoutingTableService);
26472648
} else {
26482649
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof NoopRemoteRoutingTableService);

0 commit comments

Comments
 (0)