Challenge/Verify the current Cluster merge strategy
Needs discussion and some more thinking. Is it what we want?
Code:
Code:
/** * Merges two Gossip instances including membership tables, meta-data tables and the VectorClock histories. */ def merge(that: Gossip): Gossip = { import Member.ordering // 1. merge vector clocks val mergedVClock = this.version merge that.version // 2. group all members by Address => Vector[Member] var membersGroupedByAddress = Map.empty[Address, Vector[Member]] (this.members ++ that.members) foreach { m ⇒ val ms = membersGroupedByAddress.get(m.address).getOrElse(Vector.empty[Member]) membersGroupedByAddress += (m.address -> (ms :+ m)) } // 3. merge members by selecting the single Member with highest MemberStatus out of the Member groups val mergedMembers = SortedSet.empty[Member] ++ membersGroupedByAddress.values.foldLeft(Vector.empty[Member]) { (acc, members) ⇒ acc :+ members.reduceLeft(Member.highestPriorityOf(_, _)) } // 4. merge meta-data val mergedMeta = this.meta ++ that.meta // 5. merge gossip overview val mergedOverview = GossipOverview( this.overview.seen ++ that.overview.seen, this.overview.unreachable ++ that.overview.unreachable) Gossip(mergedOverview, mergedMembers, mergedMeta, mergedVClock) } /** * Picks the Member with the highest "priority" MemberStatus. */ def highestPriorityOf(m1: Member, m2: Member): Member = (m1.status, m2.status) match { case (Removed, _) ⇒ m1 case (_, Removed) ⇒ m2 case (Down, _) ⇒ m1 case (_, Down) ⇒ m2 case (Exiting, _) ⇒ m1 case (_, Exiting) ⇒ m2 case (Leaving, _) ⇒ m1 case (_, Leaving) ⇒ m2 case (Up, Joining) ⇒ m1 case (Joining, Up) ⇒ m2 case (Joining, Joining) ⇒ m1 case (Up, Up) ⇒ m1 } </code>
Leave a comment
on 2012-06-12 13:11 *
By Patrik Nordwall
merge might result in node existing in both members and unreachable, is that allowed?
merge of unreachable doesn't use highestPriorityOf, which might result in different results depending on who is merging with who, for example the Down status might be lost
merge of unreachable doesn't use highestPriorityOf, which might result in different results depending on who is merging with who, for example the Down status might be lost
on 2012-06-12 15:19 *
By Patrik Nordwall
Assigned to set to Patrik Nordwall
Status changed from New to Accepted
I have started to fix those issues, will continue tomorrow.
What about seen table?
Isn't there a risk that a node removed from seen (downed) is added back?
What about seen table?
Isn't there a risk that a node removed from seen (downed) is added back?
on 2012-06-12 21:10 *
By Jonas Bonér
Yeah. Let's discuss this tomorrow.
on 2012-06-13 07:43 *
By Patrik Nordwall
(In revision:42c5281d5a927882106e478b73dfb1aaea63cdf0) Correct? implementation of merge and other actions, see #2077
Branch: wip-2077-gossip-merge-patriknw
- Merge unreachable using highestPriorityOf
- Avoid merge result in node existing in both members and unreachable
- Fix joining only allowed when !alreadyMember && !isUnreachable (non Down)
- Fix filter bug of unreachable in downing and leaderActions
- Minor cleanups
Branch: wip-2077-gossip-merge-patriknw
on 2012-06-13 09:19 *
By Patrik Nordwall
(In revision:ff5c99a80d4e595dfa7ab2ae585f624e4e4c7f0d) Minor cleanup, based on review comments, see #2077
Branch: wip-2077-gossip-merge-patriknw
Branch: wip-2077-gossip-merge-patriknw
on 2012-06-13 09:19 *
By Patrik Nordwall
(In revision:f3d9f9c4e80e5f521baf4fa279b7de21ccd34b0c) Merge seen table by starting with empty seen after merge, see #2077
Branch: wip-2077-gossip-merge-patriknw
Branch: wip-2077-gossip-merge-patriknw
on 2012-06-13 13:31 *
By Patrik Nordwall
(In revision:5b89d25c37fc7836e4082f581c87feedb6f89410) Add invariant assertions to Gossip, see #2077
Branch: wip-2077-gossip-merge-patriknw
- Add doc about how members are "moved"
Branch: wip-2077-gossip-merge-patriknw
on 2012-06-13 15:04 *
By Patrik Nordwall
(In revision:391e63332908a7a4b06970592094fbb54072b23c) Improve docs based on feedback, see #2077
Branch: wip-2077-gossip-merge-patriknw
Branch: wip-2077-gossip-merge-patriknw
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:42c5281d5a927882106e478b73dfb1aaea63cdf0) Correct? implementation of merge and other actions, see #2077
Branch: master
- Merge unreachable using highestPriorityOf
- Avoid merge result in node existing in both members and unreachable
- Fix joining only allowed when !alreadyMember && !isUnreachable (non Down)
- Fix filter bug of unreachable in downing and leaderActions
- Minor cleanups
Branch: master
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:ff5c99a80d4e595dfa7ab2ae585f624e4e4c7f0d) Minor cleanup, based on review comments, see #2077
Branch: master
Branch: master
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:f3d9f9c4e80e5f521baf4fa279b7de21ccd34b0c) Merge seen table by starting with empty seen after merge, see #2077
Branch: master
Branch: master
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:5b89d25c37fc7836e4082f581c87feedb6f89410) Add invariant assertions to Gossip, see #2077
Branch: master
- Add doc about how members are "moved"
Branch: master
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:391e63332908a7a4b06970592094fbb54072b23c) Improve docs based on feedback, see #2077
Branch: master
Branch: master
on 2012-06-13 15:39 *
By Patrik Nordwall
(In revision:567c25df5c729440bfb225cbc45370c82b6e7d21) Merge pull request #537 from akka/wip-2077-gossip-merge-patriknw
Correct? implementation of merge and other actions, see #2077
Branch: master
Correct? implementation of merge and other actions, see #2077
Branch: master
on 2012-06-14 07:18 *
By Patrik Nordwall
(In revision:42c5281d5a927882106e478b73dfb1aaea63cdf0) Correct? implementation of merge and other actions, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
- Merge unreachable using highestPriorityOf
- Avoid merge result in node existing in both members and unreachable
- Fix joining only allowed when !alreadyMember && !isUnreachable (non Down)
- Fix filter bug of unreachable in downing and leaderActions
- Minor cleanups
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-14 07:18 *
By Patrik Nordwall
(In revision:ff5c99a80d4e595dfa7ab2ae585f624e4e4c7f0d) Minor cleanup, based on review comments, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-14 07:18 *
By Patrik Nordwall
(In revision:f3d9f9c4e80e5f521baf4fa279b7de21ccd34b0c) Merge seen table by starting with empty seen after merge, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-14 07:18 *
By Patrik Nordwall
(In revision:5b89d25c37fc7836e4082f581c87feedb6f89410) Add invariant assertions to Gossip, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
- Add doc about how members are "moved"
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-14 07:19 *
By Patrik Nordwall
(In revision:391e63332908a7a4b06970592094fbb54072b23c) Improve docs based on feedback, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-14 07:19 *
By Patrik Nordwall
(In revision:567c25df5c729440bfb225cbc45370c82b6e7d21) Merge pull request #537 from akka/wip-2077-gossip-merge-patriknw
Correct? implementation of merge and other actions, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
Correct? implementation of merge and other actions, see #2077
Branch: wip-2218-test-conductor-barrier-timeouts
on 2012-06-20 09:29 *
By Patrik Nordwall
(In revision:42c5281d5a927882106e478b73dfb1aaea63cdf0) Correct? implementation of merge and other actions, see #2077
Branch: wip-scala210M4-√
- Merge unreachable using highestPriorityOf
- Avoid merge result in node existing in both members and unreachable
- Fix joining only allowed when !alreadyMember && !isUnreachable (non Down)
- Fix filter bug of unreachable in downing and leaderActions
- Minor cleanups
Branch: wip-scala210M4-√
on 2012-06-20 09:30 *
By Patrik Nordwall
(In revision:ff5c99a80d4e595dfa7ab2ae585f624e4e4c7f0d) Minor cleanup, based on review comments, see #2077
Branch: wip-scala210M4-√
Branch: wip-scala210M4-√
on 2012-06-20 09:30 *
By Patrik Nordwall
(In revision:f3d9f9c4e80e5f521baf4fa279b7de21ccd34b0c) Merge seen table by starting with empty seen after merge, see #2077
Branch: wip-scala210M4-√
Branch: wip-scala210M4-√
on 2012-06-20 09:31 *
By Patrik Nordwall
(In revision:5b89d25c37fc7836e4082f581c87feedb6f89410) Add invariant assertions to Gossip, see #2077
Branch: wip-scala210M4-√
- Add doc about how members are "moved"
Branch: wip-scala210M4-√
on 2012-06-20 09:31 *
By Patrik Nordwall
(In revision:391e63332908a7a4b06970592094fbb54072b23c) Improve docs based on feedback, see #2077
Branch: wip-scala210M4-√
Branch: wip-scala210M4-√
on 2012-06-20 09:31 *
By Patrik Nordwall
(In revision:567c25df5c729440bfb225cbc45370c82b6e7d21) Merge pull request #537 from akka/wip-2077-gossip-merge-patriknw
Correct? implementation of merge and other actions, see #2077
Branch: wip-scala210M4-√
Correct? implementation of merge and other actions, see #2077
Branch: wip-scala210M4-√
Updating tickets (#620, #679, #725, #750, #752, #753, #754, #763, #789, #870, #893, #922, #953, #954, #971, #977, #983, #985, #987, #991, #1026, #1045, #1051, #1060, #1061, #1084, #1098, #1099, #1133, #1134, #1135, #1136, #1137, #1194, #1225, #1226, #1243, #1245, #1247, #1248, #1254, #1261, #1300, #1317, #1391, #1412, #1791, #1793, #1901, #1908, #1911, #1912, #1913, #1914, #1915, #1916, #1917, #1922, #1983, #1987, #1996, #1997, #1998, #2066, #2077, #2105, #2117, #2133, #2143, #2149, #2151, #2152, #2153, #2155, #2157, #2158, #2159, #2160, #2161, #2162, #2163, #2164, #2165, #2167, #2171, #2175, #2176, #2177, #2180, #2182, #2184, #2185, #2193, #2199, #2202, #2204, #2206, #2207, #2209, #2210)