public void initialize(DiskEntry.Helper.ValueWrapper value, int valueLength, byte userBits) { this.userBits = userBits; this.value = value; this.size = 0; this.needsValue = EntryBits.isNeedsValue(this.userBits); if (this.needsValue) { this.size += valueLength; } } public long write() throws IOException {
public void initialize(DiskEntry entry, ValueWrapper value, byte userBits) { this.userBits = userBits; this.value = value; this.size = 0; this.needsValue = EntryBits.isNeedsValue(this.userBits); if (this.needsValue) { this.size += this.value.getLength(); } } public long write() throws IOException {
this.needsValue = EntryBits.isNeedsValue(this.userBits); this.size += (4 + keyBytes.length); saveDrId(drId);
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 }
/** * * Asif: A helper function which identifies whether to record a removal of * entry in the current oplog or to make the switch to the next oplog. This * function enables us to reuse the byte buffer which got created for an oplog * which no longer permits us to use itself. * * @param entry * DiskEntry object representing the current Entry * @throws IOException * @throws InterruptedException */ private void basicRemove(DiskRegion dr, DiskEntry entry) throws IOException, InterruptedException { DiskId id = entry.getDiskId(); // no need to lock since this code no longer does io if (EntryBits.isNeedsValue(id.getUserBits())) { // oplogId already done up in DiskStoreImpl long oldOffset = id.getOffsetInOplog(); if (oldOffset != -1) { id.setOffsetInOplog(-1); if (rmLive(entry)) { if (!isCompacting() || calledByCompactorThread()) { handleNoLiveValues(); } } } } }
this.opCode = OPLOG_MOD_ENTRY_WITH_KEY_1ID; this.needsValue = EntryBits.isNeedsValue(this.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) {
if (EntryBits.isNeedsValue(id.getUserBits())) {
this.opCode = OPLOG_MOD_ENTRY_WITH_KEY_1ID; this.needsValue = EntryBits.isNeedsValue(this.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) {
public void handleRegionEntry(RegionEntry re) { DiskEntry de = (DiskEntry)re; DiskId id = de.getDiskId(); if (id != null) { synchronized (id) { // GemFireXD: give a chance to copy key from value bytes when key // is just a pointer to value row re.setValueToNull(region); // TODO why call _setValue twice in a row? re.removePhase2(region); id.unmarkForWriting(); if (EntryBits.isNeedsValue(id.getUserBits())) { long oplogId = id.getOplogId(); long offset = id.getOffsetInOplog(); //int length = id.getValueLength(); if (oplogId != -1 && offset != -1) { id.setOplogId(-1); OverflowOplog oplog = getDiskStore().overflowOplogs.getChild((int)oplogId); if (oplog != null) { oplog.freeEntry(de); } } } } } } });
public void handleRegionEntry(RegionEntry re) { DiskEntry de = (DiskEntry)re; DiskId id = de.getDiskId(); if (id != null) { synchronized (id) { // SQLFabric: give a chance to copy key from value bytes when key // is just a pointer to value row re.setValueToNull(); // TODO why call _setValue twice in a row? re.removePhase2(); id.unmarkForWriting(); if (EntryBits.isNeedsValue(id.getUserBits())) { long oplogId = id.getOplogId(); long offset = id.getOffsetInOplog(); //int length = id.getValueLength(); if (oplogId != -1 && offset != -1) { id.setOplogId(-1); OverflowOplog oplog = getDiskStore().overflowOplogs.getChild((int)oplogId); if (oplog != null) { oplog.freeEntry(de); } } } } } } });
if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(value.getLength()); } else {
if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(value.getLength()); } else {
dr.getId(), tag, getOplogId()); if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(value.getLength()); } else {
if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(valueLength); } else {
if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(valueLength); } else {
+ " oplog#" + getOplogId()); if (EntryBits.isNeedsValue(userBits)) { id.setValueLength(valueLength); } else {