Extends collection of shutdown Reasons (e.g. ClusterJoinUnsuccessfulReason) (#26570)

* Adds JoiningSeedNodesUnsuccessfulReason

* Promotes IncompatibleConfigurationDetectedReason to public API

* Rename class after PR comments

* Use a custom exit code on joinUnsuccesful shuhtdown

* Mima

* Scalafmt
This commit is contained in:
Ignasi Marimon-Clos 2019-03-26 14:52:50 +01:00 committed by Patrik Nordwall
parent d390fcf183
commit c097e8144a
4 changed files with 34 additions and 14 deletions

View file

@ -1115,13 +1115,15 @@ akka {
# Only 'exit-jvm', 'exit-code' and 'terminate-actor-system' may be
# overridden depending on the reason.
reason-overrides {
# Overrides are applied using the `reason.getClass.getName`. This
# default overrides the `exit-code` when the `Reason` is a cluster
# Downing event (identified by the object
# "akka.actor.CoordinatedShutdown$ClusterDowningReason$").
# Overrides are applied using the `reason.getClass.getName`.
# Overrides the `exit-code` when the `Reason` is a cluster
# Downing or a Cluster Join Unsuccessful event
"akka.actor.CoordinatedShutdown$ClusterDowningReason$" {
exit-code = -1
}
"akka.actor.CoordinatedShutdown$ClusterJoinUnsuccessfulReason$" {
exit-code = -1
}
}
#//#coordinated-shutdown-phases

View file

@ -140,6 +140,26 @@ object CoordinatedShutdown extends ExtensionId[CoordinatedShutdown] with Extensi
*/
def clusterDowningReason: Reason = ClusterDowningReason
/**
* Scala API: The shutdown was initiated by a failure to join a seed node.
*/
object ClusterJoinUnsuccessfulReason extends Reason
/**
* Java API: The shutdown was initiated by a failure to join a seed node.
*/
def clusterJoinUnsuccessfulReason: Reason = ClusterJoinUnsuccessfulReason
/**
* Scala API: The shutdown was initiated by a configuration clash within the existing cluster and the joining node
*/
case object IncompatibleConfigurationDetectedReason extends Reason
/**
* Java API: The shutdown was initiated by a configuration clash within the existing cluster and the joining node
*/
def incompatibleConfigurationDetectedReason: Reason = IncompatibleConfigurationDetectedReason
/**
* Scala API: The shutdown was initiated by Cluster leaving.
*/

View file

@ -0,0 +1,3 @@
# #26570 Promote IncompatibleConfigurationDetected to public API (moved package and made public)
ProblemFilters.exclude[MissingClassProblem]("akka.cluster.IncompatibleConfigurationDetected")
ProblemFilters.exclude[MissingClassProblem]("akka.cluster.IncompatibleConfigurationDetected$")

View file

@ -501,7 +501,7 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef, joinConfigCompatCh
seedNodes.mkString(", "),
ShutdownAfterUnsuccessfulJoinSeedNodes)
joinSeedNodesDeadline = None
CoordinatedShutdown(context.system).run(CoordinatedShutdown.ClusterDowningReason)
CoordinatedShutdown(context.system).run(CoordinatedShutdown.ClusterJoinUnsuccessfulReason)
}
def becomeUninitialized(): Unit = {
@ -1477,11 +1477,6 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef, joinConfigCompatCh
}
/**
* INTERNAL API.
*/
private[cluster] case object IncompatibleConfigurationDetected extends Reason
/**
* INTERNAL API.
*
@ -1569,7 +1564,7 @@ private[cluster] final class FirstSeedNodeProcess(
"This node will be shutdown!",
messages.mkString(", "))
context.stop(self)
CoordinatedShutdown(context.system).run(IncompatibleConfigurationDetected)
CoordinatedShutdown(context.system).run(CoordinatedShutdown.IncompatibleConfigurationDetectedReason)
}
case InitJoinAck(address, UncheckedConfig) =>
@ -1597,7 +1592,7 @@ private[cluster] final class FirstSeedNodeProcess(
"Note that disabling it will allow the formation of a cluster with nodes having incompatible configuration settings. " +
"This node will be shutdown!")
context.stop(self)
CoordinatedShutdown(context.system).run(IncompatibleConfigurationDetected)
CoordinatedShutdown(context.system).run(CoordinatedShutdown.IncompatibleConfigurationDetectedReason)
}
case InitJoinNack(address) =>
@ -1701,7 +1696,7 @@ private[cluster] final class JoinSeedNodeProcess(
"This node will be shutdown!",
messages.mkString(", "))
context.stop(self)
CoordinatedShutdown(context.system).run(IncompatibleConfigurationDetected)
CoordinatedShutdown(context.system).run(CoordinatedShutdown.IncompatibleConfigurationDetectedReason)
}
case InitJoinAck(address, UncheckedConfig) =>
@ -1728,7 +1723,7 @@ private[cluster] final class JoinSeedNodeProcess(
"Note that disabling it will allow the formation of a cluster with nodes having incompatible configuration settings. " +
"This node will be shutdown!")
context.stop(self)
CoordinatedShutdown(context.system).run(IncompatibleConfigurationDetected)
CoordinatedShutdown(context.system).run(CoordinatedShutdown.IncompatibleConfigurationDetectedReason)
}
case InitJoinNack(_) => // that seed was uninitialized