Skip to content

Commit

Permalink
Cluster manager revert fix (#584)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <[email protected]>
(cherry picked from commit c6f9b20)
  • Loading branch information
amitgalitz authored and github-actions[bot] committed Jun 24, 2022
1 parent 77b0da5 commit c45a5af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ClusterManagerEventListener(
}

@Override
public void onClusterManager() {
public void onMaster() {
if (hourlyCron == null) {
hourlyCron = threadPool.scheduleWithFixedDelay(new HourlyCron(client, nodeFilter), TimeValue.timeValueHours(1), executorName());
clusterService.addLifecycleListener(new LifecycleListener() {
Expand Down Expand Up @@ -88,7 +88,7 @@ public void beforeStop() {
}

@Override
public void offClusterManager() {
public void offMaster() {
cancel(hourlyCron);
cancel(checkpointIndexRetentionCron);
hourlyCron = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public void initCheckpointIndex(ActionListener<CreateIndexResponse> actionListen
}

@Override
public void onClusterManager() {
public void onMaster() {
try {
// try to rollover immediately as we might be restarting the cluster
rolloverAndDeleteHistoryIndex();
Expand All @@ -692,7 +692,7 @@ public void onClusterManager() {
}

@Override
public void offClusterManager() {
public void offMaster() {
if (scheduledRollover != null) {
scheduledRollover.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public void setUp() throws Exception {
}

public void testOnOffMaster() {
clusterManagerService.onClusterManager();
clusterManagerService.onMaster();
assertThat(hourlyCancellable, is(notNullValue()));
assertThat(checkpointIndexRetentionCancellable, is(notNullValue()));
assertTrue(!clusterManagerService.getHourlyCron().isCancelled());
assertTrue(!clusterManagerService.getCheckpointIndexRetentionCron().isCancelled());
clusterManagerService.offClusterManager();
clusterManagerService.offMaster();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
}
Expand All @@ -100,10 +100,10 @@ public void testBeforeStop() {
return null;
}).when(clusterService).addLifecycleListener(any());

clusterManagerService.onClusterManager();
clusterManagerService.onMaster();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
clusterManagerService.offClusterManager();
clusterManagerService.offMaster();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
}
Expand Down

0 comments on commit c45a5af

Please sign in to comment.