public class BridgeConflictTest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
MULTI_THREADS_PER_ONE_VM |
protected static String |
NOT_IN_TRANS |
protected static int |
ONE_THREAD_PER_MULTI_VMS |
protected int |
testConfiguration |
static BridgeConflictTest |
testInstance |
protected static int |
UNDEFINED |
| Constructor and Description |
|---|
BridgeConflictTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkTxSet(OpList ops)
Check that the current value of the tx set for this thread (the set of
keys that have been read or written during this tx) matches the set of
keys specified in the oplist.
|
protected boolean |
clientIsEmpty(String clientName)
Determines if given client has overridden dataPolicy (using TxPrms-viewDataPolicies) with
DataPolicy.EMPTY.
|
protected void |
concConflictTest() |
protected OpList |
doOps(OpList opList,
int numOps,
boolean targetSame)
Method that will execute operation(s) that either intentionaly write
or not write to regions and/or keys in opList.
|
protected Operation |
doOpWithDifferent(OpList opList,
Operation operation)
Execute an operation that does not operation on the same region/key
as any operation in opList.
|
protected Operation |
doOpWithSame(Operation operation)
Given an operation, execute an operation that involves that same
key and/or region.
|
protected boolean |
entryOpConflictsWith(OpList opList,
String regionName,
Object key)
Determine if an entry operation with the given region and key will conflict
with any operation in the operation list.
|
protected boolean |
executeInTx()
Return a deciscion on whether or not this configuration supports the 2nd
(conflicting thread) running in a tx.
|
protected boolean |
getCommitStatusRR(OpList readOps,
OpList t1_ops,
OpList newOps,
boolean readOpsContainsRR)
This writes expected commit status to the blackboard for tests that
are testing repeatable read transactions.
|
protected static int |
getNumThreads() |
protected static int |
getNumVMs() |
protected Operation |
getWithAnyKey(com.gemstone.gemfire.cache.Region aRegion)
Do a get with any key (existing, previous or new).
|
static void |
HydraTask_concConflictTest()
Hydra task for serial conflict test
|
static void |
HydraTask_endTask()
Hydra task for serial conflict test
|
static void |
HydraTask_initializeConcTest()
Hydra task to create a forest of region hierarchies.
|
static void |
HydraTask_initializeSerialTest()
Hydra task to create a forest of region hierarchies.
|
static void |
HydraTask_serialConflictTest()
Hydra task for serial conflict test with transaction sometimes
|
static void |
HydraTask_serialTxOnlyConflictTest()
Hydra task for serial conflict test with transactions
|
static void |
HydraTask_serialTxOnlyRepeatableRead()
Hydra task for serial conflict test with repeatable read ops
|
protected void |
initialize() |
protected void |
logTxSet()
Log the tx set for this thread (the set of keys that have been read or
written during this tx) matches the set of keys specified in the oplist.
|
protected boolean |
op1HasConflict(Operation op1,
Operation op2,
boolean op2InTrans,
StringBuffer logStr)
Assuming that
1) thread1 did op1 (always in a transaction)
2) thread2 did op2
determine if thread1 would have a conflict if it tried to commit first.
|
protected boolean |
op2HasConflict(Operation op1,
Operation op2,
StringBuffer logStr)
Assuming that
1) thread1 did op1
2) thread2 did op2
determine if thread2 would have a conflict if it tried to commit,
assuming that thread1 successfully committed first.
|
protected Operation |
putNewOrPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
Given a region, create a new entry by randomly choosing either a new
or previously used key.
|
protected void |
recordCommitStatus(boolean inTrans,
OpList priorOps,
OpList newOps)
This writes expected commit status to the blackboard for tests that
run either in or out of a transaction, and use both transactional and
non-transactional operations.
|
protected boolean |
recordCommitStatusTxOnly(OpList priorOps,
OpList newOps)
This writes expected commit status to the blackboard for tests that
run only in transactions and use only transactional (can be rolled back)
operations.
|
protected void |
recordNewOps(OpList priorOps,
OpList newOps)
Given a list of prior ops (done in previous and guaranteed to commit tx)
and a list of ops done in the current transactions, determine if the
new ops override any previous ops (in a last-one-wins fashion), and
modify the priorOps with either replacing a priorOp with a new op
or just adding the new op.
|
protected void |
serialConflictTest()
Do the serial conflict task for transactional and/or non-transactional
threads, and transactional and non-transactional operations (operations
that occur immediately and cannot be rolled back).
|
protected void |
serialTxOnlyConflictTest()
Do the serial conflict task for transactional threads and transactional
operations only (operations can be rolled back).
|
protected void |
serialTxOnlyRepeatableRead()
Do the serial conflict task for transactional threads and transactional
operations only (operations can be rolled back).
|
protected String |
testConfigurationToString()
Return a string representation of the test configuration
|
protected boolean |
thread1HasConflict(OpList opList1,
OpList opList2,
boolean inTrans)
Assuming that
1) thread1 did the operations in opList1 (always in a transaction)
2) thread2 did the operations in opList2
determine if thread1 would have a conflict if it tried to commit first.
|
protected boolean |
thread2HasConflict(OpList opList1,
OpList opList2)
Assuming that
1) thread1 did the operations in opList1 (always in a transaction)
2) thread2 did the operations in opList2 and is in a transaction
determine if thread2 would have a conflict if it tried to commit,
assuming that thread1 successfully committed first.
|
String |
toString()
Return a string representation of the test configuration
|
protected void |
verifyRepeatableReads(OpList readOps,
OpList t1_ops,
OpList newOps,
boolean readOpsContainsRR)
Determines if reads see the correct value.
|
public static BridgeConflictTest testInstance
protected int testConfiguration
protected static final String NOT_IN_TRANS
protected static final int ONE_THREAD_PER_MULTI_VMS
protected static final int MULTI_THREADS_PER_ONE_VM
protected static final int UNDEFINED
public static void HydraTask_initializeConcTest()
public static void HydraTask_initializeSerialTest()
protected static int getNumVMs()
protected static int getNumThreads()
protected void initialize()
public static void HydraTask_serialConflictTest()
public static void HydraTask_serialTxOnlyConflictTest()
public static void HydraTask_serialTxOnlyRepeatableRead()
public static void HydraTask_endTask()
public static void HydraTask_concConflictTest()
protected void concConflictTest()
protected void serialTxOnlyConflictTest()
protected void serialTxOnlyRepeatableRead()
protected void serialConflictTest()
protected OpList doOps(OpList opList, int numOps, boolean targetSame)
opList - A list of operations we want to consider for potential
to intentionally write or not write to same regions/keys.numOps - The number of operations this method should execute.targetSame - True if the operations done by this method should
do operations that use the same regions/keys as opList, false
otherwise.protected Operation doOpWithSame(Operation operation)
Operation - - the operation to base the new operation on.protected Operation doOpWithDifferent(OpList opList, Operation operation)
opList - The list of operations to consider (to avoid
their regions/keys).operation - The operation to consider for not generating
a specific region/key write. This is so we can scrutinize
one particular operation (this should be an operation in
the opList) so the resulting operation can target specific
regions/keys.protected boolean entryOpConflictsWith(OpList opList, String regionName, Object key)
opList - Operations to used to determine conflicts.regionName - The name of a region to consider for conflicts with opList.key - The key for regionName to considert for conflicts with opList.protected Operation putNewOrPreviousKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - Put into this region.protected Operation getWithAnyKey(com.gemstone.gemfire.cache.Region aRegion)
aRegion - The region to do the get on.protected boolean recordCommitStatusTxOnly(OpList priorOps, OpList newOps)
priorOps - The list of operations done by the first thread.newOps - The list of operations done by the second thread (has
only one op).protected boolean getCommitStatusRR(OpList readOps, OpList t1_ops, OpList newOps, boolean readOpsContainsRR)
readOps - The list of operations done by round 1, thread 2.t1_ops - The List of operations done by round 2, thread 1.newOps - The list of operations done by round 2, thread 2.readOpsContainsRR - True if the readOps contained a
repeatable read, false otherwise.protected void verifyRepeatableReads(OpList readOps, OpList t1_ops, OpList newOps, boolean readOpsContainsRR)
readOps - The list of operations done by round 1, thread 2.t1_ops - The List of operations done by round 2, thread 1.newOps - The list of operations done by round 2, thread 2.readOpsContainsRR - True if the readOps contained a
repeatable read, false otherwise.protected void recordCommitStatus(boolean inTrans,
OpList priorOps,
OpList newOps)
inTrans - True if the second thread is in a transaction, false
otherwise. The first thread is always in a transaction.priorOps - The list of operations done by the first thread.newOps - The list of operations done by the second thread (has
only one op).protected boolean thread1HasConflict(OpList opList1, OpList opList2, boolean inTrans)
opList1 - The list of operations done by thread1.opList2 - The list of operations done by thread2.inTrans - True if opList2 was done in a transaction, false otherwise.protected boolean op1HasConflict(Operation op1, Operation op2, boolean op2InTrans, StringBuffer logStr)
op1 - The operation done by thread1.op2 - The operation done by thread2.inTrans - True if op2 was done in a transaction, false otherwise.logStr - A buffer to append any logging to.protected boolean clientIsEmpty(String clientName)
clientName - (for proxySerialConflict tests, 'client1' or 'client2')protected boolean thread2HasConflict(OpList opList1, OpList opList2)
opList1 - The list of operations done by thread1.opList2 - The list of operations done by thread2.protected boolean op2HasConflict(Operation op1, Operation op2, StringBuffer logStr)
op1 - The operation done by thread1.op2 - The operation done by thread2.logStr - A buffer to append any logging to.protected void recordNewOps(OpList priorOps, OpList newOps)
priorOps - The operations done (and guaranteed to commit) by
previous transactions.newOps - The operations done by the current tx and may or may not
successfully commit.protected void checkTxSet(OpList ops)
protected void logTxSet()
protected boolean executeInTx()
public String toString()
protected String testConfigurationToString()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.