Package com.tangosol.net
Class ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.ConfigurableQuorumPolicy
com.tangosol.net.ConfigurableQuorumPolicy.MembershipQuorumPolicy
com.tangosol.net.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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Action Rules forConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy
static class
Notification is a simple struct carrying the notification info.Nested classes/interfaces inherited from class com.tangosol.net.ConfigurableQuorumPolicy.MembershipQuorumPolicy
ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumListener, ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule
Nested classes/interfaces inherited from class com.tangosol.net.ConfigurableQuorumPolicy
ConfigurableQuorumPolicy.ClusterQuorumPolicy, ConfigurableQuorumPolicy.MembershipQuorumPolicy, ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy, ConfigurableQuorumPolicy.ProxyQuorumPolicy
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionprotected AddressProvider
The recovery address-provider.protected boolean
If set to true, indicates a dynamic active recovery strategy.protected long
The last time disallowed actions were reported.static final int
Bitmask used to encode a distribution action.protected static final int
The highest used bitmask value.static final int
Bitmask used to encode a read action.static final int
Bitmask used to encode a recover action.static final int
Bitmask used to encode a partition restore action.static final int
Bitmask used to encode a write action.Fields inherited from class com.tangosol.net.ConfigurableQuorumPolicy.MembershipQuorumPolicy
m_aRules, m_ruleCurrent, m_service, m_setLeaving
-
Constructor Summary
ConstructorDescriptionPartitionedCacheQuorumPolicy
(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule[] aRule, AddressProvider provider) Construct a PartitionedCacheQuorumPolicy with the specified rule. -
Method Summary
Modifier and TypeMethodDescriptionprotected static int
calculateMinimumNodeCount
(Set<Member> setMembers) Given a set of Member objects, calculate the minimum number of nodes on a single machine.protected int
calculateMinThreshold
(int cLast, float flPct) Calculate the minimum number of storage enabled nodes necessary to proceed with the service recovery.Check if the recovery is allowed for the current membership.protected String
getActionName
(int nMask) Return the string description of the given rule mask.protected Set
Return the set of ownership-enabled members in the associated PartitionedService.int
Calculate and return the current size of the member set that contributes to the quorum for this policy domain.Return the associated PartitionedService.protected PartitionSet
getStalePartitions
(PartitionedService.PartitionRecoveryAction action, PartitionSet partsRecover, PartitionSet partsMissing) Return staled partition set.Return a String that describes the current Quorum state.boolean
Evaluate if the specified action is currently allowed by this policy.protected void
reportDisallowedAction
(int nMaskDisallowed, List<ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy.Notification> listReasons) Report all disallowed actions if the quorum rule has changed.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.protected void
Update the currently applicable quorum rule, possibly changing it to reflect growth or shrinkage of the membership size.Methods inherited from class com.tangosol.net.ConfigurableQuorumPolicy.MembershipQuorumPolicy
configure, getCurrentRule, getLeavingMembers, getQuorumRules, getRule, init, instantiateMemberListener, setCurrentRule, setQuorumRules, setService, toString
Methods inherited from class com.tangosol.net.ConfigurableQuorumPolicy
instantiateClusterPolicy, instantiatePartitionedCachePolicy, instantiateProxyPolicy
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
MASK_DISTRIBUTION
public static final int MASK_DISTRIBUTIONBitmask used to encode a distribution action.- See Also:
-
MASK_RESTORE
public static final int MASK_RESTOREBitmask used to encode a partition restore action.- See Also:
-
MASK_READ
public static final int MASK_READBitmask used to encode a read action.- See Also:
-
MASK_WRITE
public static final int MASK_WRITEBitmask used to encode a write action.- See Also:
-
MASK_RECOVER
public static final int MASK_RECOVERBitmask used to encode a recover action.- See Also:
-
MASK_LAST
protected static final int MASK_LASTThe highest used bitmask value.- See Also:
-
m_apRecovery
The recovery address-provider. -
m_ldtLastReport
protected long m_ldtLastReportThe last time disallowed actions were reported. -
m_fDynamic
protected boolean m_fDynamicIf set to true, indicates a dynamic active recovery strategy.
-
-
Constructor Details
-
PartitionedCacheQuorumPolicy
public PartitionedCacheQuorumPolicy(ConfigurableQuorumPolicy.MembershipQuorumPolicy.QuorumRule[] aRule, AddressProvider provider) Construct a PartitionedCacheQuorumPolicy with the specified rule.- Parameters:
aRule
- the quorum ruleprovider
- the recovery address-provider
-
-
Method Details
-
getOwnershipMemberSet
Return the set of ownership-enabled members in the associated PartitionedService.- Returns:
- the set of ownership-enabled members
-
getService
Return the associated PartitionedService.- Overrides:
getService
in classConfigurableQuorumPolicy.MembershipQuorumPolicy
- Returns:
- the associated PartitionedService
-
checkRecoveryMembership
protected List<ConfigurableQuorumPolicy.PartitionedCacheQuorumPolicy.Notification> checkRecoveryMembership(PartitionedService.PartitionRecoveryAction action) 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
- 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 actionpartsRecover
- the partitions to be recoveredpartsMissing
- 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 sizeflPct
- 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 reportinfo
- the QuorumInfo containing the "last good" membership data- Returns:
- the human readable string with the machine names
-
calculateMinimumNodeCount
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
Return a String that describes the current Quorum state.- Specified by:
getStatusDescription
in classConfigurableQuorumPolicy
- 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 classConfigurableQuorumPolicy.MembershipQuorumPolicy
- Returns:
- the current size
-
isAllowed
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 actionaction
- 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 classConfigurableQuorumPolicy.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 actionlistReasons
- (optional) a list of rejection reasons
-
getActionName
Return the string description of the given rule mask.- Parameters:
nMask
- the bitmask- Returns:
- the string description of the given rule mask
-