use of org.apache.geode.test.dunit.AsyncInvocation in project geode by apache.
the class ParallelGatewaySenderOperationsDUnitTest method testParallelPropagationSenderStartAfterStopOnAccessorNode.
/**
* Normal scenario in which a sender is stopped and then started again on accessor node.
*/
@Test
public void testParallelPropagationSenderStartAfterStopOnAccessorNode() throws Exception {
IgnoredException.addIgnoredException("Broken pipe");
IgnoredException.addIgnoredException("Connection reset");
IgnoredException.addIgnoredException("Unexpected IOException");
Integer[] locatorPorts = createLNAndNYLocators();
Integer lnPort = locatorPorts[0];
Integer nyPort = locatorPorts[1];
createSendersReceiversAndPartitionedRegion(lnPort, nyPort, true, true);
// make sure all the senders are not running on accessor nodes and running on non-accessor nodes
waitForSendersRunning();
// FIRST RUN: now, the senders are started. So, do some of the puts
vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_PR", 200));
// now, stop all of the senders
stopSenders();
Wait.pause(2000);
// SECOND RUN: do some of the puts after the senders are stopped
vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_PR", 1000));
// Region size on remote site should remain same and below the number of puts done in the FIRST
// RUN
vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200));
// start the senders again
startSenderInVMs("ln", vm4, vm5, vm6, vm7);
// Region size on remote site should remain same and below the number of puts done in the FIRST
// RUN
vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(getTestMethodName() + "_PR", 200));
// SECOND RUN: do some more puts
AsyncInvocation async = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_PR", 1000));
async.join();
Wait.pause(5000);
// verify all buckets drained only on non-accessor nodes.
vm4.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
vm5.invoke(() -> WANTestBase.validateParallelSenderQueueAllBucketsDrained("ln"));
// verify the events propagate to remote site
vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_PR", 1000));
}
use of org.apache.geode.test.dunit.AsyncInvocation in project geode by apache.
the class TestFunction method testPrimarySendersOnDifferentVMsPR.
// Uses partitioned regions and conserve-sockets=false
@Test
public void testPrimarySendersOnDifferentVMsPR() throws Exception {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCachesWith(Boolean.FALSE, nyPort, lnPort);
createSerialSenders();
createPartitionedRegions(nyPort);
startSerialSenders();
exerciseWANOperations();
AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> SerialGatewaySenderDistributedDeadlockDUnitTest.doTxPutsPR(getTestMethodName() + "_RR", 100, 1000));
AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
exerciseFunctions();
try {
invVM4transaction.join();
invVM5transaction.join();
invVM4.join();
invVM5.join();
} catch (InterruptedException e) {
e.printStackTrace();
fail();
}
}
use of org.apache.geode.test.dunit.AsyncInvocation in project geode by apache.
the class TestFunction method testPrimarySendersOnDifferentVMsReplicated.
// Uses replicated regions and conserve-sockets=false
@Test
public void testPrimarySendersOnDifferentVMsReplicated() throws Exception {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstPeerLocator(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCachesWith(Boolean.FALSE, nyPort, lnPort);
createSerialSenders();
createReplicatedRegions(nyPort);
// get one primary sender on vm4 and another primary on vm5
// the startup order matters here
startSerialSenders();
// exercise region and gateway operations with different messaging
exerciseWANOperations();
AsyncInvocation invVM4transaction = vm4.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
AsyncInvocation invVM5transaction = vm5.invokeAsync(() -> WANTestBase.doTxPuts(getTestMethodName() + "_RR"));
AsyncInvocation invVM4 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
AsyncInvocation invVM5 = vm5.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
exerciseFunctions();
try {
invVM4transaction.join();
invVM5transaction.join();
invVM4.join();
invVM5.join();
} catch (InterruptedException e) {
e.printStackTrace();
fail();
}
}
use of org.apache.geode.test.dunit.AsyncInvocation in project geode by apache.
the class SerialWANPersistenceEnabledGatewaySenderDUnitTest method testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart2.
/**
* Enable persistence for Region and persistence for GatewaySender. Kill the vm with regions and
* bring that up again. Check if the remote site receives all the event. again? In this case put
* is continuously happening while the vm is down.
*/
@Test
public void testPersistentReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart2() {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCacheInVMs(nyPort, vm2, vm3);
createReceiverInVMs(vm2, vm3);
createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
String firstDStore = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, null, true));
String secondDStore = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, null, true));
LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR", null, isOffHeap()));
vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR", null, isOffHeap()));
startSenderInVMs("ln", vm4, vm5);
vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm4.invoke(() -> WANTestBase.pauseSender("ln"));
vm5.invoke(() -> WANTestBase.pauseSender("ln"));
vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
LogWriterUtils.getLogWriter().info("Completed puts in the region");
// kill the vm
vm4.invoke(() -> WANTestBase.killSender());
vm5.invoke(() -> WANTestBase.killSender());
LogWriterUtils.getLogWriter().info("Killed the sender. ");
// restart the vm
vm4.invoke(() -> WANTestBase.createCache(lnPort));
vm5.invoke(() -> WANTestBase.createCache(lnPort));
vm4.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, firstDStore, true));
LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
vm5.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, secondDStore, true));
LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender("ln"));
LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
vm5.invoke(() -> WANTestBase.startSender("ln"));
LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
try {
inv1.join();
} catch (InterruptedException e) {
fail("Got interrupted exception while waiting for startSender to finish.");
}
Wait.pause(5000);
vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
}
use of org.apache.geode.test.dunit.AsyncInvocation in project geode by apache.
the class SerialWANPersistenceEnabledGatewaySenderDUnitTest method testReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart.
/**
* Enable persistence for GatewaySender, kill the sender and restart it. Check if the remote site
* receives all the event.
*/
@Test
public void testReplicatedRegionWithGatewaySenderPersistenceEnabled_Restart() {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCacheInVMs(nyPort, vm2, vm3);
createReceiverInVMs(vm2, vm3);
createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
String firstDStore = (String) vm4.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, null, true));
String secondDStore = (String) vm5.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, null, true));
LogWriterUtils.getLogWriter().info("The first ds is " + firstDStore);
LogWriterUtils.getLogWriter().info("The first ds is " + secondDStore);
vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR", null, isOffHeap()));
vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR", null, isOffHeap()));
startSenderInVMs("ln", vm4, vm5);
vm4.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm5.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm6.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm7.invoke(() -> WANTestBase.createPersistentReplicatedRegion(getTestMethodName() + "_RR", "ln", isOffHeap()));
vm4.invoke(() -> WANTestBase.pauseSender("ln"));
vm5.invoke(() -> WANTestBase.pauseSender("ln"));
vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR", 1000));
LogWriterUtils.getLogWriter().info("Completed puts in the region");
// verify if the queue has all the events
// vm4.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
// ));
// vm5.invoke(() -> WANTestBase.checkQueueSize( "ln", 1000
// ));
//
// vm2.invoke(() -> WANTestBase.validateRegionSize(
// testName + "_RR", 0 ));
// vm3.invoke(() -> WANTestBase.validateRegionSize(
// testName + "_RR", 0 ));
// kill the vm
vm4.invoke(() -> WANTestBase.killSender());
vm5.invoke(() -> WANTestBase.killSender());
vm6.invoke(() -> WANTestBase.killSender());
vm7.invoke(() -> WANTestBase.killSender());
LogWriterUtils.getLogWriter().info("Killed all the sender. ");
// restart the vm
vm4.invoke(() -> WANTestBase.createCache(lnPort));
vm5.invoke(() -> WANTestBase.createCache(lnPort));
vm4.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, firstDStore, true));
LogWriterUtils.getLogWriter().info("Created the sender.... in vm4 ");
vm5.invoke(() -> WANTestBase.createSenderWithDiskStore("ln", 2, false, 100, 10, false, true, null, secondDStore, true));
LogWriterUtils.getLogWriter().info("Created the sender.... in vm5 ");
AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.startSender("ln"));
LogWriterUtils.getLogWriter().info("Started the sender in vm 4");
vm5.invoke(() -> WANTestBase.startSender("ln"));
LogWriterUtils.getLogWriter().info("Started the sender in vm 5");
try {
inv1.join();
} catch (InterruptedException e) {
fail("Got interrupted exception while waiting for startSender to finish.");
}
Wait.pause(5000);
vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR", 1000));
}
Aggregations