Search in sources :

Example 31 with FixedPartitionAttributes

use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.

the class FixedPartitioningWithColocationAndPersistenceDUnitTest method testColocation_FPRs_ChildUsingAttributesOfParent.

/**
   * This tests validates that in Customer-Order-shipment colocation, Order and shipment have the
   * FixedPartitionAttributes of the parent region Customer.
   * 
   * Put happens for all 3 regions. Colocation of the data is achieved by using a partition-resolver
   * {@link CustomerFixedPartitionResolver#getRoutingObject(org.apache.geode.cache.EntryOperation)}
   * Also the Fixed Partitioning is achieved using same partition-resolver
   * {@link CustomerFixedPartitionResolver#getPartitionName(org.apache.geode.cache.EntryOperation, java.util.Set)}
   * 
   * Validation are done for the same number of the buckets Validation are done for the same buckets
   * on particular member for all 3 regions.
   * 
   */
@Test
public void testColocation_FPRs_ChildUsingAttributesOfParent() {
    try {
        member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
        member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
        member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
        member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
        FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition("10", true, 5);
        FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
        FixedPartitionAttributes fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
        List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
        fpaList.add(fpa1);
        fpaList.add(fpa2);
        fpaList.add(fpa3);
        member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Customer", fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null, false));
        fpa1 = FixedPartitionAttributes.createFixedPartition("20", true, 5);
        fpa2 = FixedPartitionAttributes.createFixedPartition("30", false, 5);
        fpa3 = FixedPartitionAttributes.createFixedPartition("40", false, 5);
        fpaList.clear();
        fpaList.add(fpa1);
        fpaList.add(fpa2);
        fpaList.add(fpa3);
        member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Customer", fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null, false));
        fpa1 = FixedPartitionAttributes.createFixedPartition("30", true, 5);
        fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
        fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
        fpaList.clear();
        fpaList.add(fpa1);
        fpaList.add(fpa2);
        fpaList.add(fpa3);
        member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Customer", fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null, false));
        fpa1 = FixedPartitionAttributes.createFixedPartition("40", true, 5);
        fpa2 = FixedPartitionAttributes.createFixedPartition("10", false, 5);
        fpa3 = FixedPartitionAttributes.createFixedPartition("20", false, 5);
        fpaList.clear();
        fpaList.add(fpa1);
        fpaList.add(fpa2);
        fpaList.add(fpa3);
        member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Customer", fpaList, 2, 50, 20, new CustomerFixedPartitionResolver(), null, false));
        member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Order", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Customer", false));
        member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Order", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Customer", false));
        member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Order", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Customer", false));
        member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Order", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Customer", false));
        member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Shipment", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order", false));
        member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Shipment", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order", false));
        member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Shipment", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order", false));
        member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Shipment", null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order", false));
        member1.invoke(() -> FixedPartitioningTestBase.checkFPR("Order"));
        member1.invoke(() -> FixedPartitioningTestBase.checkFPR("Shipment"));
        member2.invoke(() -> FixedPartitioningTestBase.checkFPR("Order"));
        member2.invoke(() -> FixedPartitioningTestBase.checkFPR("Shipment"));
        member3.invoke(() -> FixedPartitioningTestBase.checkFPR("Order"));
        member3.invoke(() -> FixedPartitioningTestBase.checkFPR("Shipment"));
        member4.invoke(() -> FixedPartitioningTestBase.checkFPR("Order"));
        member4.invoke(() -> FixedPartitioningTestBase.checkFPR("Shipment"));
        member1.invoke(() -> FixedPartitioningTestBase.putOrderPartitionedRegion("Order"));
        member1.invoke(() -> FixedPartitioningTestBase.putCustomerPartitionedRegion("Customer"));
        member1.invoke(() -> FixedPartitioningTestBase.putShipmentPartitionedRegion("Shipment"));
        member1.invoke(() -> FixedPartitioningTestBase.validateAfterPutPartitionedRegion("Customer", "Order", "Shipment"));
        member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForColocation(15, 5, "Customer", "Order", "Shipment"));
        member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForColocation(15, 5, "Customer", "Order", "Shipment"));
        member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForColocation(15, 5, "Customer", "Order", "Shipment"));
        member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForColocation(15, 5, "Customer", "Order", "Shipment"));
    } catch (Exception e) {
        Assert.fail("Unexpected Exception ", e);
    }
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 32 with FixedPartitionAttributes

