}
public void testSecondaryDeadlock()
throws Exception {
final TransactionRunner runner = new TransactionRunner(env);
runner.setMaxRetries(MAX_RETRIES);
/*
* This test deadlocks a lot at degree 3 serialization. In debugging
* this I discovered it was not due to phantom prevention per se but
* just to a change in timing.
*/
TransactionConfig txnConfig = new TransactionConfig();
runner.setTransactionConfig(txnConfig);
/*
* A thread to do put() and delete() via the primary, which will lock
* the primary first then the secondary. Uses transactions.
*/
final Thread thread1 = new Thread(new Runnable() {
public void run() {
try {
/* The TransactionRunner performs retries. */
for (int i = 0; i < N_ITERS; i +=1 ) {
runner.run(new TransactionWorker() {
public void doWork() throws Exception {
assertEquals(null, storeMap.put(N_ONE, N_101));
}
});
runner.run(new TransactionWorker() {
public void doWork() throws Exception {
assertEquals(N_101, storeMap.remove(N_ONE));
}
});
}