Class ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy

All Implemented Interfaces:
ActionPolicy
Enclosing class:
ConfigurableQuorumPolicy

public static class ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy extends ConfigurableQuorumPolicy.MembershipQuorumPolicy
PartitionedCacheQuorumPolicy defines a configurable quorum policy that is applicable to a DistributedCacheService.
  • Field Details

    • MASK_DISTRIBUTION

      public static final int MASK_DISTRIBUTION
      Bitmask used to encode a distribution action.
      See Also:
    • MASK_RESTORE

      public static final int MASK_RESTORE
      Bitmask used to encode a partition restore action.
      See Also:
    • MASK_READ

      public static final int MASK_READ
      Bitmask used to encode a read action.
      See Also:
    • MASK_WRITE

      public static final int MASK_WRITE
      Bitmask used to encode a write action.
      See Also:
    • MASK_RECOVER

      public static final int MASK_RECOVER
      Bitmask used to encode a recover action.
      See Also:
    • MASK_LAST

      protected static final int MASK_LAST
      The highest used bitmask value.
      See Also:
    • m_apRecovery

      protected AddressProvider m_apRecovery
      The recovery address-provider.
    • m_ldtLastReport

      protected long m_ldtLastReport
      The last time disallowed actions were reported.
    • m_fDynamic

      protected boolean m_fDynamic
      If set to true, indicates a dynamic active recovery strategy.
  • Constructor Details

  • Method Details

    • getOwnershipMemberSet

      protected Set getOwnershipMemberSet()
      Return the set of ownership-enabled members in the associated PartitionedService.
      Returns:
      the set of ownership-enabled members
    • getService

      public PartitionedService getService()
      Return the associated PartitionedService.
      Overrides:
      getService in class ConfigurableQuorumPolicy.MembershipQuorumPolicy
      Returns:
      the associated PartitionedService
    • checkRecoveryMembership

      Check if the recovery is allowed for the current membership.
      If the address provider is specified, it means that all the recovery addresses are represented by the ownership-enabled members.
      For dynamic active persistence strategy it means that:
      • Global partition (partition 0) is recoverable.
      • All machines, derived from the global partition, are present.
      • All other partitions are accessible / recoverable across the service members.
      • The number of members is larger than the threshold, which is calculated as a factor of the "last well-formed" member set size
      Note: the implementation *MUST NOT* mutate the action's state (including the resolver's)
      Returns:
      null if the recovery is allowed; otherwise a list of rejection reasons
    • getStalePartitions

      protected PartitionSet getStalePartitions(PartitionedService.PartitionRecoveryAction action, PartitionSet partsRecover, PartitionSet partsMissing)
      Return staled partition set.
      Parameters:
      action - the recovery action
      partsRecover - the partitions to be recovered
      partsMissing - the partitions that are missing
      Returns:
      the staled partitions
    • calculateMinThreshold

      protected int calculateMinThreshold(int cLast, float flPct)
      Calculate the minimum number of storage enabled nodes necessary to proceed with the service recovery.
      Parameters:
      cLast - the "last well-formed" member set size
      flPct - the percentage of "last well-formed" member set size
      Returns:
      the number of nodes necessary for the recovery to commence; the default implementation calculates it as "2/3" of the last "well-formed" member set size.
    • reportLastOwnership

      protected static String reportLastOwnership(PartitionSet parts, com.tangosol.net.internal.QuorumInfo info)
      Report the machine names in the "last good" membership that owned the specified partitions.
      Parameters:
      parts - the partitions to report
      info - the QuorumInfo containing the "last good" membership data
      Returns:
      the human readable string with the machine names
    • calculateMinimumNodeCount

      protected static int calculateMinimumNodeCount(Set<Member> setMembers)
      Given a set of Member objects, calculate the minimum number of nodes on a single machine.
      Parameters:
      setMembers - the member set
      Returns:
      the minimum number of nodes for a machine
    • getStatusDescription

      public String getStatusDescription()
      Return a String that describes the current Quorum state.
      Specified by:
      getStatusDescription in class ConfigurableQuorumPolicy
      Returns:
      a String describing the allowed actions in the current state
    • getPolicyPopulation

      public int getPolicyPopulation()
      Calculate and return the current size of the member set that contributes to the quorum for this policy domain.

      Note: The quorum for PartitionedService is determined by the ownership-enabled members only.

      Overrides:
      getPolicyPopulation in class ConfigurableQuorumPolicy.MembershipQuorumPolicy
      Returns:
      the current size
    • isAllowed

      public boolean isAllowed(Service service, Action action)
      Evaluate if the specified action is currently allowed by this policy.

      Note: for forward compatibility, implementations should generally return true for actions that are not recognized.

      Parameters:
      service - the service that is performing the action
      action - the action that is being performed
      Returns:
      true iff the specified action is currently allowed by this policy
    • updateCurrentRule

      protected void updateCurrentRule()
      Description copied from class: ConfigurableQuorumPolicy.MembershipQuorumPolicy
      Update the currently applicable quorum rule, possibly changing it to reflect growth or shrinkage of the membership size.
      Overrides:
      updateCurrentRule in class ConfigurableQuorumPolicy.MembershipQuorumPolicy
    • reportDisallowedAction

      protected void reportDisallowedAction(int nMaskDisallowed, List<ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy.Notification> listReasons)
      Report all disallowed actions if the quorum rule has changed.
      Parameters:
      nMaskDisallowed - a mask of the disallowed action
      listReasons - (optional) a list of rejection reasons
    • getActionName

      protected String getActionName(int nMask)
      Return the string description of the given rule mask.
      Parameters:
      nMask - the bitmask
      Returns:
      the string description of the given rule mask