use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.

the class FixedPartitioningDUnitTest method testFPR_DefaultNumBuckets.

/**
   * This tests validate that datastore member tries the put on itself as well as other datastores
   * as per primary FixedPartitionAttributes defined on datastores with only one bucket per
   * partition.
   */
@Test
public void testFPR_DefaultNumBuckets() {
    member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, false));
    member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true);
    fpaList.clear();
    fpaList.add(fpa1);
    member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, false));
    member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true);
    fpaList.clear();
    fpaList.add(fpa1);
    member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, false));
    member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true);
    fpaList.clear();
    fpaList.add(fpa1);
    member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, false));
    member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter1));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter2));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryData(Quarter4));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(1, 1));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(1, 1));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(1, 1));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(1, 1));
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 33 with FixedPartitionAttributes

use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.

the class FixedPartitioningDUnitTest method testPut_ValidateDataOnMember_OnlySecondary_Datastore.

/**
   * This tests validate that if only the secondary partitions are available then put should happen
   * successfully for these secondary partitions. These secondary partitions should acts as primary.
   * When the primary partition joins the system then this new member should create the primary
   * buckets for this partition on itself. And Secondary partitions who were holding primary buckets
   * status should now act as secondary buckets.
   * 
   */
@Test
public void testPut_ValidateDataOnMember_OnlySecondary_Datastore() {
    member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    createCacheOnMember();
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false);
    Wait.pause(1000);
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 0));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(3, 3));
    checkPrimaryBucketsForQuarter(3, 3);
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 34 with FixedPartitionAttributes

use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.

the class FixedPartitioningDUnitTest method testPut_ValidateDataOnMember_PrimarySecondary_Datastore_CacheClosed.

/**
   * Datastore = 4 Datastores Primary Secondary Member1 = Q1(0,1,2) Q2(3,4,5) Member2 = Q2(3,4,5)
   * Q3(6,7,8) Member3 = Q3(6,7,8) Q4(9,10,11) Member4 = Q4(9,10,11) Q1(0,1,2) Put happens for all
   * buckets Member 4 goes down, then either member1 or member2 holds primary for member4
   * 
   * Primary Secondary Member1 = Q1(0,1,2) Q2(3,4,5) Member2 = Q2(3,4,5) Q3(6,7,8) Member3 =
   * Q3(6,7,8), Q4(9,10,11)
   * 
   * Put happens considering Member3 is holding primary for Q4.
   * 
   * Member4 comes again, then Memeber4 should do the GII from member2 for buckets 6,7,8 and should
   * acqiure primary status Datastores Primary Secondary Member1 = Q1(0,1,2) Q2(3,4,5) Member2 =
   * Q2(3,4,5) Q3(6,7,8) Member3 = Q3(6,7,8) Q4(9,10,11) Member4 = Q4(9,10,11) Q1(0,1,2)
   */
@Test
public void testPut_ValidateDataOnMember_PrimarySecondary_Datastore_CacheClosed() {
    member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
    member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
    member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
    member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
    member1.invoke(() -> FixedPartitioningTestBase.putThroughDataStore("Quarter"));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, false));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter2, false));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, false));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter4, false));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member4.invoke(() -> FixedPartitioningTestBase.closeCache());
    Wait.pause(1000);
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarterAfterCacheClosed(6, 6));
    member1.invoke(() -> FixedPartitioningTestBase.putHAData("Quarter"));
    member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, false));
    Wait.pause(1000);
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter1, true));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter2, true));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter3, true));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData(Quarter4, true));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(6, 3));
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 35 with FixedPartitionAttributes

use of org.apache.geode.cache.FixedPartitionAttributes in project geode by apache.

the class FixedPartitioningDUnitTest method testPut_ValidateDataOnMember_PrimarySecondary_Accessor_CacheClosed.

