Remove Exiting/Down node from other DC, #24171
* When leaving/downing the last node in a DC it would not be removed in another DC, since that was only done by the leader in the owning DC (and that is gone). * It should be ok to eagerly remove such nodes also by leaders in other DCs. * Note that gossip is already sent out so for the last node that will be spread to other DC, unless there is a network partition. For that we can't do anything. It will be replaced if joining again.
This commit is contained in:
parent
fb72274b71
commit
2733a26540
2 changed files with 86 additions and 1 deletions
|
|
@ -1062,6 +1062,14 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
|
|||
member.dataCenter == selfDc && member.status == Exiting
|
||||
}
|
||||
|
||||
val removedOtherDc =
|
||||
if (latestGossip.isMultiDc) {
|
||||
latestGossip.members.filter { m ⇒
|
||||
(m.dataCenter != selfDc && removeUnreachableWithMemberStatus(m.status))
|
||||
}
|
||||
} else
|
||||
Set.empty[Member]
|
||||
|
||||
val changedMembers = {
|
||||
val enoughMembers: Boolean = isMinNrOfMembersFulfilled
|
||||
def isJoiningToUp(m: Member): Boolean = (m.status == Joining || m.status == WeaklyUp) && enoughMembers
|
||||
|
|
@ -1091,10 +1099,12 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
|
|||
}
|
||||
|
||||
val updatedGossip: Gossip =
|
||||
if (removedUnreachable.nonEmpty || removedExitingConfirmed.nonEmpty || changedMembers.nonEmpty) {
|
||||
if (removedUnreachable.nonEmpty || removedExitingConfirmed.nonEmpty || changedMembers.nonEmpty ||
|
||||
removedOtherDc.nonEmpty) {
|
||||
|
||||
// replace changed members
|
||||
val removed = removedUnreachable.map(_.uniqueAddress).union(removedExitingConfirmed)
|
||||
.union(removedOtherDc.map(_.uniqueAddress))
|
||||
val newGossip =
|
||||
latestGossip.update(changedMembers).removeAll(removed, System.currentTimeMillis())
|
||||
|
||||
|
|
@ -1120,6 +1130,9 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
|
|||
removedExitingConfirmed.foreach { n ⇒
|
||||
logInfo("Leader is removing confirmed Exiting node [{}]", n.address)
|
||||
}
|
||||
removedOtherDc foreach { m ⇒
|
||||
logInfo("Leader is removing {} node [{}] in DC [{}]", m.status, m.address, m.dataCenter)
|
||||
}
|
||||
|
||||
newGossip
|
||||
} else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue