void put(BytesRef uid, VersionValue version) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; long ramAccounting = BASE_BYTES_PER_CHM_ENTRY + version.ramBytesUsed() + uidRAMBytesUsed; VersionValue previousValue = current.put(uid, version); ramAccounting += previousValue == null ? 0 : -(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed); adjustRam(ramAccounting); }
void put(BytesRef uid, VersionValue version) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; long ramAccounting = BASE_BYTES_PER_CHM_ENTRY + version.ramBytesUsed() + uidRAMBytesUsed; VersionValue previousValue = current.put(uid, version); ramAccounting += previousValue == null ? 0 : -(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed); adjustRam(ramAccounting); }
void remove(BytesRef uid, DeleteVersionValue deleted) { VersionValue previousValue = current.remove(uid); current.updateMinDeletedTimestamp(deleted); if (previousValue != null) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; adjustRam(-(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed)); } if (old != VersionLookup.EMPTY) { // we also need to remove it from the old map here to make sure we don't read this stale value while // we are in the middle of a refresh. Most of the time the old map is an empty map so we can skip it there. old.remove(uid); } }
void remove(BytesRef uid, DeleteVersionValue deleted) { VersionValue previousValue = current.remove(uid); current.updateMinDeletedTimestamp(deleted); if (previousValue != null) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; adjustRam(-(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed)); } if (old != VersionLookup.EMPTY) { // we also need to remove it from the old map here to make sure we don't read this stale value while // we are in the middle of a refresh. Most of the time the old map is an empty map so we can skip it there. old.remove(uid); } }
void remove(BytesRef uid, DeleteVersionValue deleted) { VersionValue previousValue = current.remove(uid); current.updateMinDeletedTimestamp(deleted); if (previousValue != null) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; adjustRam(-(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed)); } if (old != VersionLookup.EMPTY) { // we also need to remove it from the old map here to make sure we don't read this stale value while // we are in the middle of a refresh. Most of the time the old map is an empty map so we can skip it there. old.remove(uid); } }
void put(BytesRef uid, VersionValue version) { long uidRAMBytesUsed = BASE_BYTES_PER_BYTESREF + uid.bytes.length; long ramAccounting = BASE_BYTES_PER_CHM_ENTRY + version.ramBytesUsed() + uidRAMBytesUsed; VersionValue previousValue = current.put(uid, version); ramAccounting += previousValue == null ? 0 : -(BASE_BYTES_PER_CHM_ENTRY + previousValue.ramBytesUsed() + uidRAMBytesUsed); adjustRam(ramAccounting); }