Skip to content

Commit

Permalink
Mark node seen task as successful
Browse files Browse the repository at this point in the history
The task for updating cluster state with nodes seen by shutdown was
previously switched to use batched tasks. However, the task is never
marked as complete, which leads to the tasks piling up. This commit
marks the task as complete and re-enables a test that appears to succeed
now.

closes elastic#76689
  • Loading branch information
rjernst committed Mar 19, 2024
1 parent edc45f5 commit 489c4ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public void testShardStatusStaysCompleteAfterNodeLeaves() throws Exception {
* Similar to the previous test, but ensures that the status stays at `COMPLETE` when the node is offline when the shutdown is
* registered. This may happen if {@link NodeSeenService} isn't working as expected.
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/76689")
public void testShardStatusStaysCompleteAfterNodeLeavesIfRegisteredWhileNodeOffline() throws Exception {
assumeTrue("must be on a snapshot build of ES to run in order for the feature flag to be set", Build.current().isSnapshot());
final String nodeToRestartName = internalCluster().startNode();
Expand All @@ -88,11 +87,12 @@ public Settings onNodeStopped(String nodeName) throws Exception {
});

internalCluster().stopNode(nodeToRestartName);
putNodeShutdown(nodeToRestartId, SingleNodeShutdownMetadata.Type.REMOVE, null);

NodesInfoResponse nodes = clusterAdmin().prepareNodesInfo().clear().get();
assertThat(nodes.getNodes().size(), equalTo(1));

assertNodeShutdownStatus(nodeToRestartId, COMPLETE);
assertBusy(() -> { assertNodeShutdownStatus(nodeToRestartId, COMPLETE); });
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public ClusterState execute(BatchExecutionContext<SetSeenNodesShutdownTask> batc
var nodesNotPreviouslySeen = new HashSet<>();
for (final var taskContext : batchExecutionContext.taskContexts()) {
nodesNotPreviouslySeen.addAll(taskContext.getTask().nodesNotPreviouslySeen());
taskContext.success(() -> {});
}

var nodes = initialState.nodes();
Expand Down

0 comments on commit 489c4ed

Please sign in to comment.