public class ParRegUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
diskRecoveryKey |
static int |
EQUAL |
static int |
EQUIVALENT |
protected int |
verifyBucketCopiesBucketId |
protected boolean |
verifyBucketCopiesCompleted |
protected StringBuffer |
verifyBucketCopiesErrStr |
| Constructor and Description |
|---|
ParRegUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
_verifyPrimaries(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies,
boolean logProgress)
Verify there is only one primary per bucket and that the current
VM's view of each bucket's primary agrees.
|
protected static String |
compareBucketMaps(Object dump1,
Object dump2)
Compare the contents of 2 bucket maps.
|
static com.gemstone.gemfire.cache.Region |
createClientRegion(String cacheConfig,
String regionConfig,
String xmlFile)
This differs from ParRegUtil.createRegion() in that it works on the
ClientCache and ClientRegionFactory created regions.
|
static void |
createDiskStoreIfNecessary(String hydraRegionConfigName)
Creates a DiskStore for the given hydra region config name, setting the diskDirs
to existing disk directories if ParRegPrm-recoverFromDisk is true.
|
static com.gemstone.gemfire.cache.Region |
createRegion(String cacheDescriptName,
String regionDescriptName,
String xmlFile)
This differs from util.CacheUtil.createRegion(String, String, String) in
that this can use disk directories previously written to the blackboard
by ParRegUtil.writeDiskDirsToBB and also can call ParRegUtil.createDiskStoreIfNecessary.
|
static void |
doRebalance()
Do a rebalance and verify balance was improved.
|
static void |
doRebalance(com.gemstone.gemfire.cache.GemFireCache cache) |
static void |
dumpAllDataStores(com.gemstone.gemfire.cache.Region aRegion)
Dump all data stores for the given partitioned region.
|
static void |
dumpAllPartitionedRegions()
Dumps all partitioned regions of the current cache in this member.
|
static Boolean[] |
getBucketStatus(com.gemstone.gemfire.cache.Region aRegion,
int bucketId)
Return the current status of the given bucketID in the current jvm.
|
static Object |
getExistingKey(com.gemstone.gemfire.internal.cache.PartitionedRegion parReg,
boolean uniqueKeys,
int numThreads)
Return a random key currently in the given region.
|
static Object |
getExistingKey(com.gemstone.gemfire.cache.Region aRegion,
boolean uniqueKeys,
int numThreads,
boolean useServerKeys)
Return a random key currently in the given region.
|
static List |
getExistingKeys(com.gemstone.gemfire.internal.cache.PartitionedRegion parReg,
boolean uniqueKeys,
int numThreads,
int numKeysToGet)
Return a list of random keys currently in the given region.
|
static List |
getExistingKeys(com.gemstone.gemfire.cache.Region aRegion,
boolean uniqueKeys,
int numThreads,
int numKeysToGet,
boolean useServerKeys)
Return a random key currently in the given region.
|
protected static Object |
getKey(Iterator it,
boolean uniqueKeys,
int numThreads)
Given an iterator on a set of keys, return one of them
honoring uniqueKeys.
|
protected static List |
getKeys(Iterator it,
boolean uniqueKeys,
int numThreads,
int numKeysToGet)
Given an iterator on a set of keys, return a list of them
honoring uniqueKeys.
|
static long |
getLocalSize(com.gemstone.gemfire.cache.Region aRegion)
Use internal hooks to get the number of entries in this VM, but not the
number of entries in the entire partitioned region.
|
static int |
getRegionCountFromClientMetaData()
Get the number of regions from ClientMetadataService
|
static void |
HydraTask_rebalance()
Hydra task to rebalance and verify.
|
static void |
HydraTask_recreateBucketsFromHDFS()
todo@lhughes -- temporary wait to recreate buckets for HDFS data
|
static void |
HydraTask_recreateBucketsFromHDFS(com.gemstone.gemfire.cache.GemFireCache cache) |
static void |
HydraTask_waitForRecovery()
Waits for recovery in the current vm for each root region.
|
static void |
HydraTask_waitForRecovery(com.gemstone.gemfire.cache.GemFireCache cache) |
static void |
registerInterest(com.gemstone.gemfire.cache.Region aRegion)
Register interest with ALL_KEYS, and InterestPolicyResult = KEYS_VALUES
which is equivalent to a full GII.
|
static void |
registerInterest(com.gemstone.gemfire.cache.Region aRegion,
boolean loopUntilSuccess)
Register interest with ALL_KEYS, and InterestPolicyResult = KEYS_VALUES
which is equivalent to a full GII.
|
static void |
validateAfterRecovery(com.gemstone.gemfire.cache.Region reg)
Run validation on the PR after recovery (the PR must contain data)
|
static void |
verifyBucketCopies(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
Internal consistency check for PR; ensure that all copies of the
PR's data are consistent.
|
void |
verifyBucketCopiesBatched(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
Internal consistency check for PR; ensure that all copies of the
PR's data are consistent.
|
static void |
verifyBucketsOnUniqueHosts(com.gemstone.gemfire.cache.Region aRegion)
Verify that each bucket copy is on a different host.
|
static void |
verifyContainsKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
Verify containsKey for the given region and key.
|
static void |
verifyContainsValueForKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
Verify containsValueForKey for the given region and key.
|
static void |
verifyMyValue(Object key,
Object expectedValue,
Object valueToCheck,
int compareStrategy)
Verify that the given object is an instance of ValueHolder
with expectedValue as the myValue field.
|
static void |
verifyPrimaries(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
Verify there is only one primary per bucket and that the current
VM's view of each bucket's primary agrees.
|
static void |
verifyPrimariesWithWait(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
Verify there is only one primary per bucket and that the current
VM's view of each bucket's primary agrees.
|
static void |
verifyPRMetaData(com.gemstone.gemfire.cache.Region aRegion)
Verify consistency for PR metadata.
|
static void |
verifySize(com.gemstone.gemfire.cache.Region aRegion,
int expectedSize)
Verify that the size of the given region is expectedSize.
|
static void |
verifySize(com.gemstone.gemfire.cache.Region aRegion,
int expectedSize,
Map regionSnapshot)
Verify that the size of the given region is expectedSize.
|
protected static void |
verifyValue(Object key,
Object obj1,
Object obj2,
int compareStrategy)
Verify that the two given objects are equal, giving special consideration
to instances of ValueHolder.
|
static void |
writeDiskDirsToBB(com.gemstone.gemfire.cache.Region reg)
For disk tests, write the diskDir names to the blackboard for later use by recovery.
|
public static int EQUAL
public static int EQUIVALENT
protected int verifyBucketCopiesBucketId
protected StringBuffer verifyBucketCopiesErrStr
protected boolean verifyBucketCopiesCompleted
protected static final String diskRecoveryKey
public static Object getExistingKey(com.gemstone.gemfire.cache.Region aRegion, boolean uniqueKeys, int numThreads, boolean useServerKeys)
aRegion - The region to use for getting an existing key (may
or may not be a partitioned region).uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.public static Object getExistingKey(com.gemstone.gemfire.internal.cache.PartitionedRegion parReg, boolean uniqueKeys, int numThreads)
aRegion - The PartitionedRegion to use for getting an existing key.uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.protected static Object getKey(Iterator it, boolean uniqueKeys, int numThreads)
it - An iterator on a set of keys.uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.public static long getLocalSize(com.gemstone.gemfire.cache.Region aRegion)
public static List getExistingKeys(com.gemstone.gemfire.cache.Region aRegion, boolean uniqueKeys, int numThreads, int numKeysToGet, boolean useServerKeys)
aRegion - The region to use for getting an existing key (may
or may not be a partitioned region).uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.numKeysToGet - Return a list of this many keys, or fewer if
there aren't enough keys available.useServerKeys - Use keysOnServer to get existing keys.public static List getExistingKeys(com.gemstone.gemfire.internal.cache.PartitionedRegion parReg, boolean uniqueKeys, int numThreads, int numKeysToGet)
aRegion - The PartitionedRegion to use for getting an existing key.uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.numKeysToGet - Return a list of this many keys, or fewer if
there aren't enough keys available.protected static List getKeys(Iterator it, boolean uniqueKeys, int numThreads, int numKeysToGet)
it - An iterator on a set of keys.uniqueKeys - True if each thread operates on a unique set of keys.numThreads - Used if uniqueKeys is true. This is the number of
threads using uniqueKeys.numKeysToGet - Return a list of this many keys, or fewer if
there aren't enough keys available.public static int getRegionCountFromClientMetaData()
public static void verifyMyValue(Object key, Object expectedValue, Object valueToCheck, int compareStrategy)
key - The key whose value we are checking.expectedValue - The expected myValue field of a ValueHolder in aRegion, or null
if the expected value should be null.valuetoCheck - This is expected to be a ValueHolder or PdxInstance
representing a ValueHolder, whose myValue field compares
to expectedValue, according to comparStrategycompareStrategy - Whether the compare is equals or equivalent (for ValueHolders)TestException - if the result of a get on key does not have the expected value.protected static void verifyValue(Object key, Object obj1, Object obj2, int compareStrategy)
key - The key whose value we are checking.obj1 - One object to compare.obj2 - The other object to compare.compareStrategy - Whether the compare is equals or equivalent (for ValueHolders)TestException - if the result of a get on key does not have the expected value.public static void verifyContainsKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
aRegion - The region to verify.key - The key in aRegion to verify.expected - The expected value of containsKey()TestException - if containsKey() has the wrong valuepublic static void verifyContainsValueForKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
aRegion - The region to verify.key - The key in aRegion to verify.expected - The expected value of containsKey()TestException - if containsValueforKey() has the wrong valuepublic static void verifySize(com.gemstone.gemfire.cache.Region aRegion,
int expectedSize)
aRegion - The region to verify.expectedSize - The expected size of aRegion.TestException - if size() has the wrong valuepublic static void verifySize(com.gemstone.gemfire.cache.Region aRegion,
int expectedSize,
Map regionSnapshot)
aRegion - The region to verify.expectedSize - The expected size of aRegion.TestException - if size() has the wrong valuepublic static void dumpAllDataStores(com.gemstone.gemfire.cache.Region aRegion)
public static void dumpAllPartitionedRegions()
public static void verifyPRMetaData(com.gemstone.gemfire.cache.Region aRegion)
public static void verifyPrimaries(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
numExtraCopies - - The number of expected extra copies
of data for aRegion (in addition to the primary copy).
of data for aRegion. If this is -1, then this will expect
that we have less than full redundancy at the time of this
check.public static void verifyPrimariesWithWait(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
numExtraCopies - - The number of expected extra copies
of data for aRegion (in addition to the primary copy).
If this is -1, then this will expect
that we have less than full redundancy at the time of this
check.public static String _verifyPrimaries(com.gemstone.gemfire.cache.Region aRegion, int numExtraCopies, boolean logProgress)
numExtraCopies - - The number of expected extra copies
of data for aRegion (in addition to the primary copy).
If this is -1, then this will expect
that we have less than full redundancy at the time of this
check.logProgress - If true, then log each bucket as it is verified,
otherwise run silent.public static void verifyBucketCopies(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
aRegion - - A partitioned region.numExtraCopies - - The number of expected extra copies
of data for aRegion (in addition to the primary copy).
If this is -1, then this will expect
that we have less than full redundancy at the time of this
check.public void verifyBucketCopiesBatched(com.gemstone.gemfire.cache.Region aRegion,
int numExtraCopies)
aRegion - - A partitioned region.numExtraCopies - - The number of expected extra copies
of data for aRegion (in addition to the primary copy).
If this is -1, then this will expect
that we have less than full redundancy at the time of this
check.protected static String compareBucketMaps(Object dump1, Object dump2)
map1 - A map of keys/values, ie a bucket.map2 - A map of keys/values, ie a bucket.public static void registerInterest(com.gemstone.gemfire.cache.Region aRegion,
boolean loopUntilSuccess)
aRegion - The region to register interest on.loopUntilSuccess - If true, loop until registerInterest is successful
while allowing remote PartitionOfflineExceptions.public static void registerInterest(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to register interest on.public static void verifyBucketsOnUniqueHosts(com.gemstone.gemfire.cache.Region aRegion)
public static void doRebalance()
public static void doRebalance(com.gemstone.gemfire.cache.GemFireCache cache)
public static void HydraTask_rebalance()
public static void HydraTask_waitForRecovery()
public static void HydraTask_waitForRecovery(com.gemstone.gemfire.cache.GemFireCache cache)
public static void HydraTask_recreateBucketsFromHDFS()
public static void HydraTask_recreateBucketsFromHDFS(com.gemstone.gemfire.cache.GemFireCache cache)
public static void writeDiskDirsToBB(com.gemstone.gemfire.cache.Region reg)
public static void validateAfterRecovery(com.gemstone.gemfire.cache.Region reg)
public static void createDiskStoreIfNecessary(String hydraRegionConfigName)
hydraRegionConfigName - The hydra config name for the region to be
defined for recovery.public static com.gemstone.gemfire.cache.Region createRegion(String cacheDescriptName, String regionDescriptName, String xmlFile)
cacheDescriptName - The name of the cache description to use to create
the cache.regionDescriptName - The name of the region description to use if the
region is created programmatically.xmlFile - The xmlFile to use if the region is created with the xml file.
Note: This can only honor CachePrms.useDeclarativeXmlFile or the xmlFile
parameter if we are not already connected. If we already have a connection
to the distributed system, then creating the cache will use any declarative
xml file used when the connection was established, if any declarative xml file
was set during the connect. See the comments in the code below.public static com.gemstone.gemfire.cache.Region createClientRegion(String cacheConfig, String regionConfig, String xmlFile)
public static Boolean[] getBucketStatus(com.gemstone.gemfire.cache.Region aRegion, int bucketId)
aRegion - The region to get bucket status on.bucketId - The bucket ID of interest.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.