/**
   * Accessor =1 Datastore = 4 Datastores Primary Secondary Member1 = Q1(0,1,2) Q3(3,4,5), Q4(6,7,8)
   * Member2 = Q2(9,10,11) Q3(3,4,5), Q4(6,7,8) Member3 = Q3(3,4,5) Q1(0,1,2), Q2(9,10,11) Member4 =
   * Q4(6,7,8) Q1(0,1,2), Q2(9,10,11) Put happens for all buckets Member 4 goes down, then either
   * member1 or member2 holds primary for member4
   * 
   * Primary Secondary Member1 = Q1(0,1,2) Q3(3,4,5), Q4(6,7,8) Member2 = Q2(9,10,11), Q4(6,7,8)
   * Q3(3,4,5) Member3 = Q3(3,4,5) Q1(0,1,2), Q2(9,10,11)
   * 
   * Put happens considering Member2 is holding primary for Q4.
   * 
   * Member4 comes again, then Memeber4 should do the GII from member2 for buckets 6,7,8 and should
   * acqiure primary status Member1 = Q1(0,1,2) Q3(3,4,5), Q4(6,7,8) Member2 = Q2(9,10,11)
   * Q3(3,4,5), Q4(6,7,8) Member3 = Q3(3,4,5) Q1(0,1,2), Q2(9,10,11) Member4 = Q4(6,7,8) Q1(0,1,2),
   * Q2(9,10,11)
   * 
   * 
   */
@Test
public void testPut_ValidateDataOnMember_PrimarySecondary_Accessor_CacheClosed() {
    createCacheOnMember();
    createRegionWithPartitionAttributes("Quarter", null, 3, 0, 12, new QuarterPartitionResolver(), null, false);
    member1.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    FixedPartitionAttributes fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter1, true, 3);
    FixedPartitionAttributes fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    FixedPartitionAttributes fpa3 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    List<FixedPartitionAttributes> fpaList = new ArrayList<FixedPartitionAttributes>();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    fpaList.add(fpa3);
    member1.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member2.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter3, false, 3);
    fpa3 = FixedPartitionAttributes.createFixedPartition(Quarter4, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    fpaList.add(fpa3);
    member2.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member3.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter3, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpa3 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    fpaList.add(fpa3);
    member3.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    member4.invoke(() -> FixedPartitioningTestBase.createCacheOnMember());
    fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter4, true, 3);
    fpa2 = FixedPartitionAttributes.createFixedPartition(Quarter1, false, 3);
    fpa3 = FixedPartitionAttributes.createFixedPartition(Quarter2, false, 3);
    fpaList.clear();
    fpaList.add(fpa1);
    fpaList.add(fpa2);
    fpaList.add(fpa3);
    member4.invoke(() -> FixedPartitioningTestBase.createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12, new QuarterPartitionResolver(), null, false));
    putThroughDataStore("Quarter");
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter1, false));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter2, false));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter3, false));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter4, false));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(9, 3));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(9, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(9, 3));
    member4.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarter(9, 3));
    member4.invoke(() -> FixedPartitioningTestBase.closeCache());
    Wait.pause(1000);
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter1, false));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter2, false));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimarySecondaryData_TwoSecondaries(Quarter3, false));
    member1.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarterAfterCacheClosed(9, 3));
    member2.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarterAfterCacheClosed(9, 3));
    member3.invoke(() -> FixedPartitioningTestBase.checkPrimaryBucketsForQuarterAfterCacheClosed(9, 3));
}
Also used : FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) ArrayList(java.util.ArrayList) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Aggregations

FixedPartitionAttributes (org.apache.geode.cache.FixedPartitionAttributes)63 Test (org.junit.Test)46 ArrayList (java.util.ArrayList)45 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)43 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)30 IgnoredException (org.apache.geode.test.dunit.IgnoredException)16 DuplicatePrimaryPartitionException (org.apache.geode.cache.DuplicatePrimaryPartitionException)15 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)15 PartitionNotAvailableException (org.apache.geode.cache.partition.PartitionNotAvailableException)15 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)12 AttributesFactory (org.apache.geode.cache.AttributesFactory)7 Region (org.apache.geode.cache.Region)6 VM (org.apache.geode.test.dunit.VM)6 Cache (org.apache.geode.cache.Cache)5 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)5 SingleHopQuarterPartitionResolver (org.apache.geode.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver)5 Host (org.apache.geode.test.dunit.Host)5 IOException (java.io.IOException)4 QuarterPartitionResolver (org.apache.geode.internal.cache.partitioned.fixed.QuarterPartitionResolver)4 HashSet (java.util.HashSet)3