From e6068a0f5a8f34c884b2ea79e57619531334787f Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Mon, 22 Aug 2016 15:30:49 +0200 Subject: [PATCH] Fix regression in Cluster Singleton, #21236 * When the test fails the node is removed from the membership twice, which triggers two OldestChanged cycles, but in the 2.4.9 change https://github.com/akka/akka/pull/21152/files#diff-f0ae95c926a050aecf45dba3e08d1c77L669 the singleton manager always goes to End (stop) when it has been Oldest * This fix restores the previous behavior for this scenario --- .../akka/cluster/singleton/ClusterSingletonManager.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/akka-cluster-tools/src/main/scala/akka/cluster/singleton/ClusterSingletonManager.scala b/akka-cluster-tools/src/main/scala/akka/cluster/singleton/ClusterSingletonManager.scala index 42f61ac0e5..848a91bc92 100644 --- a/akka-cluster-tools/src/main/scala/akka/cluster/singleton/ClusterSingletonManager.scala +++ b/akka-cluster-tools/src/main/scala/akka/cluster/singleton/ClusterSingletonManager.scala @@ -608,6 +608,9 @@ class ClusterSingletonManager( // already oldest stay case Some(a) if !selfExited && removed.contains(a) ⇒ + // The member removal was not completed and the old removed node is considered + // oldest again. Safest is to terminate the singleton instance and goto Younger. + // This node will become oldest again when the other is removed again. gotoHandingOver(singleton, singletonTerminated, None) case Some(a) ⇒ // send TakeOver request in case the new oldest doesn't know previous oldest @@ -683,7 +686,9 @@ class ClusterSingletonManager( if (removed.contains(cluster.selfUniqueAddress)) { logInfo("Self removed, stopping ClusterSingletonManager") stop() - } else + } else if (handOverTo.isEmpty) + goto(Younger) using YoungerData(None) + else goto(End) using EndData }