Package org.jgroups.protocols.pbcast
Class Merger
java.lang.Object
org.jgroups.protocols.pbcast.Merger
Handles merging. Called by CoordGmsImpl and ParticipantGmsImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classStarts the merge protocol (only run by the merge leader). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ResponseCollector<Digest> For GET_DIGEST / DIGEST_RSP correlationprotected final GMSprotected final Logprotected MergeIdprotected final BoundedList<MergeId> protected Future<?> protected final ResponseCollector<MergeData> For MERGE_REQ/MERGE_RSP correlation, contains MergeData elementsprotected final Merger.MergeTask -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_handleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) protected voidcancelMerge(MergeId id) protected static Map<Address, Collection<Address>> determineMergeCoords(Map<Address, View> views) Needs to return a map of all subview coordinators and their views (as a collection of members).protected AddressdetermineMergeLeader(Map<Address, View> views) Returns the address of the merge leaderprotected DigestfetchDigestsFromAllMembersInSubPartition(View view, MergeId merge_id) Multicasts a GET_DIGEST_REQ to all members of this sub partition and waits for all responses (GET_DIGEST_RSP) or N ms.protected voidFetches the digests from all members and installs them again.protected voidvoidhandleDigestResponse(Address sender, Digest digest) voidhandleMergeCancelled(MergeId merge_id) voidhandleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender.voidhandleMergeResponse(MergeData data, MergeId merge_id) voidhandleMergeView(MergeData data, MergeId merge_id) If merge_id is not equal to this.merge_id then discard.booleanbooleanbooleanbooleanmatchMergeId(MergeId id) voidInvoked upon receiving a MERGE event from the MERGE layer.static voidsanitizeViews(Map<Address, View> map) Removes all members from a given view which don't have us in their view (https://issues.redhat.com/browse/JGRP-1061).protected voidsendMergeCancelledMessage(Collection<Address> coords, MergeId merge_id) protected voidsendMergeRejectedResponse(Address sender, MergeId merge_id) protected voidsendMergeResponse(Address sender, View view, Digest digest, MergeId merge_id) Send back a response containing view and digest to senderprotected voidsendMergeView(Collection<Address> coords, MergeData combined_merge_data, MergeId merge_id) Sends the new view and digest to all subgroup coordinators.booleansetMergeId(MergeId expected, MergeId new_value) protected voidprotected voidstop()protected void
-
Field Details
-
gms
-
log
-
merge_task
-
merge_rsps
For MERGE_REQ/MERGE_RSP correlation, contains MergeData elements -
digest_collector
For GET_DIGEST / DIGEST_RSP correlation -
merge_id
-
merge_id_history
-
merge_killer
-
-
Constructor Details
-
Merger
-
-
Method Details
-
getMergeIdAsString
-
getMergeIdHistory
-
isMergeTaskRunning
public boolean isMergeTaskRunning() -
isMergeKillerTaskRunning
public boolean isMergeKillerTaskRunning() -
getMergeId
-
isMergeInProgress
public boolean isMergeInProgress() -
matchMergeId
-
setMergeId
-
merge
Invoked upon receiving a MERGE event from the MERGE layer. Starts the merge protocol. See description of protocol in DESIGN.- Parameters:
views- A List of different views detected by the merge protocol, keyed by sender
-
handleMergeRequest
public void handleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) Get the view and digest and send back both (MergeData) in the form of a MERGE_RSP to the sender. If a merge is already in progress, send back a MergeData with the merge_rejected field set to true.- Parameters:
sender- The address of the merge leadermerge_id- The merge IDmbrs- The set of members from which we expect responses. Guaranteed to be non-null
-
handleMergeResponse
-
handleMergeView
If merge_id is not equal to this.merge_id then discard. Else cast the view/digest to all members of this group. -
handleMergeCancelled
-
handleDigestResponse
-
sanitizeViews
Removes all members from a given view which don't have us in their view (https://issues.redhat.com/browse/JGRP-1061). Example:A: AB B: AB C: ABC
becomesA: AB B: AB C: C // A and B don't have C in their views
- Parameters:
map- A map of members and their associated views
-
determineMergeLeader
Returns the address of the merge leader -
determineMergeCoords
Needs to return a map of all subview coordinators and their views (as a collection of members). The merge policy is defined in https://issues.redhat.com/browse/JGRP-1910 -
_handleMergeRequest
protected void _handleMergeRequest(Address sender, MergeId merge_id, Collection<? extends Address> mbrs) throws Exception - Throws:
Exception
-
sendMergeResponse
Send back a response containing view and digest to sender -
sendMergeView
protected void sendMergeView(Collection<Address> coords, MergeData combined_merge_data, MergeId merge_id) Sends the new view and digest to all subgroup coordinators. Each coord will in turn broadcast the new view and digest to all the members of its subgroup -
sendMergeRejectedResponse
-
sendMergeCancelledMessage
-
fetchDigestsFromAllMembersInSubPartition
Multicasts a GET_DIGEST_REQ to all members of this sub partition and waits for all responses (GET_DIGEST_RSP) or N ms. -
fixDigests
protected void fixDigests()Fetches the digests from all members and installs them again. Used only for diagnosis and support; don't use this otherwise ! -
stop
protected void stop() -
cancelMerge
-
forceCancelMerge
protected void forceCancelMerge() -
startMergeKiller
protected void startMergeKiller() -
stopMergeKiller
protected void stopMergeKiller()
-