Search in sources :

Example 6 with BatchException70

use of org.apache.geode.internal.cache.wan.BatchException70 in project geode by apache.

the class ConcurrentWANPropagation_1_DUnitTest method testReplicatedSerialPropagationWithRemoteRegionDestroy2.

/**
   * Two regions configured in local with the same sender and put is in progress on both the
   * regions. Same two regions are configured on remote site as well. One of the two regions is
   * destroyed in the middle on remote site.
   * 
   * @throws Exception
   */
@Test
public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
    // these are part of remote site
    createCacheInVMs(nyPort, vm2, vm3);
    createReceiverInVMs(vm2, vm3);
    // these are part of local site
    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
    // senders are created on local site
    vm4.invoke(() -> WANTestBase.createConcurrentSender("ln", 2, false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD));
    vm5.invoke(() -> WANTestBase.createConcurrentSender("ln", 2, false, 100, 200, false, false, null, true, 5, OrderPolicy.THREAD));
    // create one RR (RR_1) on remote site
    vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
    vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
    // create another RR (RR_2) on remote site
    vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", null, isOffHeap()));
    vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", null, isOffHeap()));
    // start the senders on local site
    startSenderInVMs("ln", vm4, vm5);
    // create one RR (RR_1) on local site
    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm5.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm6.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm7.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    // create another RR (RR_2) on local site
    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm5.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm6.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm7.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    // destroy RR_2 on remote site in the middle
    vm2.invoke(() -> WANTestBase.destroyRegion(getTestMethodName() + "_RR_2"));
    // expected exceptions in the logs
    IgnoredException.addIgnoredException(BatchException70.class.getName());
    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
    // start puts in RR_2 in another thread
    vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR_2", 1000));
    // start puts in RR_1 in another thread
    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR_1", 1000));
    try {
        inv1.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
        fail();
    }
    // though region RR_2 is destroyed, RR_1 should still get all the events put in it
    // in local site
    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 1000));
}
Also used : BatchException70(org.apache.geode.internal.cache.wan.BatchException70) ServerOperationException(org.apache.geode.cache.client.ServerOperationException) AsyncInvocation(org.apache.geode.test.dunit.AsyncInvocation) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 7 with BatchException70

use of org.apache.geode.internal.cache.wan.BatchException70 in project geode by apache.

the class SerialWANPropagationDUnitTest method testReplicatedSerialPropagationWithRemoteRegionDestroy2.

/**
   * Two regions configured in local with the same sender and put is in progress on both the
   * regions. Same two regions are configured on remote site as well. One of the two regions is
   * destroyed in the middle on remote site.
   */
@Test
public void testReplicatedSerialPropagationWithRemoteRegionDestroy2() throws Exception {
    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
    Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
    // these are part of remote site
    createCacheInVMs(nyPort, vm2, vm3);
    createReceiverInVMs(vm2, vm3);
    // these are part of local site
    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
    // senders are created on local site
    vm4.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 200, false, false, null, true));
    vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 200, false, false, null, true));
    // create one RR (RR_1) on remote site
    vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
    vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", null, isOffHeap()));
    // create another RR (RR_2) on remote site
    vm2.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", null, isOffHeap()));
    vm3.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", null, isOffHeap()));
    // start the senders on local site
    startSenderInVMs("ln", vm4, vm5);
    // create one RR (RR_1) on local site
    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm5.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm6.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    vm7.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_1", "ln", isOffHeap()));
    // create another RR (RR_2) on local site
    vm4.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm5.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm6.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    vm7.invoke(() -> WANTestBase.createReplicatedRegion(getTestMethodName() + "_RR_2", "ln", isOffHeap()));
    // destroy RR_2 on remote site in the middle
    vm2.invoke(() -> WANTestBase.destroyRegion(getTestMethodName() + "_RR_2"));
    // expected exceptions in the logs
    IgnoredException.addIgnoredException(BatchException70.class.getName());
    IgnoredException.addIgnoredException(ServerOperationException.class.getName());
    // start puts in RR_2 in another thread
    vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName() + "_RR_2", 1000));
    // start puts in RR_1 in another thread
    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts(getTestMethodName() + "_RR_1", 1000));
    inv1.join();
    // though region RR_2 is destroyed, RR_1 should still get all the events put in it
    // in local site
    vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName() + "_RR_1", 1000));
}
Also used : BatchException70(org.apache.geode.internal.cache.wan.BatchException70) ServerOperationException(org.apache.geode.cache.client.ServerOperationException) AsyncInvocation(org.apache.geode.test.dunit.AsyncInvocation) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Aggregations

BatchException70 (org.apache.geode.internal.cache.wan.BatchException70)7 ServerOperationException (org.apache.geode.cache.client.ServerOperationException)6 AsyncInvocation (org.apache.geode.test.dunit.AsyncInvocation)6 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)6 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)6 Test (org.junit.Test)6 CacheException (org.apache.geode.cache.CacheException)2 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 CancelException (org.apache.geode.CancelException)1 CacheClosedException (org.apache.geode.cache.CacheClosedException)1 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)1 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)1 DestroyOperationContext (org.apache.geode.cache.operations.DestroyOperationContext)1 PutOperationContext (org.apache.geode.cache.operations.PutOperationContext)1 DistributedSystem (org.apache.geode.distributed.DistributedSystem)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 StringId (org.apache.geode.i18n.StringId)1 EventID (org.apache.geode.internal.cache.EventID)1