Fix exiting ordering problem in ClusterSingletonManager, see #3408

* The problem was:
  - first is leaving, second is new oldest
  - two actors subscribe to cluster events, OldestChangedBuffer and ClusterSingletonManager
  - ClusterSingletonManager receives MemberExited(first), and then also MemberRemoved(second)
    before OldestChangedBuffer receives MemberExited(first) and delivers
    OldestChanged(first->second)
  - MemberRemoved(second) is the result of the cluster extension shutdown
  - because ClusterSingletonManager gets the MemberRemoved(second) before the OldestChanged
    it will not send the hand over data to second
  - second becomes new singleton after retry period, as designed, but without hand over data
 * The solution is to check the selfExited flag in Oldest state, similar to what is done
   in WasOldest
 * I considered the alternative to tunnel all member events through same subscriber,
   but that would involve more changes to the code
This commit is contained in:
Patrik Nordwall 2013-05-29 09:11:43 +02:00
parent 8e53a59e84
commit 146e2c0719

View file

@ -571,7 +571,7 @@ class ClusterSingletonManager(
case Some(a) if a == cluster.selfAddress
// already oldest
stay
case Some(a) if removed.contains(a)
case Some(a) if !selfExited && removed.contains(a)
gotoHandingOver(singleton, singletonTerminated, handOverData, None)
case Some(a)
// send TakeOver request in case the new oldest doesn't know previous oldest