=str #17200 Stop shard region when MemberRemoved

Two issues:

1) ShardRegion actor must stop itself when the node is shutting down,
   ie. when receiving MemberRemoved(selfAddress)
2) ShardCoordinator must not persist anything when the node is shutting
   down. MemberRemoved of other shard regions will trigger Terminated,
   which must not be persisted, because then the next coordinator will
   replay those events and end up in wrong state. This is a problem
   announced itself when using leaving as illustrated in the new test.

To solve the second issue I have added a new ClusterShuttingDown event
that is published before the MemberRemoved events. Note that Terminated
is triggered by MemberRemoved.

(cherry picked from commit 1b272c72597beece9d93f0054f4b58e3d25f9ae2)
This commit is contained in:
Patrik Nordwall 2015-04-15 11:07:12 +02:00
parent db8d02ff06
commit c991d5f1d1
7 changed files with 244 additions and 5 deletions

View file

@ -67,7 +67,7 @@ object ClusterShardingFailureSpec extends MultiNodeConfig {
case m @ Add(id, _) (id, m)
}
val shardResolver: ShardRegion.ShardResolver = msg msg match {
val shardResolver: ShardRegion.ShardResolver = {
case Get(id) id.charAt(0).toString
case Add(id, _) id.charAt(0).toString
}