public class AsyncMsgTest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static AsyncMsgTest |
asyncTest |
protected int |
concurrentLeaderTid |
static String |
DIST_ACK_REGION |
static int |
EQUAL |
static int |
EQUIVALENT |
protected int |
maxKeys |
static int |
NO_MIRRORING |
static int |
NO_MIRRORING_KV |
static int |
NO_MIRRORING_RESTRICTION |
protected int |
numPeerThreadsInTest |
static int |
numUpdatesThisRound |
RandomValues |
randomValues |
static String |
REGION_NAME |
static String |
SLEEP_KEY |
| Constructor and Description |
|---|
AsyncMsgTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearDestroyedRegions()
Clear destroyed regions from the blackboard.
|
static void |
clearNumUpdatesThisRound()
clears counter for numUpdatesThisRound
|
Operation |
closeCache()
Closes the cache.
|
void |
createAllDestroyedRegions(boolean fill)
Creates all regions that currently don't exist.
|
void |
createDestroyedRegionsFromBB(boolean fill)
Creates all regions previously destroyed that were recorded in the
AsyncMsgBB shared map entry AsyncMsgBB.DestroyedRegionsKey.
|
static void |
createDistAckRegion()
Creates a distAck region for use in coordinating between publisher and
subscribers.
|
Operation |
createEntry(com.gemstone.gemfire.cache.Region aRegion)
Creates a new key/value in the given region by creating a new
(never-used-before) key and a random value.
|
static void |
createLocatorTask() |
Operation |
createRegion()
Creates a region that was previously destroyed.
|
void |
createRegionHierarchy()
Create a forest of regions based on numRootRegions,
numSubRegions, regionDepth
|
Object[] |
createRegionWithPath(String regionName,
boolean fill)
Given a region name, return the region instance for it.
|
Operation |
destroyEntry(boolean isLocalDestroy,
com.gemstone.gemfire.cache.Region aRegion,
Object key)
Destroys an entry in aRegion.
|
Operation |
destroyRegion(boolean isLocalDestroy,
com.gemstone.gemfire.cache.Region aRegion)
Destroys the given region.
|
void |
dispAllKeys()
Method to traverse tree & display all keys
|
protected void |
doConsumer()
Consumer in a mirrored VM.
|
protected void |
doControlledOperations()
Do random operations by honoring the lower and upper threshold settings.
|
OpList |
doOperations()
Do random operations on random regions using the hydra parameter
AsyncMsgPrms.operations as the list of available operations and
AsyncMsgPrms.numOps as the number of operations to do.
|
OpList |
doOperations(Vector operations,
int numOperationsToDo)
Do random operations on random regions.
|
protected void |
doProducer()
Producer in a non-mirrored VM.
|
void |
doUpdates(com.gemstone.gemfire.cache.Region aRegion)
Do AsyncMsgPrms.numOps updates on an entry in the given region
|
com.gemstone.gemfire.cache.CacheLoader |
getCacheLoader() |
com.gemstone.gemfire.cache.CacheWriter |
getCacheWriter() |
protected com.gemstone.gemfire.distributed.internal.DMStats |
getDMStats() |
Operation |
getEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key,
String opName)
Does a get with the given key.
|
Operation |
getEntryWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a key existing in aRegion.
|
Operation |
getEntryWithNewKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a the next new (never-before_used) key.
|
Operation |
getEntryWithPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
Gets a value in aRegion with a random key that was previously used in the test.
|
BaseValueHolder |
getNewValue(Object key) |
Object |
getRandomKey(com.gemstone.gemfire.cache.Region aRegion)
Get a random key from the given region.
|
Object |
getRandomKey(com.gemstone.gemfire.cache.Region aRegion,
Object excludeKey)
Get a random key from the given region, excluding the key specified
by excludeKey.
|
com.gemstone.gemfire.cache.Region |
getRandomRegion(boolean allowRootRegion)
Return a currently existing random region.
|
com.gemstone.gemfire.cache.Region |
getRandomRegion(boolean allowRootRegion,
com.gemstone.gemfire.cache.Region excludeRegion,
int restriction)
Return a currently existing random region.
|
com.gemstone.gemfire.cache.Region |
getRandomRegionNoMirroring(boolean allowRootRegion)
Return a currently existing random region that is not mirrored, nor
is any of its subregion.
|
com.gemstone.gemfire.cache.Region |
getRandomRegionNoMirroringKV(boolean allowRootRegion)
Return a currently existing random region that is not mirrored with keys/values,
nor is any of its subregions.
|
RegionDefinition |
getRegionDefFromBB(String fullPathOfRegion)
Given a full path for a region, return its RegionDefinition.
|
Map |
getRegionDefMap()
Get a map containing the RegionDefintions for this VM.
|
Set |
getSubregions(com.gemstone.gemfire.cache.Region aRegion,
boolean recursive)
Return a Set of subregions of the given region, while handling
regionDestroyedExceptions.
|
static void |
handlePossibleSlowReceiverException(Exception e)
Check for the possibility we were disconnected because of a slow receiver
|
static void |
HydraTask_asyncMsgVerifyRegionContents()
Hydra task to verify the keys and values in a region using keyIntervals.
|
static void |
HydraTask_checkForConflation()
verify that the publishing thread actually performed asyncConflation
by using the DistributionStats (asyncConflatedMsgs)
|
static void |
HydraTask_createDistAckRegion()
Hydra task method to create a dist ack region.
|
static void |
HydraTask_createRegionForest()
Hydra task to create a forest of region hierarchies.
|
static void |
HydraTask_doConsumer()
Hydra task method for consumer for concurrent tests with verification.
|
static void |
HydraTask_doControlledOperations()
Hydra task method for consumer for concurrent tests with verification.
|
static void |
HydraTask_doOperations()
Do random operations on random regions using the hydra parameter
operations as the list of available operations and
AsyncMsgPrms.numOps as the number of operations to do.
|
static void |
HydraTask_doOperationsWithPrimedQueue()
Do random operations on random regions using the hydra parameter
operations as the list of available operations and
AsyncMsgPrms.numOps as the number of operations to do.
|
static void |
HydraTask_doProducer()
Hydra task method for producer for concurrent tests with verification.
|
static void |
HydraTask_doUpdatesWithPrimedQueue()
Do AsyncMsgPrms.numOps updates on a random region/entry
(after priming the queue for asyncQueuing).
|
static void |
HydraTask_initConsumer()
Creates and initializes the singleton instance of AsyncMsgTest in this VM.
|
static void |
HydraTask_initialize() |
static void |
HydraTask_initProducer()
Creates and initializes the singleton instance of AsyncMsgTest in this VM.
|
static void |
HydraTask_initProducerConsumer()
Creates and initializes the singleton instance of AsyncMsgTest in this VM.
|
static void |
HydraTask_verifyEventCounters()
Hydra task to verify event counters.
|
static void |
HydraTask_verifyNoAsyncBufferWrites()
Hydra task method to ensure that no aync buffer writes have occurred.
|
static void |
HydraTask_verifyNonBlocking()
Hydra task to verify that operations concurrent to getInitialImage
are non-blocking.
|
static void |
HydraTask_verifyQueuedMessages()
Hydra task method to ensure that messages have been queued.
|
static void |
HydraTask_verifyRegionContents()
HydraTask to for validation threads to verify that they have processed
all messages in the OpList (saved in the BBoard by the putter thread
Note that we must conflate the updates (or we'll try to verify intermediate
state.
|
static void |
HydraTask_waitForEventsByPut()
Hydra task method to put into a dist ack region to cause all
slow receivers to catch up.
|
static int |
incNumUpdatesThisRound()
increments numUpdatesThisRound
|
void |
initialize() |
Operation |
invalEntry(boolean isLocalInval,
com.gemstone.gemfire.cache.Region aRegion,
Object key)
Invalidates an entry in aRegion.
|
Operation |
invalRegion(boolean isLocalInval,
com.gemstone.gemfire.cache.Region aRegion)
Invalidates the given region.
|
boolean |
isHierMirrored(com.gemstone.gemfire.cache.Region aRegion)
Return true if the region or any of its subregions is mirrored,
return false otherwise.
|
boolean |
isHierMirroredKV(com.gemstone.gemfire.cache.Region aRegion)
Return true if the region or any of its subregions is mirrored
with keys/values, return false otherwise.
|
static void |
logExecutionNumber()
Log the number of tasks that have been executed in this test.
|
boolean |
messagesQueued() |
com.gemstone.gemfire.cache.Region |
primeQueue()
Prime the Q by putting large objects (for distribution)
use unique keys (so they don't get conflated).
|
Operation |
putEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key,
BaseValueHolder value,
String opName)
Puts a new key/value in the given region.
|
void |
putSleepKey(com.gemstone.gemfire.cache.Region aRegion,
int sleepMs) |
boolean |
queuedMessagesConflated() |
boolean |
queueSizeExceeded() |
boolean |
queueTimeoutExceeded() |
void |
recordDestroyedRegion(com.gemstone.gemfire.cache.Region aRegion)
Save destroyed region(s) in the blackboard.
|
void |
recordRegionDefInBB(String fullPathOfRegion,
RegionDefinition regDef)
Given a full path for a region, and its RegionDefinition instance,
write it to the AsyncMsgBB blackboard shared map.
|
static void |
startLocatorAndAdminDSTask() |
void |
summarizeRegionHier()
Log the regions and the number of keys in each.
|
Operation |
updateEntry(com.gemstone.gemfire.cache.Region aRegion,
Object key)
Updates an existing entry in aRegion.
|
protected static void |
verifyContainsKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
Verify containsKey for the given region and key.
|
protected static void |
verifyContainsValueForKey(com.gemstone.gemfire.cache.Region aRegion,
Object key,
boolean expected)
Verify containsValueForKey for the given region and key.
|
protected void |
verifyFromSnapshot()
Verify this thread's view of the keys and values in the region
by reading the region snapshot and destroyed keys from the blackboad.
|
protected static void |
verifyMyValue(com.gemstone.gemfire.cache.Region aRegion,
Object key,
Object expectedValue,
Object valueToCheck,
int compareStrategy)
Verify that the given object is an instance of ValueHolder
with expectedValue as the myValue field.
|
protected void |
verifyNoAsyncBufferWrites() |
protected void |
verifyQueuedMessages() |
void |
verifyRegionContents() |
static void |
waitForEventsByPut()
Wait for all other vms to process their events by doing a put
into an ack region.
|
protected void |
waitForEventsByTime()
Wait for all threads to report they have not received an event for
NO_EVENTS_MILLIS milliseconds.
|
protected void |
writeSnapshot()
One thread in the producer VM writes the current state of the region
to the blackboard.
|
protected static AsyncMsgTest asyncTest
public RandomValues randomValues
protected int maxKeys
protected int concurrentLeaderTid
protected int numPeerThreadsInTest
public static final String SLEEP_KEY
public static final String DIST_ACK_REGION
public static final int NO_MIRRORING_RESTRICTION
public static final int NO_MIRRORING
public static final int NO_MIRRORING_KV
public static final String REGION_NAME
public static int numUpdatesThisRound
public static int EQUAL
public static int EQUIVALENT
public static void createLocatorTask()
public static void startLocatorAndAdminDSTask()
public static void HydraTask_initialize()
public void initialize()
public static void HydraTask_createRegionForest()
public static void HydraTask_doOperationsWithPrimedQueue()
public static void HydraTask_doUpdatesWithPrimedQueue()
public static void HydraTask_doOperations()
public static void HydraTask_checkForConflation()
public static void HydraTask_initProducer()
public static void HydraTask_initConsumer()
public static void HydraTask_initProducerConsumer()
public static void HydraTask_doProducer()
public static void HydraTask_doConsumer()
public static void HydraTask_doControlledOperations()
public static void HydraTask_verifyQueuedMessages()
public static void HydraTask_verifyNoAsyncBufferWrites()
public static void HydraTask_createDistAckRegion()
public static void HydraTask_waitForEventsByPut()
public static void HydraTask_verifyNonBlocking()
public static void HydraTask_verifyEventCounters()
public static void HydraTask_asyncMsgVerifyRegionContents()
public static void logExecutionNumber()
public static void createDistAckRegion()
public void createRegionHierarchy()
public com.gemstone.gemfire.cache.Region getRandomRegion(boolean allowRootRegion)
allowRootRegion - true if this call can return the root region, false otherwise.public com.gemstone.gemfire.cache.Region getRandomRegionNoMirroring(boolean allowRootRegion)
allowRootRegion - true if this call can return the root region, false otherwise.public com.gemstone.gemfire.cache.Region getRandomRegionNoMirroringKV(boolean allowRootRegion)
allowRootRegion - true if this call can return the root region, false otherwise.public com.gemstone.gemfire.cache.Region getRandomRegion(boolean allowRootRegion,
com.gemstone.gemfire.cache.Region excludeRegion,
int restriction)
allowRootRegion - true if this call can return the root region, false otherwise.excludeRegion - Return a region other than this region, or null if none to exclude.restriction - Restriction on what region can be returned, for example
NO_MIRRORING_RESTRICTION, NO_MIRRORING, NO_MIRRORING_KVpublic void dispAllKeys()
public void summarizeRegionHier()
public void doUpdates(com.gemstone.gemfire.cache.Region aRegion)
public OpList doOperations()
public OpList doOperations(Vector operations, int numOperationsToDo)
operations - - a Vector of operations to choose from.numOperationsToDo - - the number of operations to execute.public Operation createEntry(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to create the new key in.public Operation updateEntry(com.gemstone.gemfire.cache.Region aRegion, Object key)
aRegion - The region to modify a key in.key - The key to modify.public Operation destroyEntry(boolean isLocalDestroy, com.gemstone.gemfire.cache.Region aRegion, Object key)
isLocalDestroy - True if the opertion is a local destroy, false otherwise.aRegion - The region to destroy the entry in.key - The key to destroy.public Operation invalEntry(boolean isLocalInval, com.gemstone.gemfire.cache.Region aRegion, Object key)
isLocalInval - True if the opertion is a local invalidate, false otherwise.aRegion - The region to invalidate the entry in.key - The key to invalidate.public Operation getEntryWithExistingKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation getEntryWithPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation getEntryWithNewKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to get from.public Operation putEntry(com.gemstone.gemfire.cache.Region aRegion, Object key, BaseValueHolder value, String opName)
aRegion - The region to create the new key in.key - The key to use for the put.value - The value to put.opName - The operation to use for the returned tx.Operation instance.public Operation getEntry(com.gemstone.gemfire.cache.Region aRegion, Object key, String opName)
aRegion - The region to create the new key in.key - The key to use for the put.opName - The operation to use for the returned tx.Operation instance.public Operation invalRegion(boolean isLocalInval, com.gemstone.gemfire.cache.Region aRegion)
isLocalInval - True if the opertion is a local invalidate, false otherwise.aRegion - The region to invalidate.public Operation destroyRegion(boolean isLocalDestroy, com.gemstone.gemfire.cache.Region aRegion)
isLocalDestroy - True if the opertion is a local destroy, false otherwise.aRegion - The region to destroy.public Operation createRegion()
public Operation closeCache()
public Object getRandomKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - - The region to get the key from.public Object getRandomKey(com.gemstone.gemfire.cache.Region aRegion, Object excludeKey)
aRegion - - The region to get the key from.excludeKey - - The region to get the key from.public com.gemstone.gemfire.cache.CacheLoader getCacheLoader()
public com.gemstone.gemfire.cache.CacheWriter getCacheWriter()
public BaseValueHolder getNewValue(Object key)
public Object[] createRegionWithPath(String regionName, boolean fill)
regionName - - The full path name of a region.fill - - If true, then fill each created region with entries
according to AsyncMsgPrms.maxEntriespublic void clearDestroyedRegions()
aRegion - The region being destroyed. Save it and all its children.public void recordDestroyedRegion(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region being destroyed. Save it and all its children.public void createDestroyedRegionsFromBB(boolean fill)
fill - True if each newly created region should be populated with
entries according to AsyncMsgPrms.maxKeyspublic void createAllDestroyedRegions(boolean fill)
fill - True if each newly created region should be populated with
entries according to AsyncMsgPrms.maxKeyspublic boolean isHierMirrored(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region parent to test for mirroring.public boolean isHierMirroredKV(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region parent to test for mirroring keys/values.public Set getSubregions(com.gemstone.gemfire.cache.Region aRegion, boolean recursive)
aRegion - - The region to get subregions of.recursive - - If true, return all subregions, otherwise
only aRegion's subregions.public Map getRegionDefMap()
public void recordRegionDefInBB(String fullPathOfRegion, RegionDefinition regDef)
fullPathOfRegion - - the full path of the region to get the key for.regDef - - The RegionDefinition instance for fullPathOfRegion.public RegionDefinition getRegionDefFromBB(String fullPathOfRegion)
fullPathOfRegion - - the full path of the region to get the key for.public static void HydraTask_verifyRegionContents()
public void verifyRegionContents()
public com.gemstone.gemfire.cache.Region primeQueue()
protected com.gemstone.gemfire.distributed.internal.DMStats getDMStats()
protected void verifyQueuedMessages()
protected void verifyNoAsyncBufferWrites()
public boolean messagesQueued()
public boolean queuedMessagesConflated()
public boolean queueSizeExceeded()
public boolean queueTimeoutExceeded()
public void putSleepKey(com.gemstone.gemfire.cache.Region aRegion,
int sleepMs)
protected void doProducer()
protected void doConsumer()
protected void waitForEventsByTime()
public static void waitForEventsByPut()
protected void doControlledOperations()
protected void writeSnapshot()
protected void verifyFromSnapshot()
protected static void verifyMyValue(com.gemstone.gemfire.cache.Region aRegion,
Object key,
Object expectedValue,
Object valueToCheck,
int compareStrategy)
aRegion - The region to verify.key - The key in aRegion to verify.expectedValue - The expected myValue field of a ValueHolder in aRegion, or null
if the expected value should be null.valuetoCheck - The value that is expected to be expectedValue.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.protected 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 valueprotected 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 int incNumUpdatesThisRound()
public static void clearNumUpdatesThisRound()
public static void handlePossibleSlowReceiverException(Exception e)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.