Skip to content

Commit 91d4e60

Browse files
committed
Rename isRemoteRoutingTableEnabled method
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
1 parent 27f4ef7 commit 91d4e60

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java

-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
190190
private final RemoteClusterStateService remoteClusterStateService;
191191
private final RemoteStoreNodeService remoteStoreNodeService;
192192
private NodeConnectionsService nodeConnectionsService;
193-
private final RemoteClusterStateService remoteClusterStateService;
194193
private final ClusterSettings clusterSettings;
195194

196195
/**

server/src/main/java/org/opensearch/cluster/routing/remote/InternalRemoteRoutingTableService.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import java.util.function.Supplier;
5050
import java.util.stream.Collectors;
5151

52-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled;
52+
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured;
5353

5454
/**
5555
* A Service which provides APIs to upload and download routing table from remote store.
@@ -76,7 +76,7 @@ public InternalRemoteRoutingTableService(
7676
ThreadPool threadpool,
7777
String clusterName
7878
) {
79-
assert isRemoteRoutingTableEnabled(settings) : "Remote routing table is not enabled";
79+
assert isRemoteRoutingTableConfigured(settings) : "Remote routing table is not enabled";
8080
this.repositoriesService = repositoriesService;
8181
this.settings = settings;
8282
this.threadPool = threadpool;
@@ -234,7 +234,7 @@ protected void doClose() throws IOException {
234234

235235
@Override
236236
protected void doStart() {
237-
assert isRemoteRoutingTableEnabled(settings) == true : "Remote routing table is not enabled";
237+
assert isRemoteRoutingTableConfigured(settings) == true : "Remote routing table is not enabled";
238238
final String remoteStoreRepo = settings.get(
239239
Node.NODE_ATTRIBUTES.getKey() + RemoteStoreNodeAttribute.REMOTE_STORE_ROUTING_TABLE_REPOSITORY_NAME_ATTRIBUTE_KEY
240240
);

server/src/main/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import java.util.function.Supplier;
1717

18-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled;
18+
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured;
1919

2020
/**
2121
* Factory to provide impl for RemoteRoutingTableService based on settings.
@@ -37,7 +37,7 @@ public static RemoteRoutingTableService getService(
3737
ThreadPool threadPool,
3838
String clusterName
3939
) {
40-
if (isRemoteRoutingTableEnabled(settings)) {
40+
if (isRemoteRoutingTableConfigured(settings)) {
4141
return new InternalRemoteRoutingTableService(repositoriesService, settings, clusterSettings, threadPool, clusterName);
4242
}
4343
return new NoopRemoteRoutingTableService();

server/src/main/java/org/opensearch/gateway/remote/RemoteClusterStateService.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
import static org.opensearch.gateway.remote.model.RemoteTransientSettingsMetadata.TRANSIENT_SETTING_METADATA;
114114
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_METADATA_PREFIX;
115115
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteClusterStateConfigured;
116-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled;
116+
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured;
117117
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteStoreClusterStateEnabled;
118118

119119
/**
@@ -279,7 +279,7 @@ public RemoteClusterStateService(
279279
this.isPublicationEnabled = new AtomicBoolean(
280280
clusterSettings.get(REMOTE_PUBLICATION_SETTING)
281281
&& RemoteStoreNodeAttribute.isRemoteStoreClusterStateEnabled(settings)
282-
&& RemoteStoreNodeAttribute.isRemoteRoutingTableEnabled(settings)
282+
&& RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured(settings)
283283
);
284284
clusterSettings.addSettingsUpdateConsumer(REMOTE_PUBLICATION_SETTING, this::setRemotePublicationSetting);
285285
this.remotePathPrefix = CLUSTER_REMOTE_STORE_STATE_PATH_PREFIX.get(settings);
@@ -1126,7 +1126,7 @@ private void setRemotePublicationSetting(boolean remotePublicationSetting) {
11261126
if (remotePublicationSetting == false) {
11271127
this.isPublicationEnabled.set(false);
11281128
} else {
1129-
this.isPublicationEnabled.set(isRemoteStoreClusterStateEnabled(settings) && isRemoteRoutingTableEnabled(settings));
1129+
this.isPublicationEnabled.set(isRemoteStoreClusterStateEnabled(settings) && isRemoteRoutingTableConfigured(settings));
11301130
}
11311131
}
11321132

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private static boolean isRemoteRoutingTableAttributePresent(Settings settings) {
202202
.isEmpty() == false;
203203
}
204204

205-
public static boolean isRemoteRoutingTableEnabled(Settings settings) {
205+
public static boolean isRemoteRoutingTableConfigured(Settings settings) {
206206
return isRemoteRoutingTableAttributePresent(settings);
207207
}
208208

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +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;
154+
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.isRemoteRoutingTableConfigured;
155155
import static org.hamcrest.Matchers.anEmptyMap;
156156
import static org.hamcrest.Matchers.equalTo;
157157
import static org.hamcrest.Matchers.is;
@@ -2755,7 +2755,7 @@ public void testRemoteStateUploadStats() throws IOException {
27552755
}
27562756

27572757
public void testRemoteRoutingTableNotInitializedWhenDisabled() {
2758-
if (isRemoteRoutingTableEnabled(settings)) {
2758+
if (isRemoteRoutingTableConfigured(settings)) {
27592759
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof InternalRemoteRoutingTableService);
27602760
} else {
27612761
assertTrue(remoteClusterStateService.getRemoteRoutingTableService() instanceof NoopRemoteRoutingTableService);

0 commit comments

Comments
 (0)