Skip to content

Commit 610f25e

Browse files
author
David Roberts
committed
Schedule recheck if unassignable tasks exist after cluster state change
1 parent 824ffab commit 610f25e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/src/main/java/org/elasticsearch/persistent/PersistentTasksClusterService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ public void clusterChanged(ClusterChangedEvent event) {
272272
periodicRechecker.cancel();
273273
logger.trace("checking task reassignment for cluster state {}", event.state().getVersion());
274274
reassignPersistentTasks();
275+
} else if (periodicRechecker.isScheduled() == false &&
276+
isAnyTaskUnassigned(event.state().getMetaData().custom(PersistentTasksCustomMetaData.TYPE))) {
277+
// If a task is unassigned but would still be unassigned following this cluster state event then schedule a
278+
// recheck just in case it would be assignable after a change in some condition external to the cluster state
279+
periodicRechecker.rescheduleIfNecessary();
275280
}
276281
}
277282
}

0 commit comments

Comments
 (0)