Skip to content

Commit

Permalink
Initialize RemoteRoutingTableService when we have RoutingTableRepos
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
  • Loading branch information
shiv0408 committed Sep 4, 2024
1 parent 5bf34d2 commit c83f005
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static boolean isRemoteRoutingTableAttributePresent(Settings settings) {
}

public static boolean isRemoteRoutingTableEnabled(Settings settings) {
return FeatureFlags.isEnabled(REMOTE_PUBLICATION_EXPERIMENTAL) && isRemoteRoutingTableAttributePresent(settings);
return isRemoteRoutingTableAttributePresent(settings);
}

public RepositoriesMetadata getRepositoriesMetadata() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled;

public class RemoteClusterStateServiceTests extends OpenSearchTestCase {

Expand Down Expand Up @@ -485,8 +486,8 @@ public void testWriteFullMetadataInParallelSuccess() throws IOException {
assertThat(manifest.getStateUUID(), is(expectedManifest.getStateUUID()));
assertThat(manifest.getPreviousClusterUUID(), is(expectedManifest.getPreviousClusterUUID()));

assertEquals(7, actionListenerArgumentCaptor.getAllValues().size());
assertEquals(7, writeContextArgumentCaptor.getAllValues().size());
assertEquals(8, actionListenerArgumentCaptor.getAllValues().size());
assertEquals(8, writeContextArgumentCaptor.getAllValues().size());

byte[] writtenBytes = capturedWriteContext.get("metadata")
.getStreamProvider(Integer.MAX_VALUE)
Expand Down Expand Up @@ -722,7 +723,7 @@ public void testWriteIncrementalMetadataSuccess() throws IOException {
eq(false),
eq(Collections.emptyMap()),
eq(false),
eq(Collections.emptyList()),
anyList(),
Mockito.any(StringKeyDiffProvider.class)
);

Expand All @@ -743,7 +744,7 @@ public void testWriteIncrementalMetadataSuccess() throws IOException {
assertThat(manifest.getTemplatesMetadata(), notNullValue());
assertThat(manifest.getCoordinationMetadata(), notNullValue());
assertThat(manifest.getCustomMetadataMap().size(), is(2));
assertThat(manifest.getIndicesRouting().size(), is(0));
assertThat(manifest.getIndicesRouting().size(), is(1));
}

public void testWriteIncrementalMetadataSuccessWhenPublicationEnabled() throws IOException {
Expand Down Expand Up @@ -2642,7 +2643,7 @@ public void testRemoteStateUploadStats() throws IOException {
}

public void testRemoteRoutingTableNotInitializedWhenDisabled() {
if (publicationEnabled) {
if (isRemoteRoutingTableEnabled(settings)) {
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof InternalRemoteRoutingTableService);
} else {
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof NoopRemoteRoutingTableService);
Expand Down

0 comments on commit c83f005

Please sign in to comment.