add Reason to CoordinatedShutdown, #24048

This commit is contained in:
Patrik Nordwall 2017-12-04 12:22:59 +01:00
parent fa3da328be
commit e49acb7daa
6 changed files with 116 additions and 28 deletions

View file

@ -190,7 +190,8 @@ private[cluster] final class ClusterDaemon(settings: ClusterSettings) extends Ac
override def postStop(): Unit = {
clusterShutdown.trySuccess(Done)
if (Cluster(context.system).settings.RunCoordinatedShutdownWhenDown) {
coordShutdown.run()
// if it was stopped due to leaving CoordinatedShutdown was started earlier
coordShutdown.run(CoordinatedShutdown.ClusterDowningReason)
}
}
@ -442,7 +443,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
"shutdown-after-unsuccessful-join-seed-nodes [{}]. Running CoordinatedShutdown.",
seedNodes.mkString(", "), ShutdownAfterUnsuccessfulJoinSeedNodes)
joinSeedNodesDeadline = None
CoordinatedShutdown(context.system).run()
CoordinatedShutdown(context.system).run(CoordinatedShutdown.ClusterDowningReason)
}
def becomeUninitialized(): Unit = {
@ -921,7 +922,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
exitingTasksInProgress = true
logInfo("Exiting, starting coordinated shutdown")
selfExiting.trySuccess(Done)
coordShutdown.run()
coordShutdown.run(CoordinatedShutdown.ClusterLeavingReason)
}
if (talkback) {
@ -1104,7 +1105,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
exitingTasksInProgress = true
logInfo("Exiting (leader), starting coordinated shutdown")
selfExiting.trySuccess(Done)
coordShutdown.run()
coordShutdown.run(CoordinatedShutdown.ClusterLeavingReason)
}
exitingConfirmed = exitingConfirmed.filterNot(removedExitingConfirmed)