Skip to content

Commit 6245758

Browse files
author
Tianli Feng
committed
Revert renaming method onMaster() and offMaster() in interface LocalNodeMasterListener (opensearch-project#3686)
Signed-off-by: Tianli Feng <[email protected]>
1 parent 718ea66 commit 6245758

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

server/src/main/java/org/opensearch/cluster/LocalNodeMasterListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ public interface LocalNodeMasterListener extends ClusterStateListener {
4242
/**
4343
* Called when local node is elected to be the cluster-manager
4444
*/
45-
void onClusterManager();
45+
void onMaster();
4646

4747
/**
4848
* Called when the local node used to be the cluster-manager, a new cluster-manager was elected and it's no longer the local node.
4949
*/
50-
void offClusterManager();
50+
void offMaster();
5151

5252
@Override
5353
default void clusterChanged(ClusterChangedEvent event) {
5454
final boolean wasClusterManager = event.previousState().nodes().isLocalNodeElectedMaster();
5555
final boolean isClusterManager = event.localNodeMaster();
5656
if (wasClusterManager == false && isClusterManager) {
57-
onClusterManager();
57+
onMaster();
5858
} else if (wasClusterManager && isClusterManager == false) {
59-
offClusterManager();
59+
offMaster();
6060
}
6161
}
6262
}

server/src/main/java/org/opensearch/common/settings/ConsistentSettingsService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static final class HashesPublisher implements LocalNodeMasterListener {
258258
}
259259

260260
@Override
261-
public void onClusterManager() {
261+
public void onMaster() {
262262
clusterService.submitStateUpdateTask("publish-secure-settings-hashes", new ClusterStateUpdateTask(Priority.URGENT) {
263263
@Override
264264
public ClusterState execute(ClusterState currentState) {
@@ -284,7 +284,7 @@ public void onFailure(String source, Exception e) {
284284
}
285285

286286
@Override
287-
public void offClusterManager() {
287+
public void offMaster() {
288288
logger.trace("I am no longer cluster-manager, nothing to do");
289289
}
290290
}

server/src/test/java/org/opensearch/cluster/service/ClusterApplierServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,12 @@ public void testLocalNodeClusterManagerListenerCallbacks() {
298298
AtomicBoolean isClusterManager = new AtomicBoolean();
299299
timedClusterApplierService.addLocalNodeMasterListener(new LocalNodeMasterListener() {
300300
@Override
301-
public void onClusterManager() {
301+
public void onMaster() {
302302
isClusterManager.set(true);
303303
}
304304

305305
@Override
306-
public void offClusterManager() {
306+
public void offMaster() {
307307
isClusterManager.set(false);
308308
}
309309
});

server/src/test/java/org/opensearch/common/settings/ConsistentSettingsServiceTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ public void testSingleStringSetting() throws Exception {
7575
// hashes not yet published
7676
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(false));
7777
// publish
78-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onClusterManager();
78+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onMaster();
7979
ConsistentSettingsService consistentService = new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting));
8080
assertThat(consistentService.areAllConsistent(), is(true));
8181
// change value
8282
secureSettings.setString(stringSetting.getKey(), "_TYPO_somethingsecure");
8383
assertThat(consistentService.areAllConsistent(), is(false));
8484
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(false));
8585
// publish change
86-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onClusterManager();
86+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onMaster();
8787
assertThat(consistentService.areAllConsistent(), is(true));
8888
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(true));
8989
}
@@ -108,7 +108,7 @@ public void testSingleAffixSetting() throws Exception {
108108
is(false)
109109
);
110110
// publish
111-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onClusterManager();
111+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onMaster();
112112
ConsistentSettingsService consistentService = new ConsistentSettingsService(
113113
settings,
114114
clusterService,
@@ -123,7 +123,7 @@ public void testSingleAffixSetting() throws Exception {
123123
is(false)
124124
);
125125
// publish change
126-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onClusterManager();
126+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onMaster();
127127
assertThat(consistentService.areAllConsistent(), is(true));
128128
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).areAllConsistent(), is(true));
129129
// add value
@@ -136,7 +136,7 @@ public void testSingleAffixSetting() throws Exception {
136136
is(false)
137137
);
138138
// publish
139-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onClusterManager();
139+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onMaster();
140140
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).areAllConsistent(), is(true));
141141
// remove value
142142
secureSettings = new MockSecureSettings();
@@ -173,7 +173,7 @@ public void testStringAndAffixSettings() throws Exception {
173173
is(false)
174174
);
175175
// publish only the simple string setting
176-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onClusterManager();
176+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).newHashPublisher().onMaster();
177177
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(true));
178178
assertThat(
179179
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).areAllConsistent(),
@@ -184,7 +184,7 @@ public void testStringAndAffixSettings() throws Exception {
184184
is(false)
185185
);
186186
// publish only the affix string setting
187-
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onClusterManager();
187+
new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).newHashPublisher().onMaster();
188188
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(false));
189189
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).areAllConsistent(), is(true));
190190
assertThat(
@@ -193,7 +193,7 @@ public void testStringAndAffixSettings() throws Exception {
193193
);
194194
// publish both settings
195195
new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting, affixStringSetting)).newHashPublisher()
196-
.onClusterManager();
196+
.onMaster();
197197
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(stringSetting)).areAllConsistent(), is(true));
198198
assertThat(new ConsistentSettingsService(settings, clusterService, Arrays.asList(affixStringSetting)).areAllConsistent(), is(true));
199199
assertThat(

0 commit comments

Comments
 (0)