public class IN extends Node implements Comparable<IN>, LatchContext
| Modifier and Type | Field and Description |
|---|---|
static int |
ACCUMULATED_LIMIT |
static int |
ACCUMULATED_LIMIT_DEFAULT |
static int |
BIN_LEVEL |
static int |
DBMAP_LEVEL |
static boolean |
disableCompactLsns |
static int |
EXACT_MATCH |
static int |
INSERT_SUCCESS |
static int |
LEVEL_MASK |
static int |
MAIN_LEVEL |
static int |
MAX_FILE_OFFSET |
static int |
MIN_LEVEL |
static long |
NON_EVICTABLE_IN |
NULL_NODE_ID| Constructor and Description |
|---|
IN()
Create an empty IN, with no node ID, to be filled in from the log.
|
IN(DatabaseImpl dbImpl,
byte[] identifierKey,
int capacity,
int level)
Create a new IN.
|
IN(SizeofMarker marker)
For Sizeof.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachNode(int idx,
Node node,
byte[] newKey)
Attach the given node as the idx-th child of "this" node.
|
String |
beginTag() |
void |
clearLastLoggedSize(int idx)
The last logged size is not stored for UINs.
|
void |
clearOffHeapBINId(int idx) |
long |
compactMemory()
Compacts the representation of the IN, if possible.
|
int |
compareTo(IN argIN)
Sort based on equality key.
|
long |
computeMemorySize()
Count up the memory usage attributable to this node alone.
|
void |
convertKey(int idx,
byte[] newKey)
This method is used in DupConvert, where it is called to convert the
keys of an upper IN that has just been fetched from the log and is not
attached to in-memory tree yet.
|
void |
deleteEntry(int index)
Removes the slot at index from this IN.
|
void |
deleteRecord(int idx,
long oldMemSize,
long newLSN,
long newVLSN,
int newSize)
Update the idx slot slot of this BIN to reflect a deletion of the
associated record.
|
void |
detachNode(int idx,
boolean updateLsn,
long newLsn) |
void |
dumpLog(StringBuilder sb,
boolean verbose)
Write the object into the string buffer for log dumping.
|
protected void |
dumpLogAdditional(StringBuilder sb)
Allows subclasses to add additional fields before the end tag.
|
String |
dumpString(int nSpaces,
boolean dumpTags)
For unit test support:
|
String |
endTag() |
boolean |
equals(Object obj) |
IN |
fetchIN(int idx,
CacheMode cacheMode)
Returns the idx-th child of "this" upper IN, fetching the child from
the log and attaching it to its parent if it is not already attached.
|
LN |
fetchLN(int idx,
CacheMode cacheMode)
Returns the target of the idx'th entry, fetching from disk if necessary.
|
Node |
fetchLNOrDIN(int idx,
CacheMode cacheMode) |
int |
findEntry(byte[] key,
boolean indicateIfDuplicate,
boolean exact) |
int |
findEntry(byte[] key,
boolean indicateIfDuplicate,
boolean exact,
Comparator<byte[]> comparator)
Find the entry in this IN for which key is LTE the key arg.
|
long |
getBudgetedMemorySize()
Returns the amount of memory currently budgeted for this IN.
|
protected int |
getCompactMaxKeyLength() |
byte[] |
getData(int idx) |
DatabaseImpl |
getDatabase()
Get the database for this IN.
|
DatabaseId |
getDatabaseId() |
boolean |
getDirty() |
EnvironmentImpl |
getEnv() |
EnvironmentImpl |
getEnvImplForFatalException()
Returns envImpl, or may throw another exception in unit tests.
|
boolean |
getFetchedCold()
Indicates that the BIN was fetched from disk, or loaded from the
off-heap cache, using CacheMode.UNCHANGED, and has not been accessed
with another CacheMode.
|
boolean |
getFetchedColdOffHeap() |
protected long |
getFixedMemoryOverhead() |
LogEntryType |
getGenericLogType()
Returns the generic LogEntryType for this node.
|
byte[] |
getIdentifierKey() |
boolean |
getInListResident()
Returns whether this IN is on the INList.
|
long |
getInMemorySize() |
byte[] |
getKey(int idx)
Return the idx'th key.
|
Comparator<byte[]> |
getKeyComparator()
Convenience method to return the database key comparator.
|
byte[] |
getKeyPrefix() |
INKeyRep |
getKeyVals() |
int |
getKnownChildIndex(Node child)
Returns the index of the given child.
|
long |
getLastDeltaLsn()
Returns the last delta version LSN, or NULL_LSN if a delta was not last
logged.
|
long |
getLastFullLsn()
Returns the last full version LSN, or NULL_LSN if never logged.
|
long |
getLastLoggedLsn()
Returns the LSN of the last last logged version of this IN, or NULL_LSN
if never logged.
|
int |
getLastLoggedSize(int idx)
The last logged size is not stored for UINs.
|
String |
getLatchName()
Returns the latch name for debugging.
|
int |
getLatchNWaiters() |
LatchTable |
getLatchTable()
Returns LatchTable for debug/test tracking.
|
int |
getLatchTimeoutMs()
Returns EnvironmentParams.ENV_LATCH_TIMEOUT
|
int |
getLevel()
Cover for LN's and just return 0 since they'll always be at the bottom
of the tree.
|
LN |
getLN(int idx,
CacheMode cacheMode)
Return the idx'th LN target, enforcing rules defined by the cache modes
for the LN.
|
int |
getLogSize() |
int |
getLogSize(boolean deltasOnly) |
LogEntryType |
getLogType()
Get the log type of this node.
|
long |
getLsn(int idx)
Return the idx'th LSN for this entry.
|
int |
getMaxEntries() |
int |
getNDeltas() |
int |
getNEntries() |
IN |
getNextLRUNode() |
long |
getNodeId() |
int |
getNormalizedLevel() |
int |
getNumEmbeddedLNs() |
int |
getOffHeapBINId(int idx) |
long |
getOffHeapBINIdsMemorySize() |
IN |
getParent()
This method should be used carefully.
|
IN |
getPrevLRUNode() |
boolean |
getProhibitNextDelta() |
boolean |
getRecalcToggle() |
byte |
getState(int idx) |
Node |
getTarget(int idx)
Return the idx'th target.
|
INTargetRep |
getTargets() |
boolean |
hasCachedChildren()
Returns whether any child is non-null in the main or off-heap cache.
|
boolean |
hasCachedChildrenFlag() |
int |
hashCode()
We would like as even a hash distribution as possible so that the
Evictor's LRU is as accurate as possible.
|
boolean |
hasKeyPrefix() |
boolean |
hasOffHeapBINIds() |
boolean |
haveEmbeddedData(int idx) |
protected void |
init(DatabaseImpl db,
byte[] identifierKey,
int initialCapacity,
int level)
Initialize IN object.
|
boolean |
insertEntry(Node child,
byte[] key,
long childLsn)
Inserts a slot with the given key, lsn and child node into this IN, if
a slot with the same key does not exist already.
|
int |
insertEntry1(Node child,
byte[] key,
byte[] data,
long childLsn,
boolean blindInsertion)
Inserts a slot with the given key, lsn and child node into this IN, if
a slot with the same key does not exist already.
|
int |
insertEntry1(Node child,
byte[] key,
byte[] data,
long childLsn,
byte state,
boolean blindInsertion)
Inserts a slot with the given key, lsn, state, and child node into this
IN, if a slot with the same key does not exist already.
|
void |
insertRecord(int idx,
LN newLN,
long newLSN,
int newSize,
byte[] newKey,
byte[] newData,
int expiration,
boolean expirationInHours)
Update the idx slot of this BIN to reflect a record insertion in an
existing KD slot.
|
boolean |
isBINDelta() |
boolean |
isBINDelta(boolean checkLatched) |
boolean |
isDirty(int idx) |
static boolean |
isEmbeddedLN(byte state) |
boolean |
isEmbeddedLN(int idx)
Return true if the LN at the given slot is embedded.
|
boolean |
isEntryKnownDeleted(int idx) |
boolean |
isEntryPendingDeleted(int idx) |
boolean |
isExpirationInHours() |
boolean |
isIN() |
boolean |
isInPri2LRU() |
boolean |
isKeyInBounds(byte[] key)
Returns whether the given key is greater than or equal to the first key
in the IN and less than or equal to the last key in the IN.
|
boolean |
isLatchExclusiveOwner() |
boolean |
isLatchOwner() |
static boolean |
isNoDataLN(byte state) |
boolean |
isNoDataLN(int idx)
Return true if the LN at the given slot is an embedded LN with no data.
|
boolean |
isOffHeapBINDirty(int idx) |
boolean |
isOffHeapBINPri2(int idx) |
boolean |
isPinned() |
boolean |
isRoot() |
boolean |
isUpperIN() |
void |
latch()
Latch this node exclusive and update the LRU using the default cacheMode.
|
void |
latch(CacheMode cacheMode)
Latch this node exclusive and update the LRU using the given cacheMode.
|
void |
latchNoUpdateLRU()
Latch this node exclusive and do not update the LRU or cause other
related side effects.
|
void |
latchNoUpdateLRU(DatabaseImpl db)
Latch this node exclusive and do not update the LRU or cause other
related side effects.
|
boolean |
latchNoWait(CacheMode cacheMode)
Latch this node if it is not latched by another thread.
|
IN |
latchParent()
Latches the parent exclusively, leaving this node latched.
|
void |
latchShared()
Latch this node shared and update the LRU using the default cacheMode.
|
void |
latchShared(CacheMode cacheMode)
Latch this node shared and update the LRU using the given cacheMode.
|
IN |
loadIN(int idx,
CacheMode cacheMode)
Returns the idx-th child of "this" upper IN, loading the child from
off-heap and attaching it to its parent if it is not already attached
and is cached off-heap.
|
long |
log() |
long |
log(boolean allowDeltas,
boolean isProvisional,
boolean backgroundIO,
IN parent) |
long |
log(boolean allowDeltas,
Provisional provisional,
boolean backgroundIO,
IN parent) |
void |
logDirtyChildren()
When splits and checkpoints intermingle in a deferred write databases,
a checkpoint target may appear which has a valid target but a null LSN.
|
static long |
logEntry(INLogEntry<BIN> logEntry,
Provisional provisional,
boolean backgroundIO,
IN parent) |
boolean |
logicalEquals(Loggable other) |
String |
makeFetchErrorMsg(String msg,
long lsn,
int idx) |
void |
materialize(ByteBuffer itemBuffer,
int entryVersion,
boolean deltasOnly,
boolean clearDirtyBits)
WARNING: In the case of BINs this method is used not only for logging
but also for off-heap caching.
|
boolean |
mayHaveExpirationValues(ByteBuffer itemBuffer,
int entryVersion)
Returns whether the given serialized IN is a BIN that may have
expiration values.
|
void |
mutateToFullBIN(boolean leaveFreeSlot) |
boolean |
needsSplitting()
Return true if this node needs splitting.
|
long |
partialEviction()
Try to compact or otherwise reclaim memory in this IN and return the
number of bytes reclaimed.
|
void |
pin() |
void |
postFetchInit(DatabaseImpl db,
long fetchedLsn)
Initialize a node that has been read in from the log.
|
void |
postRecoveryInit(DatabaseImpl db,
long lastLoggedLsn)
Initialize a node read in during recovery.
|
void |
prepareForSlotReuse(int idx)
Called prior to changing a slot to contain a different logical node.
|
protected long |
printMemorySize() |
void |
readFromLog(ByteBuffer itemBuffer,
int entryVersion)
Initialize this object from the data in itemBuf.
|
void |
readFromLog(ByteBuffer itemBuffer,
int entryVersion,
boolean deltasOnly) |
void |
recalcKeyPrefix()
Forces computation of the key prefix, without requiring a split.
|
void |
recoverIN(int idx,
Node node,
long lsn,
int lastLoggedSize)
Update the cached-child and LSN properties of the idx-th slot.
|
void |
recoverRecord(int idx,
long lsn,
boolean knownDeleted,
boolean pendingDeleted,
byte[] key,
byte[] data,
long vlsn,
int logrecSize,
int expiration,
boolean expirationInHours)
This method is used by the RecoveryManager to change the current version
of a record, either to a later version (in case of redo), or to an
earlier version (in case of undo).
|
void |
releaseLatch()
Release the latch on this node.
|
void |
releaseLatchIfOwner()
Release the latch on this node if it is owned.
|
long |
resetAndGetMemorySize()
Called as part of a memory budget reset (during a checkpoint) to clear
the accumulated delta and return the total memory size.
|
void |
serialize(ByteBuffer logBuffer,
boolean deltasOnly,
boolean clearDirtyBits)
WARNING: In the case of BINs this method is not only used for logging
but also for off-heap caching.
|
void |
setDatabase(DatabaseImpl db)
Set the database reference for this node.
|
void |
setDirty(boolean dirty) |
void |
setFetchedCold(boolean val) |
void |
setFetchedColdOffHeap(boolean val) |
void |
setFetchINHook(TestHook hook) |
void |
setIdentifierKey(byte[] key,
boolean makeDirty)
Set the identifier key for this node.
|
void |
setInListResident(boolean resident)
Called when adding/removing this IN to/from the INList.
|
void |
setInPri2LRU(boolean value) |
boolean |
setKey(int idx,
byte[] key,
byte[] data,
boolean isInsertion)
This method inserts or updates a key at a given slot.
|
void |
setKnownDeleted(int idx)
Set KD flag to true and clear the PD flag (PD does not need to be on
if KD is on).
|
void |
setKnownDeletedAndEvictLN(int index)
Set knownDeleted flag to true and evict the child LN if cached.
|
void |
setLastFullLsn(long lsn)
Sets the last full version LSN.
|
void |
setLastLoggedLsn(long lsn)
Sets the last logged LSN, which for a BIN may be a delta.
|
void |
setLastLoggedSize(int idx,
int lastLoggedSize)
The last logged size is not stored for UINs.
|
void |
setLsn(int idx,
long lsn)
Set the LSN of the idx'th slot, mark the slot dirty, and update
memory consuption.
|
void |
setNextLRUNode(IN node) |
void |
setOffHeapBINId(int idx,
int val,
boolean pri2,
boolean dirty) |
void |
setParent(IN in) |
void |
setPendingDeleted(int idx)
Set pendingDeleted to true.
|
void |
setPrevLRUNode(IN node) |
void |
setProhibitNextDelta(boolean val)
Disallow delta on next log.
|
void |
setRecalcToggle(boolean toggle) |
String |
shortClassName() |
IN |
split(IN parent,
int childIndex,
IN grandParent,
int maxEntries)
Split this into two nodes.
|
String |
toSafeString(int... slotIndexes)
Converts to an identifying string that is safe to output in a log.
|
String |
toString()
Default toString method at the root of the tree.
|
void |
unpin() |
void |
updateEntry(int idx,
long newLSN,
long newVLSN,
int newSize)
This method is called after the idx'th child of this node gets logged,
and changes position as a result.
|
void |
updateLRU(CacheMode cacheMode) |
void |
updateMemoryBudget()
Move the accumulated delta to the memory budget.
|
protected void |
updateMemorySize(long oldSize,
long newSize) |
void |
updateRecord(int idx,
long oldMemSize,
long newLSN,
long newVLSN,
int newSize,
byte[] newKey,
byte[] newData,
int expiration,
boolean expirationInHours)
Update the idx slot of this BIN to reflect an update of the associated
record.
|
protected void |
updateRepCacheStats(boolean increment)
Adds (increments) or removes (decrements) the cache stats for the key
and target representations.
|
boolean |
verifyMemorySize() |
void |
writeToLog(ByteBuffer logBuffer)
Serialize this object into the buffer.
|
void |
writeToLog(ByteBuffer logBuffer,
boolean deltasOnly) |
containsDuplicates, dump, getMemorySizeIncludedByParent, getTransactionId, getType, isBIN, isDBIN, isDIN, isLNpublic static final int MAX_FILE_OFFSET
public static final int DBMAP_LEVEL
public static final int MAIN_LEVEL
public static final int LEVEL_MASK
public static final int MIN_LEVEL
public static final int BIN_LEVEL
public static final int EXACT_MATCH
public static final int INSERT_SUCCESS
public static final long NON_EVICTABLE_IN
public static boolean disableCompactLsns
public static final int ACCUMULATED_LIMIT_DEFAULT
public static int ACCUMULATED_LIMIT
public IN()
public IN(DatabaseImpl dbImpl, byte[] identifierKey, int capacity, int level)
public IN(SizeofMarker marker)
protected void init(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level)
public final String getLatchName()
LatchContextgetLatchName in interface LatchContextpublic final int getLatchTimeoutMs()
LatchContextgetLatchTimeoutMs in interface LatchContextpublic final LatchTable getLatchTable()
LatchContextgetLatchTable in interface LatchContextpublic final boolean latchNoWait(CacheMode cacheMode)
public void latch(CacheMode cacheMode)
public final void latch()
public void latchShared(CacheMode cacheMode)
latchShared in class Nodepublic final void latchShared()
latchShared in class Nodepublic final void latchNoUpdateLRU(DatabaseImpl db)
db - is passed in order to initialize the database for an
uninitialized node, which is necessary in order to latch it.public final void latchNoUpdateLRU()
public final void releaseLatch()
releaseLatch in class Nodepublic final void releaseLatchIfOwner()
public final boolean isLatchOwner()
public final boolean isLatchExclusiveOwner()
public final int getLatchNWaiters()
public final void updateLRU(CacheMode cacheMode)
public IN getParent()
public void setParent(IN in)
public final IN latchParent()
EnvironmentFailureException - (fatal) if the parent latch is
already held.public int getKnownChildIndex(Node child)
public final void pin()
public final void unpin()
public final boolean isPinned()
public final DatabaseImpl getDatabase()
public final void setDatabase(DatabaseImpl db)
public final DatabaseId getDatabaseId()
public final EnvironmentImpl getEnvImplForFatalException()
LatchContextgetEnvImplForFatalException in interface LatchContextpublic final EnvironmentImpl getEnv()
public final Comparator<byte[]> getKeyComparator()
public final int getLevel()
Nodepublic final int getNormalizedLevel()
public final long getNodeId()
public final int hashCode()
public final int compareTo(IN argIN)
compareTo in interface Comparable<IN>public final boolean getDirty()
public final void setDirty(boolean dirty)
public final boolean isBINDelta()
isBINDelta in class Nodepublic final boolean isBINDelta(boolean checkLatched)
isBINDelta in class Nodepublic final boolean getFetchedCold()
public final void setFetchedCold(boolean val)
getFetchedCold()public final boolean getFetchedColdOffHeap()
getFetchedCold()public final void setFetchedColdOffHeap(boolean val)
getFetchedCold()public final boolean getRecalcToggle()
public final void setRecalcToggle(boolean toggle)
public final boolean isRoot()
public final boolean hasCachedChildrenFlag()
public final boolean isInPri2LRU()
public final void setInPri2LRU(boolean value)
public boolean isExpirationInHours()
public final byte[] getIdentifierKey()
public final void setIdentifierKey(byte[] key,
boolean makeDirty)
key - - the new identifier key for this node.makeDirty - should normally be true, but may be false when an
expired slot containing the identifier key has been deleted.public final int getNEntries()
public int getMaxEntries()
public final byte getState(int idx)
public final boolean isDirty(int idx)
public final boolean isEntryPendingDeleted(int idx)
public final void setPendingDeleted(int idx)
public final boolean isEntryKnownDeleted(int idx)
public final void setKnownDeleted(int idx)
public final void setKnownDeletedAndEvictLN(int index)
public final boolean isEmbeddedLN(int idx)
public static boolean isEmbeddedLN(byte state)
public final boolean isNoDataLN(int idx)
public static boolean isNoDataLN(byte state)
public final boolean haveEmbeddedData(int idx)
public final int getNumEmbeddedLNs()
public final INKeyRep getKeyVals()
public final byte[] getKeyPrefix()
public final boolean hasKeyPrefix()
public final byte[] getKey(int idx)
public final byte[] getData(int idx)
public boolean setKey(int idx,
byte[] key,
byte[] data,
boolean isInsertion)
data - If the data portion of a record must be embedded in this
BIN, "data" stores the record's data. Null otherwise. See also comment
for the keyEntries field.public final void recalcKeyPrefix()
public final boolean isKeyInBounds(byte[] key)
public final long getLsn(int idx)
public void setLsn(int idx,
long lsn)
public void setLastLoggedSize(int idx,
int lastLoggedSize)
public void clearLastLoggedSize(int idx)
public int getLastLoggedSize(int idx)
public void setOffHeapBINId(int idx,
int val,
boolean pri2,
boolean dirty)
public void clearOffHeapBINId(int idx)
public int getOffHeapBINId(int idx)
public boolean hasOffHeapBINIds()
public long getOffHeapBINIdsMemorySize()
public boolean isOffHeapBINDirty(int idx)
public boolean isOffHeapBINPri2(int idx)
public final INTargetRep getTargets()
public final Node getTarget(int idx)
public IN fetchIN(int idx, CacheMode cacheMode)
idx - The slot of the child to fetch.public IN loadIN(int idx, CacheMode cacheMode)
idx - The slot of the child to fetch.public final LN fetchLN(int idx, CacheMode cacheMode)
public final LN getLN(int idx, CacheMode cacheMode)
public final void postFetchInit(DatabaseImpl db, long fetchedLsn)
postFetchInit in class Nodepublic final void postRecoveryInit(DatabaseImpl db, long lastLoggedLsn)
public final int findEntry(byte[] key,
boolean indicateIfDuplicate,
boolean exact)
public final int findEntry(byte[] key,
boolean indicateIfDuplicate,
boolean exact,
Comparator<byte[]> comparator)
key - - the key to search for.indicateIfDuplicate - - true if EXACT_MATCH should
be or'd onto the return value if key is already present in this node.exact - - true if an exact match must be found.public final boolean insertEntry(Node child, byte[] key, long childLsn) throws DatabaseException
EnvironmentFailureException - if the node is full
(it should have been split earlier).DatabaseExceptionpublic final int insertEntry1(Node child, byte[] key, byte[] data, long childLsn, boolean blindInsertion)
data - If the data portion of a record must be embedded in this
BIN, "data" stores the record's data. Null otherwise. See also comment
for the keyEntries field.EnvironmentFailureException - if the node is full (it should have
been split earlier).public final int insertEntry1(Node child, byte[] key, byte[] data, long childLsn, byte state, boolean blindInsertion)
data - If the data portion of a record must be embedded in this
BIN, "data" stores the record's data. Null otherwise. See also comment
for the keyEntries field.EnvironmentFailureException - if the node is full (it should have
been split earlier).public void deleteEntry(int index)
index - The index of the entry to delete from the IN.public final void updateEntry(int idx,
long newLSN,
long newVLSN,
int newSize)
newLSN - The new on-disk position of the child.newVLSN - The VLSN of the logrec at the new position.
For LN children only.newSize - The size of the logrec at the new position.
For LN children only.public final void insertRecord(int idx,
LN newLN,
long newLSN,
int newSize,
byte[] newKey,
byte[] newData,
int expiration,
boolean expirationInHours)
newLN - The LN associated with the new record.newLSN - The LSN of the insertion logrec.newSize - The size of the insertion logrec.newKey - The value for the record's key. It is equal to the current
key value in the slot, but may not be identical to that value if a
custom comparator is used.newData - If the record's data must be embedded in this BIN, "data"
stores the record's data. Null otherwise. See also comment for the
keyEntries field.public final void updateRecord(int idx,
long oldMemSize,
long newLSN,
long newVLSN,
int newSize,
byte[] newKey,
byte[] newData,
int expiration,
boolean expirationInHours)
oldMemSize - If the child LN was cached before the update op, it has
already been updated in-place by the caller. In this case, oldMemSize
stores the size of the child LN before the update, and it is used to do
memory counting. Otherwise oldMemSize is 0 and the newly created LN has
not been attached to the tree; it will be attached later by the caller,
if needed.newLSN - The LSN of the update logrec.newVLSN - The VLSN of the update logrec.newSize - The on-disk size of the update logrec.newKey - The new value for the record's key. It is equal to the
current value, but may not be identical to the current value if a
custom comparator is used. It may be null, if the caller knows for
sure that the key does not change.newData - If the record's data must be embedded in this BIN, "data"
stores the record's data. Null otherwise. See also comment for the
keyEntries field.public final void deleteRecord(int idx,
long oldMemSize,
long newLSN,
long newVLSN,
int newSize)
oldMemSize - If the child LN was cached before the deletion, it
has already been updated in-place by the caller (the ln contents have
been deleted). In this case, oldMemSize stores the in-memory size of
the child LN before the update, and it is used to do memory counting.
Otherwise oldMemSize is 0 and the newly created LN has not been attached
to the tree; it will be attached later by the caller, if needed.newLSN - The LSN of the deletion logrec.newVLSN - The VLSN of the deletion logrec.newSize - The on-disk size of the deletion logrec.public final void recoverRecord(int idx,
long lsn,
boolean knownDeleted,
boolean pendingDeleted,
byte[] key,
byte[] data,
long vlsn,
int logrecSize,
int expiration,
boolean expirationInHours)
idx - The BIN slot for the record.lsn - The LSN of the new record version. It may be null in case of
undo, if the logrec that is being undone is an insertion and the record
did not exist at all in the DB before that insertion.knownDeleted - True if the new version is a committed deletion.pendingDeleted - True if the new version is a deletion, which
may or may not be committed.key - The key of the new version. It is null only if we are undoing
and the revert-to version was not embedded (in this case the key of the
revert-to version is not stored in the logrec). If it is null and the
DB allows key updates, the new record version is fetched from disk to
retrieve its key, so that the key values stored in the BIN slots are
always transactionally correct.data - The data of the new version. It is non-null if and only if
the new version must be embedded in the BIN.vlsn - The VLSN of the new version.logrecSize - The on-disk size of the logrec corresponding to the
new version. It may be 0 (i.e. unknown) in case of undo.public final void recoverIN(int idx,
Node node,
long lsn,
int lastLoggedSize)
public final void attachNode(int idx,
Node node,
byte[] newKey)
public final void detachNode(int idx,
boolean updateLsn,
long newLsn)
public final void convertKey(int idx,
byte[] newKey)
public final boolean needsSplitting()
public final IN split(IN parent, int childIndex, IN grandParent, int maxEntries)
public void prepareForSlotReuse(int idx)
public long getInMemorySize()
public long computeMemorySize()
protected long getFixedMemoryOverhead()
public long compactMemory()
public long getBudgetedMemorySize()
public long resetAndGetMemorySize()
protected void updateMemorySize(long oldSize,
long newSize)
public void updateMemoryBudget()
protected long printMemorySize()
public boolean verifyMemorySize()
protected void updateRepCacheStats(boolean increment)
protected int getCompactMaxKeyLength()
public void setInListResident(boolean resident)
public boolean getInListResident()
public IN getPrevLRUNode()
public void setPrevLRUNode(IN node)
public IN getNextLRUNode()
public void setNextLRUNode(IN node)
public long partialEviction()
public boolean hasCachedChildren()
public void setProhibitNextDelta(boolean val)
public boolean getProhibitNextDelta()
public void setLastLoggedLsn(long lsn)
public final long getLastLoggedLsn()
public final void setLastFullLsn(long lsn)
public final long getLastFullLsn()
public long getLastDeltaLsn()
public void logDirtyChildren()
throws DatabaseException
DatabaseExceptionpublic final long log()
public final long log(boolean allowDeltas,
boolean isProvisional,
boolean backgroundIO,
IN parent)
public final long log(boolean allowDeltas,
Provisional provisional,
boolean backgroundIO,
IN parent)
public static long logEntry(INLogEntry<BIN> logEntry, Provisional provisional, boolean backgroundIO, IN parent)
public void mutateToFullBIN(boolean leaveFreeSlot)
public final int getNDeltas()
public final LogEntryType getGenericLogType()
NodegetGenericLogType in class NodeNode.getGenericLogType()public LogEntryType getLogType()
public int getLogSize()
getLogSize in interface LoggableOverrriden by DIN and DBIN classes.public final int getLogSize(boolean deltasOnly)
public void writeToLog(ByteBuffer logBuffer)
LoggablewriteToLog in interface LoggablelogBuffer - is the destination bufferpublic void writeToLog(ByteBuffer logBuffer, boolean deltasOnly)
public final void serialize(ByteBuffer logBuffer, boolean deltasOnly, boolean clearDirtyBits)
public boolean mayHaveExpirationValues(ByteBuffer itemBuffer, int entryVersion)
public void readFromLog(ByteBuffer itemBuffer, int entryVersion)
LoggablereadFromLog in interface LoggableitemBuffer - the source bufferentryVersion - the log version of the datapublic void readFromLog(ByteBuffer itemBuffer, int entryVersion, boolean deltasOnly)
public final void materialize(ByteBuffer itemBuffer, int entryVersion, boolean deltasOnly, boolean clearDirtyBits)
public final boolean logicalEquals(Loggable other)
logicalEquals in interface LoggableAlways return false, this item should never be compared.public final void dumpLog(StringBuilder sb, boolean verbose)
LoggabledumpLog in interface Loggablesb - destination string bufferverbose - if true, dump the full, verbose versionLoggable.dumpLog(java.lang.StringBuilder, boolean)protected void dumpLogAdditional(StringBuilder sb)
public String beginTag()
public String endTag()
public String dumpString(int nSpaces, boolean dumpTags)
public String toSafeString(int... slotIndexes)
public String toString()
Nodepublic String shortClassName()
public final void setFetchINHook(TestHook hook)
Copyright © 2024. All rights reserved.