com.continuent.tungsten.common.cluster.resource
Class ClusterMembershipDigest

java.lang.Object
  extended by com.continuent.tungsten.common.cluster.resource.ClusterMembershipDigest

public class ClusterMembershipDigest
extends java.lang.Object

Encapsulates the logic to determine whether a set of members represents a primary partition that may continue to operate as a cluster. This class also includes logic to determine whether the current GC view is consistent and whether the digest itself is valid.


Constructor Summary
ClusterMembershipDigest(java.lang.String name, java.util.Collection<java.lang.String> configuredMembers, java.util.Collection<java.lang.String> viewMembers, java.util.List<java.lang.String> witnessMembers)
          Instantiates a digest used to compute whether the member that creates the digest is in a primary group.
 
Method Summary
 java.util.List<ClusterMember> getConfiguredSetMembers()
          Return definitions of the configured members.
 java.lang.String getName()
          Return name of current member.
 java.util.List<ClusterMember> getQuorumSetMembers()
          Return quorum set members.
 java.util.List<java.lang.String> getQuorumSetNames()
          Return member names from the quorum set.
 java.util.List<java.lang.String> getReachableMemberNames()
          Return reachable member names.
 java.util.List<ClusterMember> getReachableMembers()
          Return the reachable members.
 java.util.List<ClusterMember> getReachableWitnesses()
          Return the reachable witnesses.
 java.util.List<java.lang.String> getReachableWitnessNames()
          Return reachable witness names.
 int getSimpleMajoritySize()
          Return the number of members required to have a simple majority.
 java.util.List<java.lang.String> getValidatedMemberNames()
          Return validated member names.
 java.util.List<ClusterMember> getValidatedMembers()
          Return the validated members.
 java.util.List<ClusterMember> getViewSetMembers()
          Return definitions of the view members.
 java.util.List<ClusterMember> getWitnessSetMembers()
          Return definitions of the witness members.
 boolean isInPrimaryPartition(boolean verbose)
          Determines whether the local manager is in a primary partition, based on validated membership information passed in when this class is instantiated.
 boolean isValidMembership(boolean verbose)
          Returns true if the group membership is valid, which is the case if the following conditions obtain: There is at least 1 member in the group All individual members in the group are validated through a ping
 boolean isValidQuorumSet(boolean verbose)
          Test to see if we have a valid quorum set.
 void setReachable(java.lang.String member, boolean reached)
          Sets the reachability flag on a member.
 void setValidated(java.lang.String member, boolean valid)
          Sets the validation flag on a member.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterMembershipDigest

public ClusterMembershipDigest(java.lang.String name,
                               java.util.Collection<java.lang.String> configuredMembers,
                               java.util.Collection<java.lang.String> viewMembers,
                               java.util.List<java.lang.String> witnessMembers)
Instantiates a digest used to compute whether the member that creates the digest is in a primary group.

Parameters:
name - Name of this member
configuredMembers - Member names from service configuration
viewMembers - Member names from group communications view
witnessMember - Name of the witness host
Method Detail

getName

public java.lang.String getName()
Return name of current member.


getSimpleMajoritySize

public int getSimpleMajoritySize()
Return the number of members required to have a simple majority.


setValidated

public void setValidated(java.lang.String member,
                         boolean valid)
Sets the validation flag on a member.

Parameters:
member - Name of the member that was tested
valid - If true member was validated through GC ping

setReachable

public void setReachable(java.lang.String member,
                         boolean reached)
Sets the reachability flag on a member.

Parameters:
member - Name of the member that was tested
reached - If true member was reached with a network ping command

getQuorumSetMembers

public java.util.List<ClusterMember> getQuorumSetMembers()
Return quorum set members.


getConfiguredSetMembers

public java.util.List<ClusterMember> getConfiguredSetMembers()
Return definitions of the configured members.


getViewSetMembers

public java.util.List<ClusterMember> getViewSetMembers()
Return definitions of the view members.


getWitnessSetMembers

public java.util.List<ClusterMember> getWitnessSetMembers()
Return definitions of the witness members.


getValidatedMembers

public java.util.List<ClusterMember> getValidatedMembers()
Return the validated members.


getReachableMembers

public java.util.List<ClusterMember> getReachableMembers()
Return the reachable members.


getReachableWitnesses

public java.util.List<ClusterMember> getReachableWitnesses()
Return the reachable witnesses.


getQuorumSetNames

public java.util.List<java.lang.String> getQuorumSetNames()
Return member names from the quorum set.


getValidatedMemberNames

public java.util.List<java.lang.String> getValidatedMemberNames()
Return validated member names.


getReachableMemberNames

public java.util.List<java.lang.String> getReachableMemberNames()
Return reachable member names.


getReachableWitnessNames

public java.util.List<java.lang.String> getReachableWitnessNames()
Return reachable witness names.


isValidQuorumSet

public boolean isValidQuorumSet(boolean verbose)
Test to see if we have a valid quorum set. This checks a number of conditions that if violated indicate that the manager is either misconfigured or group communications is misbehaving, which in turn could lead to an invalid computation of quorum.

Returns:
Returns true if the

isInPrimaryPartition

public boolean isInPrimaryPartition(boolean verbose)
Determines whether the local manager is in a primary partition, based on validated membership information passed in when this class is instantiated. A manager is in a primary partition if one of the following conditions is met. If none of the above obtains, the manager is not in a primary partition.

Parameters:
verbose - Logs information about how the determination is being made.
Returns:
true if we are in a primary partition

isValidMembership

public boolean isValidMembership(boolean verbose)
Returns true if the group membership is valid, which is the case if the following conditions obtain: