Here is, step by step, how Hazelcast split brain merge happens:
Each member of the merging cluster will do the following.
Pause.
Each member of the merging cluster rejoins the new cluster and sends a merge request for each of its locally owned map entries. Two important points:
MergePolicy
set for that map. There are built-in merge policies such as PassThroughMergePolicy
, PutIfAbsentMapMergePolicy
, HigherHitsMapMergePolicy
and LatestUpdateMapMergePolicy
. You can develop your own merge policy by implementing com.hazelcast.map.merge.MapMergePolicy
. You should set the full class name of your implementation to the merge-policy
configuration.public interface MergePolicy {
/**
* Returns the value of the entry after the merge
* of entries with the same key. Returning value can be
* You should consider the case where existingEntry is null.
*
* @param mapName name of the map
* @param mergingEntry entry merging into the destination cluster
* @param existingEntry existing entry in the destination cluster
* @return final value of the entry. If returns null then entry will be removed.
*/
Object merge( String mapName, EntryView mergingEntry, EntryView existingEntry );
}