func nodesThatNeedToReincarnate()

in swim/heal_partition.go [64:114]


func nodesThatNeedToReincarnate(MA, MB []Change) (changesForA, changesForB []Change) {
	// Find changes that are alive for B and faulty for A and visa versa.
	for _, b := range MB {
		a, ok := selectMember(MA, b.Address)
		if !ok {
			continue
		}

		// If a node would be overwritten and would stop being pingable, it is
		// not suited for merging.
		if b.isPingable() && a.overrides(b) && !a.isPingable() {
			// take the change in a local variable, this protects to inadvertly
			// changing the type of `a` from a value type to a pointer type.
			var change Change
			change = a

			// Remove the source information from the change. If the source
			// information is present and it is gossiped to the other partition
			// it might cause the partitions to heal before they are in a safe
			// state.
			change.scrubSource()

			// gossip the suspect status
			change.Status = Suspect

			// record the change to be sent to B
			changesForB = append(changesForB, change)
		}

		if a.isPingable() && b.overrides(a) && !b.isPingable() {
			// take the change in a local variable, this protects to inadvertly
			// changing the type of `a` from a value type to a pointer type.
			var change Change
			change = b

			// Remove the source information from the change. If the source
			// information is present and it is gossiped to the other partition
			// it might cause the partitions to heal before they are in a safe
			// state.
			change.scrubSource()

			// gossip the suspect status
			change.Status = Suspect

			// record the change to be sent to A
			changesForA = append(changesForA, change)
		}
	}

	return changesForA, changesForB
}