/** * This constructor will get invoked only in case of persistent region when it is recovering an * oplog. */ Oplog(long oplogId, PersistentOplogSet parent) { // @todo have the crf and drf use different directories. if (oplogId > DiskId.MAX_OPLOG_ID) { throw new IllegalStateException( "Too many oplogs. The oplog id can not exceed " + DiskId.MAX_OPLOG_ID); } this.isRecovering = true; this.oplogId = oplogId; this.parent = parent.getParent(); this.oplogSet = parent; this.opState = new OpState(); this.maxOplogSize = getParent().getMaxOplogSizeInBytes(); setMaxCrfDrfSize(); this.stats = getParent().getStats(); this.compactOplogs = getParent().getAutoCompact(); this.closed = true; this.crf.RAFClosed = true; this.deleted.set(true); this.haveRecoveredCrf = false; this.haveRecoveredDrf = false; }
this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); long availableSpace = this.dirHolder.getAvailableSpace();
this.oplogSet = prevOplog.oplogSet; this.dirHolder = dirHolder; this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); long availableSpace = this.dirHolder.getAvailableSpace();
private void writeGemfireVersionRecord(OplogFile olf) throws IOException { if (this.gfversion == null) { this.gfversion = Version.CURRENT; } Version dataVersion = getDataVersionIfOld(); if (dataVersion == null) { dataVersion = Version.CURRENT; } // if gfversion and dataVersion are not same, then write a special token // version and then write both, else write gfversion as before // this is for backward compatibility with 7.0 this.opState = new OpState(); if (this.gfversion == dataVersion) { writeProductVersionRecord(this.gfversion, olf); } else { writeProductVersionRecord(Version.TOKEN, olf); clearOpState(); writeProductVersionRecord(this.gfversion, olf); clearOpState(); writeProductVersionRecord(dataVersion, olf); } }
/** * Write a OPLOG_NEW_ENTRY_BASE_ID to this oplog. Must be called before any OPLOG_NEW_ENTRY_0ID * records are written to this oplog. */ private boolean writeNewEntryBaseRecord(boolean async) throws IOException { if (this.wroteNewEntryBase) return false; this.wroteNewEntryBase = true; long newEntryBase = getOplogSet().getOplogEntryId(); OpState saved = this.opState; try { this.opState = new OpState(); this.opState.initialize(newEntryBase); writeOpLogBytes(this.crf, async, false/* no need to flush this record */); this.dirHolder.incrementTotalOplogSize(getOpStateSize()); } finally { this.opState = saved; } return true; }
/** * Write the RVV record for the given regions. * * @param olf the oplog to write to * @param diskRegions the set of disk regions we should write the RVV of * @param writeGCRVV true to write write the GC RVV */ private void writeRVVRecord(OplogFile olf, Map<Long, AbstractDiskRegion> diskRegions, boolean writeGCRVV) throws IOException { this.opState = new OpState(); this.opState.initialize(diskRegions, writeGCRVV); writeOpLogBytes(olf, false, true); // fix for bug 41928 olf.currSize += getOpStateSize(); this.dirHolder.incrementTotalOplogSize(getOpStateSize()); }
private void writeDiskStoreRecord(OplogFile olf, OPLOG_TYPE type) throws IOException { this.opState = new OpState(); this.opState.initialize(type); writeOpLogBytes(olf, false, true); olf.currSize += getOpStateSize(); this.dirHolder.incrementTotalOplogSize(getOpStateSize()); clearOpState(); this.opState.initialize(getParent().getDiskStoreID()); writeOpLogBytes(olf, false, true); // fix for bug 41928 olf.currSize += getOpStateSize(); this.dirHolder.incrementTotalOplogSize(getOpStateSize()); }