/** * Called before LocalRegion clears the contents of its entries map */ void prepareForClose(LocalRegion region, DiskRegion dr) { if (dr.isBackup()) { // Need to flush any async ops done on dr. // The easiest way to do this is to flush the entire async queue. forceFlush(); } }
public void beginDestroyDataStorage(DiskRegion dr) { if (this.initFile != null && dr.isBackup()/* fixes bug 41389 */) { this.initFile.beginDestroyDataStorage(dr); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
protected void initialize(final RegionEntryContext context, final Object value) { boolean isBackup; if (context instanceof InternalRegion) { isBackup = ((InternalRegion) context).getDiskRegion().isBackup(); } else if (context instanceof PlaceHolderDiskRegion) { isBackup = true; } else { throw new IllegalArgumentException("expected a InternalRegion or PlaceHolderDiskRegion"); } // Delay the initialization of DiskID if overflow only if (isBackup) { diskInitialize(context, value); } }
/** * stops the compactor outside the write lock. Once stopped then it proceeds to destroy the * current & old oplogs */ void beginDestroyRegion(LocalRegion region, DiskRegion dr) { if (dr.isBackup()) { getDiskInitFile().beginDestroyRegion(dr); } }
public boolean forceCompaction(DiskRegion dr) { if (!dr.isBackup()) return false; acquireReadLock(dr); try { return basicForceCompaction(dr); } finally { releaseReadLock(dr); } }
@Test public void whenBasicUpdateButNotBackupAndDiskIdIsNullAndEntrySet() throws Exception { StoredObject storedObject = mock(StoredObject.class); LocalRegion lr = mock(LocalRegion.class); DiskEntry diskEntry = mock(DiskEntry.class); EntryEventImpl entryEvent = mock(EntryEventImpl.class); DiskRegion diskRegion = mock(DiskRegion.class); when(diskRegion.isBackup()).thenReturn(false); when(lr.getDiskRegion()).thenReturn(diskRegion); DiskEntry.Helper.basicUpdateForTesting(diskEntry, lr, storedObject, entryEvent); verify(storedObject, times(0)).release(); } }
@Test public void whenBasicUpdateButNotBackupAndEntrySet() throws Exception { StoredObject storedObject = mock(StoredObject.class); LocalRegion lr = mock(LocalRegion.class); DiskEntry diskEntry = mock(DiskEntry.class); when(diskEntry.getDiskId()).thenReturn(mock(DiskId.class)); EntryEventImpl entryEvent = mock(EntryEventImpl.class); DiskRegion diskRegion = mock(DiskRegion.class); when(diskRegion.isBackup()).thenReturn(false); when(lr.getDiskRegion()).thenReturn(diskRegion); DiskEntry.Helper.basicUpdateForTesting(diskEntry, lr, storedObject, entryEvent); verify(storedObject, times(0)).release(); }
@Test public void doSynchronousWriteReturnsTrueWhenPersistentRegionIsInitializing() { when(diskRegion.isSync()).thenReturn(false); when(diskRegion.isBackup()).thenReturn(true); when(internalRegion.isInitialized()).thenReturn(false); boolean result = callDoSynchronousWrite(); assertThat(result).isTrue(); }
@Test public void doSynchronousWriteReturnsFalseWhenOverflowOnly() { when(diskRegion.isSync()).thenReturn(false); when(diskRegion.isBackup()).thenReturn(false); when(internalRegion.isInitialized()).thenReturn(false); boolean result = callDoSynchronousWrite(); assertThat(result).isFalse(); }
@Test public void doSynchronousWriteReturnsFalseWhenPersistentRegionIsInitialized() { when(diskRegion.isSync()).thenReturn(false); when(diskRegion.isBackup()).thenReturn(true); when(internalRegion.isInitialized()).thenReturn(true); boolean result = callDoSynchronousWrite(); assertThat(result).isFalse(); }
@Test public void cleanUpAfterFailedInitialImageDoesNotCloseEntriesIfIsPersistentRegionAndRecoveredFromDisk() { DistributedRegion distributedRegion = mock(DistributedRegion.class); DiskRegion diskRegion = mock(DiskRegion.class); doCallRealMethod().when(distributedRegion).cleanUpAfterFailedGII(true); when(distributedRegion.getDiskRegion()).thenReturn(diskRegion); when(diskRegion.isBackup()).thenReturn(true); distributedRegion.cleanUpAfterFailedGII(true); verify(diskRegion).resetRecoveredEntries(eq(distributedRegion)); verify(distributedRegion, never()).closeEntries(); }