@Test public void finishInitializeOwnerOnAsyncPersistentRegionWithTrustedRvvNeverCallsWriteRVV() { diskRegion.setRVVTrusted(true); diskRegion.finishInitializeOwner(mock(LocalRegion.class), GOTIMAGE_BY_FULLGII); verify(diskRegion, never()).writeRVV(any(), any()); }
protected void saveReceivedRVV(RegionVersionVector rvv) { assert rvv != null; // Make sure the RVV is at least as current as // the provider's was when the GII began. This ensures that a // concurrent clear() doesn't prevent the new region's RVV from being // initialized and that any vector entries that are no longer represented // by stamps in the region are not lost if (logger.isTraceEnabled(LogMarker.INITIAL_IMAGE_VERBOSE)) { logger.trace(LogMarker.INITIAL_IMAGE_VERBOSE, "Applying received version vector {} to {}", rvv.fullToString(), region.getName()); } // TODO - RVV - Our current RVV might reflect some operations // that are concurrent updates. We want to keep those updates. However // it might also reflect things that we recovered from disk that we are going // to remove. We'll need to remove those from the RVV somehow. region.getVersionVector().recordVersions(rvv); if (region.getDataPolicy().withPersistence()) { region.getDiskRegion().writeRVV(region, false); region.getDiskRegion().writeRVVGC(region); } if (logger.isTraceEnabled(LogMarker.INITIAL_IMAGE_VERBOSE)) { logger.trace(LogMarker.INITIAL_IMAGE_VERBOSE, "version vector is now {}", region.getVersionVector().fullToString()); } }
void finishInitializeOwner(LocalRegion drs, GIIStatus giiStatus) { if (isReadyForRecovery()) { // this.scheduleCompaction(); if (GIIStatus.didFullGII(giiStatus)) { destroyRemainingRecoveredEntries(drs); } else if (GIIStatus.didDeltaGII(giiStatus)) { // TODO: not sure if we should destroy old tombstones for deltaGII } else if (getRegionVersionVector() != null) { destroyOldTomstones(drs); } releaseRecoveryData(); } if (isBackup() && !this.isRegionClosed() && !this.getRVVTrusted()) { if (!GIIStatus.didGII(giiStatus)) { // If we did not do a GII, but we are still recovering using // an untrusted RVV, that means that the RVV may not reflect // what is in the region. We need to fix the RVV before // we mark the RVV as trusted and allow the region to recover. drs.repairRVV(); } writeRVV(null, true); writeRVVGC((LocalRegion) drs); } }
@Test public void finishInitializeOwnerOnAsyncPersistentRegionWithUnTrustedRvvCallsWriteRVV() { diskRegion.setRVVTrusted(false); diskRegion.finishInitializeOwner(mock(LocalRegion.class), GOTIMAGE_BY_FULLGII); verify(diskRegion, times(1)).writeRVV(any(), any()); }
this.diskRegion.getRegionVersionVector()); this.diskRegion.writeRVV(this, null); this.diskRegion.writeRVVGC(this);
public void endDestroyDataStorage(LocalRegion region, DiskRegion dr) { try { clear(region, dr, null); dr.resetRVV(); dr.setRVVTrusted(false); dr.writeRVV(null, null); // just persist the empty rvv with trust=false } catch (RegionDestroyedException ignore) { // ignore a RegionDestroyedException at this stage } if (this.initFile != null && dr.isBackup()) { this.initFile.endDestroyDataStorage(dr); } }