public void forceRoll(DiskRegion dr) { Oplog child = getChild(); if (child != null) { child.forceRolling(dr); } }
public void flushChild() { Oplog oplog = getChild(); if (oplog != null) { oplog.flushAll(); } }
public void prepareForClose() { ArrayList<Oplog> oplogsToPrepare = new ArrayList<Oplog>(); synchronized (this.oplogIdToOplog) { oplogsToPrepare.addAll(this.oplogIdToOplog.values()); oplogsToPrepare.addAll(this.inactiveOplogs.values()); } boolean childPreparedForClose = false; long child_oplogid = this.getChild() == null ? -1 : this.getChild().oplogId; for (Oplog oplog : oplogsToPrepare) { oplog.prepareForClose(); if (child_oplogid != -1 && oplog.oplogId == child_oplogid) { childPreparedForClose = true; } } if (!childPreparedForClose && this.getChild() != null) { this.getChild().prepareForClose(); } }
@Override public void modify(InternalRegion region, DiskEntry entry, ValueWrapper value, boolean async) { getChild().modify(region, entry, value, async); }
@Override public void remove(InternalRegion region, DiskEntry entry, boolean async, boolean isClear) { getChild().remove(region, entry, async, isClear); }
public void offlineModify(DiskRegionView drv, DiskEntry entry, byte[] value, boolean isSerializedObject) { getChild().offlineModify(drv, entry, value, isSerializedObject); }
@Override public void create(InternalRegion region, DiskEntry entry, ValueWrapper value, boolean async) { getChild().create(region, entry, value, async); }
public boolean hasPersistedData() { return getPersistentOplogs().getChild() != null; }
public void basicClose(DiskRegion dr) { ArrayList<Oplog> oplogsToClose = new ArrayList<Oplog>(); synchronized (this.oplogIdToOplog) { oplogsToClose.addAll(this.oplogIdToOplog.values()); oplogsToClose.addAll(this.inactiveOplogs.values()); oplogsToClose.addAll(this.drfOnlyOplogs.values()); { Oplog child = getChild(); if (child != null) { oplogsToClose.add(child); } } } for (Oplog oplog : oplogsToClose) { oplog.close(dr); } }
public void basicDestroy(DiskRegion dr) { ArrayList<Oplog> oplogsToDestroy = new ArrayList<Oplog>(); synchronized (this.oplogIdToOplog) { for (Oplog oplog : this.oplogIdToOplog.values()) { oplogsToDestroy.add(oplog); } for (Oplog oplog : this.inactiveOplogs.values()) { oplogsToDestroy.add(oplog); } for (Oplog oplog : this.drfOnlyOplogs.values()) { oplogsToDestroy.add(oplog); } { Oplog child = getChild(); if (child != null) { oplogsToDestroy.add(child); } } } for (Oplog oplog : oplogsToDestroy) { oplog.destroy(dr); } }
/** * returns the active child */ Oplog testHook_getChild() { return getDiskStore().getPersistentOplogs().getChild(); }
public void initChild() { if (getChild() == null) { setFirstChild(getSortedOplogs(), true); } }
public void offlineCompact() { if (getChild() != null) { // check active oplog and if it is empty delete it getChild().krfClose(); if (getChild().isOplogEmpty()) { getChild().destroy(); } } { // remove any oplogs that only have a drf to fix bug 42036 ArrayList<Oplog> toDestroy = new ArrayList<Oplog>(); synchronized (this.oplogIdToOplog) { Iterator<Oplog> it = this.oplogIdToOplog.values().iterator(); while (it.hasNext()) { Oplog n = it.next(); if (n.isDrfOnly()) { toDestroy.add(n); } } } for (Oplog oplog : toDestroy) { oplog.destroy(); } destroyOldestReadyToCompact(); } }
public void replaceIncompatibleEntry(DiskEntry old, DiskEntry repl) { acquireReadLock(); try { getOplogSet().getChild().replaceIncompatibleEntry(this, old, repl); } finally { releaseReadLock(); } }
public void saveConflictVersionTag(InternalRegion region, VersionTag tag, boolean async) { if (getOplogSet().getChild() != this) { getOplogSet().getChild().saveConflictVersionTag(region, tag, async); } else { try { basicSaveConflictVersionTag(region.getDiskRegion(), tag, async); } catch (IOException ex) { region.getCancelCriterion().checkCancelInProgress(ex); throw new DiskAccessException(String.format("Failed writing conflict version tag to %s", this.diskFile.getPath()), ex, region.getFullPath()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); region.getCancelCriterion().checkCancelInProgress(ie); throw new DiskAccessException(String.format("Failed writing conflict version tag to %s", this.diskFile.getPath()), ie, region.getFullPath()); } } }
/** * This oplog will be forced to switch to a new oplog */ void forceRolling(DiskRegion dr) { if (getOplogSet().getChild() == this) { getParent().getBackupLock().lock(); try { synchronized (this.lock) { if (getOplogSet().getChild() == this) { switchOpLog(dr, 0, null); } } } finally { getParent().getBackupLock().unlock(); } if (LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER) { CacheObserverHolder.getInstance().afterSwitchingOplog(); } } }
/** * The oplogId in re points to the oldOplogId. "this" oplog is the current oplog. */ private void updateRecoveredEntry(DiskRegionView drv, DiskEntry de, DiskEntry.RecoveredEntry re) { if (getOplogId() != re.getOplogId()) { Oplog oldOplog = getOplogSet().getChild(re.getOplogId()); oldOplog.rmLive(drv, de); initRecoveredEntry(drv, de); } else { getDRI(drv).update(de); } }
boolean basicForceCompaction(DiskRegion dr) { PersistentOplogSet oplogSet = getPersistentOplogs(); // see if the current active oplog is compactable; if so { Oplog active = oplogSet.getChild(); if (active != null) { if (active.hadLiveEntries() && active.needsCompaction()) { active.forceRolling(dr); } } } // Compact the oplogs CompactableOplog[] oplogs = getOplogsToBeCompacted(true/* fixes 41143 */); // schedule a compaction if at this point there are oplogs to be compacted if (oplogs != null) { if (this.oplogCompactor != null) { if (this.oplogCompactor.scheduleIfNeeded(oplogs)) { this.oplogCompactor.waitForRunToComplete(); } else { oplogs = null; // @todo darrel: still need to schedule oplogs and wait for them to // compact. } } } return oplogs != null; }
public void writeRVV(DiskRegion dr, LocalRegion region, Boolean isRVVTrusted) { acquireReadLock(dr); try { if (dr.isRegionClosed()) { dr.getCancelCriterion().checkCancelInProgress(null); throw new RegionDestroyedException( "The DiskRegion has been closed or destroyed", dr.getName()); } RegionVersionVector inMemoryRVV = (region == null) ? null : region.getVersionVector(); // persist the new GC RVV information for this region to the CRF PersistentOplogSet oplogSet = getPersistentOplogSet(dr); // use current dr.rvvTrust oplogSet.getChild().writeRVV(dr, inMemoryRVV, isRVVTrusted); } finally { releaseReadLock(dr); } }
public void putVersionTagOnly(InternalRegion region, VersionTag tag, boolean async) { DiskRegion dr = region.getDiskRegion(); // this method will only be called by backup oplog assert dr.isBackup(); if (!async) { acquireReadLock(dr); } try { if (dr.isRegionClosed()) { region.getCancelCriterion().checkCancelInProgress(null); throw new RegionDestroyedException( "The DiskRegion has been closed or destroyed", dr.getName()); } if (dr.getRegionVersionVector().contains(tag.getMemberID(), tag.getRegionVersion())) { // No need to write the conflicting tag to disk if the disk RVV already // contains this tag. return; } PersistentOplogSet oplogSet = getPersistentOplogSet(dr); oplogSet.getChild().saveConflictVersionTag(region, tag, async); } finally { if (!async) { releaseReadLock(dr); } } }