use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.
the class GIIDeltaDUnitTest method testDeltaGIIWithDifferentRVVGC.
/**
* vm0 and vm1 are peers, each holds a DR. create some exception list. Then shutdown R. Do
* tombstone GC at P only. Before GII, P's RVV is P7,R6(3-6), RVVGC is P4,R0; R's RVV is P6,R6,
* RVVGC are both P0,R0 vm1 becomes offline then restarts.
* https://wiki.gemstone.com/display/gfepersistence/DeltaGII+Spec+for+8.0 The deltaGII should send
* delta to R, revoke unfinished opeation R4,R5
*/
@Test
public void testDeltaGIIWithDifferentRVVGC() throws Throwable {
final String testcase = "testDeltaGIIWithExceptionList";
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
final DiskStoreID memberR = getMemberID(R);
final long[] exceptionlist = { 4, 5 };
assertEquals(0, DistributedCacheOperation.SLOW_DISTRIBUTION_MS);
prepareCommonTestData(6);
// P's rvv=p6, gc=0
waitForToVerifyRVV(P, memberP, 6, null, 0);
VersionTag expect_tag = getVersionTag(R, "key5");
createUnfinishedOperationsR4R5();
byte[] R_rvv_bytes = getRVVByteArray(R, REGION_NAME);
closeCache(R);
// force tombstone GC to let RVVGC to become P4:R0
changeTombstoneTimout(R, MAX_WAIT);
changeTombstoneTimout(P, MAX_WAIT);
Wait.pause((int) MAX_WAIT);
forceGC(P, 2);
// P's rvv=p6, gc=4
waitForToVerifyRVV(P, memberP, 6, null, 4);
// p7 only apply at P
doOnePut(P, 7, "key1");
// P's rvv=p7, gc=4
waitForToVerifyRVV(P, memberP, 7, null, 4);
verifyTombstoneExist(P, "key2", false, false);
// restart R and gii
checkIfFullGII(P, REGION_NAME, R_rvv_bytes, false);
createDistributedRegion(R);
// R's rvv=p7, gc=4
waitForToVerifyRVV(R, memberP, 7, null, 4);
// R's rvv=r6, gc=0
waitForToVerifyRVV(R, memberR, 6, exceptionlist, 0);
RegionVersionVector p_rvv = getRVV(P);
RegionVersionVector r_rvv = getRVV(R);
assertSameRVV(p_rvv, r_rvv);
// If fullGII, the key size in gii chunk is 3, i.e. key1,key3,key5. key2 is GCed.
// If delta GII, the key size should be 2, i.e. P7 (key1) and (key5(T) which is unfinished
// operation)
verifyDeltaSizeFromStats(R, 2, 1);
// verify unfinished op for key5 is revoked
waitToVerifyKey(R, "key5", generateValue(R));
VersionTag tag = getVersionTag(R, "key5");
assertTrue(expect_tag.equals(tag));
verifyTombstoneExist(R, "key2", false, false);
verifyTombstoneExist(P, "key2", false, false);
}
use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.
the class GIIDeltaDUnitTest method testSavingRVVGC.
/**
* vm0(P), vm1(R), vm2(T) are peers, each holds a DR. shutdown vm1(R), vm2(T) Let provider to have
* higher RVVGC than requester's RVV when vm1 and vm2 are offline Restart R, It should trigger
* fullGII If R did not save the rvvgc, restarted R will have a way smaller rvvgc (maybe the same
* as T's) Let T requests GII from R, it wll become deltaGII, which is wrong.
*/
@Test
public void testSavingRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
final DiskStoreID memberR = getMemberID(R);
final long[] exceptionlist = { 4, 5 };
Host host = Host.getHost(0);
VM T = host.getVM(2);
createDistributedRegion(T);
final DiskStoreID memberT = getMemberID(T);
assertEquals(0, DistributedCacheOperation.SLOW_DISTRIBUTION_MS);
prepareCommonTestData(3);
// P's rvv=p3, gc=0
waitForToVerifyRVV(P, memberP, 3, null, 0);
// R's rvv=p3, gc=0
waitForToVerifyRVV(R, memberP, 3, null, 0);
// T's rvv=p3, gc=0
waitForToVerifyRVV(T, memberP, 3, null, 0);
closeCache(T);
closeCache(R);
// p4-7 only apply at P
doOneDestroy(P, 4, "key2");
doOnePut(P, 5, "key1");
doOnePut(P, 6, "key3");
doOnePut(P, 7, "key1");
// force tombstone GC to let RVVGC to become P4:R0
forceGC(P, 2);
// restart R and gii, it will be blocked at test hook
createDistributedRegion(R);
// P's rvv=p7, gc=4
waitForToVerifyRVV(P, memberP, 7, null, 4);
// P's rvv=r3, gc=0
waitForToVerifyRVV(P, memberR, 3, null, 0);
// R's rvv=p7, gc=4
waitForToVerifyRVV(R, memberP, 7, null, 4);
// R's rvv=r3, gc=0
waitForToVerifyRVV(R, memberR, 3, null, 0);
// RegionVersionVector p_rvv = getRVV(P);
// RegionVersionVector r_rvv = getRVV(R);
// assertSameRVV(p_rvv, r_rvv);
// In fullGII, the key size in gii chunk is 3, i.e. key1,key3,key5. key2 is GCed.
verifyDeltaSizeFromStats(R, 3, 0);
verifyTombstoneExist(P, "key2", false, false);
verifyTombstoneExist(R, "key2", false, false);
closeCache(P);
closeCache(R);
createDistributedRegion(R);
// R's rvv=p7, gc=4
waitForToVerifyRVV(R, memberP, 7, null, 4);
// R's rvv=r3, gc=0
waitForToVerifyRVV(R, memberR, 3, null, 0);
verifyTombstoneExist(R, "key2", false, false);
createDistributedRegion(T);
// R's rvv=p7, gc=4
waitForToVerifyRVV(T, memberP, 7, null, 4);
// R's rvv=r3, gc=0
waitForToVerifyRVV(T, memberR, 3, null, 0);
// In fullGII, the key size in gii chunk is 3, i.e. key1,key3,key5. key2 is GCed.
verifyDeltaSizeFromStats(T, 3, 0);
verifyTombstoneExist(T, "key2", false, false);
}
use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.
the class GIIDeltaDUnitTest method testRecoveredFromDiskBitAfterDeltaGII.
/**
* P, R has key1 unchanged, make one unfinished operation on R to trigger delta gii.
*/
@Test
public void testRecoveredFromDiskBitAfterDeltaGII() {
prepareForEachTest();
getMemberID(P);
final DiskStoreID memberR = getMemberID(R);
assertEquals(0, DistributedCacheOperation.SLOW_DISTRIBUTION_MS);
verifyRecoveredFromDiskBitAfterGII(memberR, false);
}
use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.
the class GIIDeltaDUnitTest method testRecoveredFromDiskBitAfterFullGII.
/**
* P, R has key1 unchanged, make certain unfinished operations on R to trigger full gii.
*/
@Test
public void testRecoveredFromDiskBitAfterFullGII() {
prepareForEachTest();
getMemberID(P);
final DiskStoreID memberR = getMemberID(R);
assertEquals(0, DistributedCacheOperation.SLOW_DISTRIBUTION_MS);
verifyRecoveredFromDiskBitAfterGII(memberR, true);
}
use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.
the class GIIDeltaDUnitTest method testFillSpecialException2.
/**
* P1, P2, P3 R does GII but wait at BeforeSavedReceivedRVV, so R's RVV=P3R0 P4, P5 R goes on to
* save received RVV. R's new RVV=P5(3-6)R0
*
* When image (which contains P4, P5) arrives, it should fill the special exception
*
* This test will let the 2 operations happen before RIM, so the rvv will match between R and P
* and no gii will happen. In this way, the chunk will not contain the missing entries.
*/
@Test
public void testFillSpecialException2() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
final DiskStoreID memberR = getMemberID(R);
final long[] exceptionlist = { 4, 5 };
doOnePut(P, 1, "key1");
doOnePut(P, 2, "key2");
doOneDestroy(P, 3, "key1");
changeForceFullGII(R, false, true);
// 3
R.invoke(new SerializableRunnable() {
public void run() {
Mycallback myAfterCalculatedUnfinishedOps = new Mycallback(GIITestHookType.AfterCalculatedUnfinishedOps, REGION_NAME);
InitialImageOperation.setGIITestHook(myAfterCalculatedUnfinishedOps);
}
});
// 5
R.invoke(new SerializableRunnable() {
public void run() {
Mycallback myAfterSavedReceivedRVV = new Mycallback(GIITestHookType.AfterSavedReceivedRVV, REGION_NAME);
InitialImageOperation.setGIITestHook(myAfterSavedReceivedRVV);
}
});
closeCache(R);
AsyncInvocation async3 = createDistributedRegionAsync(R);
waitForCallbackStarted(R, GIITestHookType.AfterCalculatedUnfinishedOps);
doOneDestroy(P, 4, "key2");
doOnePut(P, 5, "key1");
R.invoke(() -> InitialImageOperation.resetGIITestHook(GIITestHookType.AfterCalculatedUnfinishedOps, true));
waitForCallbackStarted(R, GIITestHookType.AfterSavedReceivedRVV);
R.invoke(() -> InitialImageOperation.resetGIITestHook(GIITestHookType.AfterSavedReceivedRVV, true));
async3.join(MAX_WAIT);
// P's rvv=r5, gc=0
waitForToVerifyRVV(R, memberP, 5, null, 0);
verifyDeltaSizeFromStats(R, 2, 1);
changeForceFullGII(R, false, true);
changeForceFullGII(P, false, true);
}
Aggregations