this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); long availableSpace = this.dirHolder.getAvailableSpace();
saveUserBits(notToUseUserBits, userBits); initVersionsBytes(entry); } else if (this.opCode == OPLOG_NEW_ENTRY_0ID) { needsKey = true; this.needsValue = EntryBits.isNeedsValue(this.userBits); initVersionsBytes(entry); } else if (this.opCode == OPLOG_DEL_ENTRY_1ID) { needsKey = false; } else { long drId = dr.getId(); saveDrId(drId);
useNextOplog = true; } else { this.opState.initialize(OPLOG_CONFLICT_VERSION, dr.getId(), tag); adjustment = getOpStateSize(); assert adjustment > 0;
this.oplogSet = prevOplog.oplogSet; this.dirHolder = dirHolder; this.opState = new OpState(); this.logger = prevOplog.logger; long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes();
public long write(OplogFile olf) throws IOException { long bytesWritten = 0; writeByte(olf, this.opCode); bytesWritten++; if (this.opCode == OPLOG_NEW_ENTRY_BASE_ID) { writeLong(olf, this.newEntryBase); bytesWritten += 8; } else if (this.opCode == OPLOG_DISK_STORE_ID) { writeLong(olf, this.diskStoreId.getLeastSignificantBits()); writeLong(olf, this.diskStoreId.getMostSignificantBits()); bytesWritten += 16; } else if (this.opCode == OPLOG_MAGIC_SEQ_ID) { write(olf, this.magic.getBytes(), OPLOG_TYPE.getLen()); bytesWritten += OPLOG_TYPE.getLen(); } else if (this.opCode == OPLOG_RVV) { write(olf, this.value); bytesWritten += this.value.getLength(); } else if (this.opCode == OPLOG_GEMFIRE_VERSION) { writeOrdinal(olf, this.gfversion); bytesWritten++; } else if (this.opCode == OPLOG_CONFLICT_VERSION) { if (this.drIdLength > 0) { write(olf, this.drIdBytes, this.drIdLength); bytesWritten += this.drIdLength; write(olf, this.versionsBytes, this.versionsBytes.length); bytesWritten += this.versionsBytes.length; } else { if (this.notToUseUserBits == false) { writeByte(olf, this.userBits);
long bytesWritten = this.opState.write(olf); if (!async && doFlushIfSync) { flushAndSync(olf);
public long write(OplogFile olf) throws IOException { long bytesWritten = 0; writeByte(olf, this.opCode); bytesWritten++; if (this.opCode == OPLOG_NEW_ENTRY_BASE_ID) { writeLong(olf, this.newEntryBase); bytesWritten += 8; } else if (this.opCode == OPLOG_DISK_STORE_ID) { writeLong(olf, this.diskStoreId.getLeastSignificantBits()); writeLong(olf, this.diskStoreId.getMostSignificantBits()); bytesWritten += 16; } else if (this.opCode == OPLOG_RVV) { bytesWritten += this.valueLength; } else if (this.opCode == OPLOG_GEMFIRE_VERSION) { writeOrdinal(olf, this.gfversion); bytesWritten++; } else if (this.opCode == OPLOG_CONFLICT_VERSION) { if (this.drIdLength > 0) { write(olf, this.drIdBytes, this.drIdLength); bytesWritten += this.drIdLength; write(olf, this.versionsBytes, this.versionsBytes.length); bytesWritten += this.versionsBytes.length; } else { if (this.notToUseUserBits == false) { writeByte(olf, this.userBits); bytesWritten++; write(olf, this.deltaIdBytes, this.deltaIdBytesLength);
useNextOplog = true; } else { this.opState.initialize(oplogKeyId, keyBytes, valueBytes, userBits, drId, tag, lastModifiedTime, false); adjustment = getOpStateSize(); switchOpLog(null, adjustment, null, false); this.opState.reset();
this.oplogSet = prevOplog.oplogSet; this.dirHolder = dirHolder; this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); long availableSpace = this.dirHolder.getAvailableSpace();
this.opCode = opCode; this.size = 1;// for the opcode saveUserBits(notToUseUserBits, userBits); initVersionsBytes(entry); } else if (this.opCode == OPLOG_NEW_ENTRY_0ID) { needsKey = true; this.needsValue = EntryBits.isNeedsValue(this.userBits); initVersionsBytes(entry); } else if (this.opCode == OPLOG_DEL_ENTRY_1ID) { needsKey = false; } else { long drId = dr.getId(); saveDrId(drId);
this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); long availableSpace = this.dirHolder.getAvailableSpace();
useNextOplog = true; } else { this.opState.initialize(OPLOG_CONFLICT_VERSION, dr.getId(), tag); adjustment = getOpStateSize(); assert adjustment > 0; switchOpLog(dr, adjustment, null, false); this.opState.reset();
long bytesWritten = this.opState.write(olf); if (!async && doFlushIfSync) { flushAndSync(olf);
useNextOplog = true; } else { this.opState.initialize(oplogKeyId, keyBytes, valueBytes, userBits, drId, tag, false); adjustment = getOpStateSize(); assert adjustment > 0;
this.opCode = OPLOG_MOD_ENTRY_WITH_KEY_1ID; this.size = 1;// for the opcode saveUserBits(notToUseUserBits, userBits); saveDrId(drId); initVersionsBytes(tag, lastModifiedTime);
/** * This constructor will get invoked only in case of persistent region * when it is recovering an oplog. * @param oplogId * @param parent */ 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.logger = getParent().getCache().getLoggerI18n(); this.opState = new OpState(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); this.maxOplogSize = maxOplogSizeParam; 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.newOplog = false; this.idxkrf = new OplogIndex(this); }
public void initialize(long oplogKeyId, byte[] keyBytes, byte[] valueBytes, byte userBits, long drId, VersionTag tag, boolean notToUseUserBits) throws IOException { this.opCode = OPLOG_MOD_ENTRY_WITH_KEY_1ID; this.size = 1;// for the opcode saveUserBits(notToUseUserBits, userBits); this.keyBytes = keyBytes; this.value = new DiskEntry.Helper.CompactorValueWrapper(valueBytes, valueBytes.length); if (this.userBits == 1 && this.value.getLength() == 0) { throw new IllegalStateException("userBits==1 and valueLength is 0"); } this.needsValue = EntryBits.isNeedsValue(this.userBits); this.size += (4 + this.keyBytes.length); saveDrId(drId); initVersionsBytes(tag); if (this.needsValue) { this.size += 4 + this.value.getLength(); } this.deltaIdBytesLength = 0; { long delta = calcDelta(oplogKeyId, this.opCode); this.deltaIdBytesLength = bytesNeeded(delta); this.size += this.deltaIdBytesLength; this.opCode += this.deltaIdBytesLength - 1; for (int i = this.deltaIdBytesLength - 1; i >= 0; i--) { this.deltaIdBytes[i] = (byte) (delta & 0xFF); delta >>= 8; } } this.size++; // for END_OF_RECORD_ID }
/** * This constructor will get invoked only in case of persistent region when it * is recovering an oplog. * * @param oplogId * @param parent */ 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(); long maxOplogSizeParam = getParent().getMaxOplogSizeInBytes(); this.maxOplogSize = maxOplogSizeParam; 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; }
/** * 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(); // logger.info(LocalizedStrings.DEBUG, "DEBUG newEntryBase=" + newEntryBase + " oplog#" + getOplogId()); 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; } // { // LogWriterI18n l = parent.getOwner().getCache().getLoggerI18n(); // l.info(LocalizedStrings.DEBUG, "base inc=" + OPLOG_NEW_ENTRY_BASE_REC_SIZE + " currSize=" + this.crf.currSize); // } return true; }
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); } }