| java.lang.Object com.sleepycat.je.tree.Node com.sleepycat.je.tree.IN
All known Subclasses: com.sleepycat.je.tree.DIN, com.sleepycat.je.tree.BIN,
Constructor Summary | |
public | IN() Create an empty IN, with no node id, to be filled in from the log. | public | IN(DatabaseImpl db, byte[] identifierKey, int capacity, int level) Create a new IN. |
Method Summary | |
void | accountForSubtreeRemoval(INList inList, UtilizationTracker tracker) Remove self and children from the in-memory IN list. | void | accumulateStats(TreeWalkerStatsAccumulator acc) | void | adjustCursors(IN newSibling, int newSiblingLow, int newSiblingHigh) | void | adjustCursorsForInsert(int insertIndex) | public String | beginTag() | protected boolean | canBeAncestor(boolean targetContainsDuplicates) | void | clearKnownDeleted(int idx) Set knownDeleted to false. | public void | clearPendingDeleted(int idx) Set pendingDeleted to false. | public int | compareTo(Object o) Sort based on node id. | public boolean | compress(BINReference binRef, boolean canFetch, UtilizationTracker tracker) | protected static long | computeArraysOverhead(DbConfigManager configManager) | protected long | computeMemorySize() Count up the memory usage attributable to this node alone. | public static long | computeOverhead(DbConfigManager configManager) | protected IN | createNewInstance(byte[] identifierKey, int maxEntries, int level) Create a new IN. | boolean | deleteEntry(byte[] key, boolean maybeValidate) Deletes the ChildReference with the key arg from this IN. | public boolean | deleteEntry(int index, boolean maybeValidate) Deletes the ChildReference at index from this IN. | protected void | descendOnParentSearch(SearchResult result, boolean targetContainsDuplicates, boolean targetIsRoot, long targetNodeId, Node child, boolean requireExactMatch) | static void | dumpDeletedState(StringBuffer sb, byte state) Utility method for output of knownDeleted and pendingDelete. | void | dumpKeys() | public void | dumpLog(StringBuffer sb, boolean verbose) | protected void | dumpLogAdditional(StringBuffer sb) Allows subclasses to add additional fields before the end tag. | public String | dumpString(int nSpaces, boolean dumpTags) | public String | endTag() | boolean | entryZeroKeyComparesLow() Indicates whether whether entry 0's key is "special" in that it always
compares less than any other key. | public boolean | equals(Object obj) | public Node | fetchTarget(int idx) Returns the target of the idx'th entry or null if a pendingDeleted or
knownDeleted entry has been cleaned. | public int | findEntry(byte[] key, boolean indicateIfDuplicate, boolean exact) Find the entry in this IN for which key arg is >= the key.
Currently uses a binary search, but eventually, this may use binary or
linear search depending on key size, number of entries, etc.
Note that the 0'th entry's key is treated specially in an IN. | void | findParent(Tree.SearchType searchType, long targetNodeId, boolean targetContainsDuplicates, boolean targetIsRoot, byte[] targetMainTreeKey, byte[] targetDupTreeKey, SearchResult result, boolean requireExactMatch, boolean updateGeneration, int targetLevel, List trackingList, boolean doFetch) See if you are the parent of this child. | void | flushProvisionalObsolete(LogManager logManager) Adds the provisional obsolete tracking information in this node to the
live tracker. | protected int | generateLevel(DatabaseId dbId, int newLevel) | public int | getAccumulatedDelta() | int | getChildEvictionType() Returns the eviction type based on the status of child nodes,
irrespective of isEvictionProhibited. | public byte[] | getChildKey(IN child) Get the key (dupe or identifier) in child that is used to locate it in
'this' node. | public DatabaseImpl | getDatabase() Get the database for this IN. | public DatabaseId | getDatabaseId() | public boolean | getDirty() | public byte[] | getDupKey() Return the key for this duplicate set. | public byte[] | getDupTreeKey() Return the key for navigating through the duplicate tree. | protected long | getEntryInMemorySize(byte[] key, Node target) | byte[] | getEntryLsnByteArray() | long[] | getEntryLsnLongArray() | public int | getEvictionType() Returns the eviction type for this IN, for use by the evictor. | public long | getGeneration() | public byte[] | getIdentifierKey() | public long | getInMemorySize() Return the number of bytes used by this IN. | public byte[] | getKey(int idx) Return the idx'th key. | public Comparator | getKeyComparator() Return the relevant user defined comparison function for this type of
node. | public long | getLastFullVersion() Returns the last logged LSN, or null if never logged. | public int | getLevel() | public int | getLogSize() | public LogEntryType | getLogType() | public long | getLsn(int idx) Return the idx'th LSN for this entry. | public byte[] | getMainTreeKey() Return the key for navigating through the main tree. | int | getMaxEntries() | protected long | getMemoryOverhead(MemoryBudget mb) | public boolean | getMigrate(int idx) Get the idx'th migrate status. | public int | getNEntries() | public byte | getState(int idx) | public Node | getTarget(int idx) Return the idx'th target. | boolean | hasPinnedChildren() Returns whether any resident children are not LNs (are INs). | final boolean | hasResidentChildren() Returns whether any child is non-null. | public int | hashCode() | protected void | init(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level) Initialize IN object. | void | initEntryLsn(int capacity) | protected void | initMemorySize() Initialize the per-node memory count by computing its memory usage. | public boolean | insertEntry(ChildReference entry) Inserts the argument ChildReference into this IN. | public int | insertEntry1(ChildReference entry) Same as insertEntry except that it returns the index where the dup was
found instead of false. | boolean | isAlwaysLatchedExclusively() | public boolean | isCompressible() | public boolean | isDbRoot() | boolean | isDirty(int idx) | public boolean | isEntryKnownDeleted(int idx) true if the idx'th entry is deleted for sure. | public boolean | isEntryPendingDeleted(int idx) | public boolean | isEvictable() Returns whether this node can be evicted. | boolean | isEvictionProhibited() Returns whether the node is not evictable, irrespective of the status
of the children nodes. | public boolean | isKeyInBounds(byte[] keyVal) 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. | public boolean | isLatchOwnerForRead() | public boolean | isLatchOwnerForWrite() | public boolean | isRoot() | protected boolean | isSoughtNode(long nid, boolean updateGeneration) | static boolean | isStateKnownDeleted(byte state) Returns true if the given state is known deleted. | static boolean | isStatePendingDeleted(byte state) Returns true if the given state is known deleted. | boolean | isValidForDelete() Check if this node fits the qualifications for being part of a deletable
subtree. | public void | latch(boolean updateGeneration) Latch this node exclusive, optionally setting the generation. | public void | latch() Latch this node exclusive and set the generation. | public boolean | latchNoWait(boolean updateGeneration) Latch this node if it is not latched by another thread, optionally
setting the generation if the latch succeeds. | public boolean | latchNoWait() Latch this node if it is not latched by another thread, and set the
generation if the latch succeeds. | public void | latchShared(boolean updateGeneration) Latch this node shared, optionally setting the generation. | public void | latchShared() Latch this node shared and set the generation. | public long | log(LogManager logManager) Log this IN and clear the dirty flag. | public long | log(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent) Log this node with all available options. | public 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.
Deferred write dbs are written out in checkpoint style by either
Database.sync() or a checkpoint which has cleaned a file containing
deferred write entries. | protected long | logInternal(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent) Decide how to log this node. | static String | makeFetchErrorMsg(String msg, IN in, long lsn, byte state) | public boolean | needsSplitting() Return true if this node needs splitting. | boolean | notOverwritingDeferredWriteEntry(long newLsn) When a deferred write database calls one of the optionalLog methods,
it may receive a DbLsn.NULL_LSN as the return value, because the
logging didn't really happen. | public long | optionalLog(LogManager logManager) Log this IN and clear the dirty flag. | public long | optionalLogProvisional(LogManager logManager, IN parent) Log this node provisionally and clear the dirty flag. | public void | postFetchInit(DatabaseImpl db, long sourceLsn) Initialize a node that has been read in from the log. | public void | postRecoveryInit(DatabaseImpl db, long sourceLsn) Initialize a node read in during recovery. | public void | readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion) | void | rebuildINList(INList inList) Add self and children to this in-memory IN list. | public void | releaseLatch() Release the latch on this node. | public void | releaseLatchIfOwner() Release the latch on this node. | public byte[] | selectKey(byte[] mainTreeKey, byte[] dupTreeKey) | public void | setDatabase(DatabaseImpl db) Set the database reference for this node. | public void | setDirty(boolean dirty) | public void | setEntry(int idx, Node target, byte[] keyVal, long lsn, byte state) Set the idx'th entry of this node. | public void | setGeneration() | public void | setGeneration(long newGeneration) | void | setIdentifierKey(byte[] key) Set the identifier key for this node. | public void | setInListResident(boolean resident) | void | setIsRoot(boolean isRoot) | void | setKnownDeleted(int idx) Set knownDeleted to true. | void | setLastFullLsn(long lsn) Sets the last logged LSN. | void | setLsnElement(int idx, long value) | public void | setMigrate(int idx, boolean migrate) Set the idx'th migrate status. | public void | setPendingDeleted(int idx) Set pendingDeleted to true. | public void | setProhibitNextDelta() Do nothing since INs don't support deltas. | void | setTarget(int idx, Node target) Sets the idx'th target. | public String | shortClassName() | void | split(IN parent, int childIndex, int maxEntries) Split this into two nodes. | protected void | splitInternal(IN parent, int childIndex, int maxEntries, int splitIndex) | void | splitSpecial(IN parent, int parentIndex, int maxEntriesPerNode, byte[] key, boolean leftSide) Called when we know we are about to split on behalf of a key that is the
minimum (leftSide) or maximum (!leftSide) of this node. | public String | toString() | void | trackProvisionalObsolete(IN child, long obsoleteLsn1, long obsoleteLsn2) Adds the given obsolete LSNs and any tracked obsolete LSNs for the given
child IN to this IN's tracking list. | public void | updateEntry(int idx, Node node) Update the idx'th entry of this node. | public void | updateEntry(int idx, Node node, long lsn) Update the idx'th entry of this node. | public void | updateEntry(int idx, Node node, long lsn, byte[] key) Update the idx'th entry of this node. | public void | updateEntry(int idx, long lsn) Update the idx'th entry of this node. | public void | updateEntry(int idx, long lsn, byte state) Update the idx'th entry of this node. | public void | updateEntry(int idx, long lsn, long oldLNSize, long newLNSize) Update the idx'th entry of this node. | public void | updateKeyIfChanged(int idx, byte[] newKey) Updates the idx'th key of this node if it is not identical to the given
key. | protected void | updateMemorySize(ChildReference oldRef, ChildReference newRef) | protected void | updateMemorySize(long oldSize, long newSize) | void | updateMemorySize(Node oldNode, Node newNode) | boolean | validateSubtreeBeforeDelete(int index) | public void | verify(byte[] maxKey) Check that the IN is in a valid state. | public boolean | verifyMemorySize() | public void | writeToLog(ByteBuffer logBuffer) |
ACCUMULATED_LIMIT | public static int ACCUMULATED_LIMIT(Code) | | |
BIN_LEVEL | final public static int BIN_LEVEL(Code) | | |
DBMAP_LEVEL | final public static int DBMAP_LEVEL(Code) | | |
EXACT_MATCH | final public static int EXACT_MATCH(Code) | | |
INSERT_SUCCESS | final public static int INSERT_SUCCESS(Code) | | |
LEVEL_MASK | final public static int LEVEL_MASK(Code) | | |
MAIN_LEVEL | final public static int MAIN_LEVEL(Code) | | |
MAX_LEVEL | final public static int MAX_LEVEL(Code) | | |
MAY_EVICT_LNS | final public static int MAY_EVICT_LNS(Code) | | |
MAY_EVICT_NODE | final public static int MAY_EVICT_NODE(Code) | | |
MAY_NOT_EVICT | final public static int MAY_NOT_EVICT(Code) | | |
MIN_LEVEL | final public static int MIN_LEVEL(Code) | | |
IN | public IN()(Code) | | Create an empty IN, with no node id, to be filled in from the log.
|
IN | public IN(DatabaseImpl db, byte[] identifierKey, int capacity, int level)(Code) | | Create a new IN.
|
accountForSubtreeRemoval | void accountForSubtreeRemoval(INList inList, UtilizationTracker tracker) throws DatabaseException(Code) | | Remove self and children from the in-memory IN list. The INList latch is
already held before this is called. Also count removed nodes as
obsolete.
|
adjustCursors | void adjustCursors(IN newSibling, int newSiblingLow, int newSiblingHigh)(Code) | | |
adjustCursorsForInsert | void adjustCursorsForInsert(int insertIndex)(Code) | | |
canBeAncestor | protected boolean canBeAncestor(boolean targetContainsDuplicates)(Code) | | |
clearKnownDeleted | void clearKnownDeleted(int idx)(Code) | | Set knownDeleted to false.
|
clearPendingDeleted | public void clearPendingDeleted(int idx)(Code) | | Set pendingDeleted to false.
|
compareTo | public int compareTo(Object o)(Code) | | Sort based on node id.
|
computeMemorySize | protected long computeMemorySize()(Code) | | Count up the memory usage attributable to this node alone. LNs children
are counted by their BIN/DIN parents, but INs are not counted by their
parents because they are resident on the IN list.
|
createNewInstance | protected IN createNewInstance(byte[] identifierKey, int maxEntries, int level)(Code) | | Create a new IN. Need this because we can't call newInstance() without
getting a 0 for nodeid.
|
deleteEntry | boolean deleteEntry(byte[] key, boolean maybeValidate) throws DatabaseException(Code) | | Deletes the ChildReference with the key arg from this IN. Assumes this
node is already latched by the caller.
This seems to only be used by INTest.
Parameters: key - The key of the reference to delete from the IN. Parameters: maybeValidate - true if assert validation should occur prior todelete. Set this to false during recovery. true if the entry was successfully deleted, false if it was notfound. |
deleteEntry | public boolean deleteEntry(int index, boolean maybeValidate) throws DatabaseException(Code) | | Deletes the ChildReference at index from this IN. Assumes this node is
already latched by the caller.
Parameters: index - The index of the entry to delete from the IN. Parameters: maybeValidate - true if asserts are enabled. true if the entry was successfully deleted, false if it was notfound. |
descendOnParentSearch | protected void descendOnParentSearch(SearchResult result, boolean targetContainsDuplicates, boolean targetIsRoot, long targetNodeId, Node child, boolean requireExactMatch) throws DatabaseException(Code) | | |
dumpDeletedState | static void dumpDeletedState(StringBuffer sb, byte state)(Code) | | Utility method for output of knownDeleted and pendingDelete.
|
dumpLogAdditional | protected void dumpLogAdditional(StringBuffer sb)(Code) | | Allows subclasses to add additional fields before the end tag. If they
just overload dumpLog, the xml isn't nested.
|
dumpString | public String dumpString(int nSpaces, boolean dumpTags)(Code) | | For unit test support:
a string that dumps information about this IN, without |
entryZeroKeyComparesLow | boolean entryZeroKeyComparesLow()(Code) | | Indicates whether whether entry 0's key is "special" in that it always
compares less than any other key. BIN's don't have the special key, but
IN's do.
|
fetchTarget | public Node fetchTarget(int idx) throws DatabaseException(Code) | | Returns the target of the idx'th entry or null if a pendingDeleted or
knownDeleted entry has been cleaned. Note that null can only be
returned for a slot that could contain a deleted LN, not other node
types and not a DupCountLN since DupCountLNs are never deleted. Null is
also returned for a KnownDeleted slot with a NULL_LSN.
the target node or null. |
findEntry | public int findEntry(byte[] key, boolean indicateIfDuplicate, boolean exact)(Code) | | Find the entry in this IN for which key arg is >= the key.
Currently uses a binary search, but eventually, this may use binary or
linear search depending on key size, number of entries, etc.
Note that the 0'th entry's key is treated specially in an IN. It always
compares lower than any other key.
This is public so that DbCursorTest can access it.
Parameters: key - - the key to search for. Parameters: indicateIfDuplicate - - true if EXACT_MATCH shouldbe or'd onto the return value if key is already present in this node. Parameters: exact - - true if an exact match must be found. offset for the entry that has a key >= the arg. 0 if keyis less than the 1st entry. -1 if exact is true and no exact matchis found. If indicateIfDuplicate is true and an exact match was foundthen EXACT_MATCH is or'd onto the return value. |
findParent | void findParent(Tree.SearchType searchType, long targetNodeId, boolean targetContainsDuplicates, boolean targetIsRoot, byte[] targetMainTreeKey, byte[] targetDupTreeKey, SearchResult result, boolean requireExactMatch, boolean updateGeneration, int targetLevel, List trackingList, boolean doFetch) throws DatabaseException(Code) | | See if you are the parent of this child. If not, find a child of your's
that may be the parent, and return it. If there are no possiblities,
return null. Note that the keys of the target are passed in so we don't
have to latch the target to look at them. Also, this node is latched
upon entry.
Parameters: doFetch - If true, fetch the child in the pursuit of this search.If false, give up if the child is not resident. In that case, we havea potential ancestor, but are not sure if this is the parent. |
flushProvisionalObsolete | void flushProvisionalObsolete(LogManager logManager) throws DatabaseException(Code) | | Adds the provisional obsolete tracking information in this node to the
live tracker. This method is called when this node is logged
non-provisionally.
|
getAccumulatedDelta | public int getAccumulatedDelta()(Code) | | |
getChildEvictionType | int getChildEvictionType()(Code) | | Returns the eviction type based on the status of child nodes,
irrespective of isEvictionProhibited.
|
getChildKey | public byte[] getChildKey(IN child) throws DatabaseException(Code) | | Get the key (dupe or identifier) in child that is used to locate it in
'this' node.
|
getDirty | public boolean getDirty()(Code) | | |
getDupTreeKey | public byte[] getDupTreeKey()(Code) | | Return the key for navigating through the duplicate tree.
|
getEntryInMemorySize | protected long getEntryInMemorySize(byte[] key, Node target)(Code) | | |
getEntryLsnByteArray | byte[] getEntryLsnByteArray()(Code) | | |
getEntryLsnLongArray | long[] getEntryLsnLongArray()(Code) | | |
getEvictionType | public int getEvictionType()(Code) | | Returns the eviction type for this IN, for use by the evictor. Uses the
internal isEvictionProhibited and getChildEvictionType methods that may
be overridden by subclasses.
This differs from isEvictable() because it does more detailed evaluation
about the degree of evictability. It's used generally when selecting
candidates for eviction.
MAY_EVICT_LNS if evictable LNs may be stripped; otherwise,MAY_EVICT_NODE if the node itself may be evicted; otherwise,MAY_NOT_EVICT. |
getGeneration | public long getGeneration()(Code) | | |
getIdentifierKey | public byte[] getIdentifierKey()(Code) | | the identifier key for this node. |
getInMemorySize | public long getInMemorySize()(Code) | | Return the number of bytes used by this IN. Latching is up to the
caller.
|
getKey | public byte[] getKey(int idx)(Code) | | Return the idx'th key.
|
getKeyComparator | public Comparator getKeyComparator()(Code) | | Return the relevant user defined comparison function for this type of
node. For IN's and BIN's, this is the BTree Comparison function.
|
getLastFullVersion | public long getLastFullVersion()(Code) | | Returns the last logged LSN, or null if never logged. Is public for
unit testing.
|
getLevel | public int getLevel()(Code) | | |
getLsn | public long getLsn(int idx)(Code) | | Return the idx'th LSN for this entry.
the idx'th LSN for this entry. |
getMainTreeKey | public byte[] getMainTreeKey()(Code) | | Return the key for navigating through the main tree.
|
getMaxEntries | int getMaxEntries()(Code) | | the maximum number of entries in this node. |
getMigrate | public boolean getMigrate(int idx)(Code) | | Get the idx'th migrate status.
|
getNEntries | public int getNEntries()(Code) | | the number of entries in this node. |
getState | public byte getState(int idx)(Code) | | |
getTarget | public Node getTarget(int idx)(Code) | | Return the idx'th target.
|
hasPinnedChildren | boolean hasPinnedChildren()(Code) | | Returns whether any resident children are not LNs (are INs).
For an IN, that equates to whether there are any resident children
at all.
|
hasResidentChildren | final boolean hasResidentChildren()(Code) | | Returns whether any child is non-null. Is final to indicate it is not
overridden (unlike hasPinnedChildren, isEvictionProhibited, etc).
|
hashCode | public int hashCode()(Code) | | |
init | protected void init(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level)(Code) | | Initialize IN object.
|
initEntryLsn | void initEntryLsn(int capacity)(Code) | | |
initMemorySize | protected void initMemorySize()(Code) | | Initialize the per-node memory count by computing its memory usage.
|
insertEntry | public boolean insertEntry(ChildReference entry) throws DatabaseException(Code) | | Inserts the argument ChildReference into this IN. Assumes this node is
already latched by the caller.
Parameters: entry - The ChildReference to insert into the IN. true if the entry was successfully inserted, falseif it was a duplicate. throws: InconsistentNodeException - if the node is full(it should have been split earlier). |
insertEntry1 | public int insertEntry1(ChildReference entry) throws DatabaseException(Code) | | Same as insertEntry except that it returns the index where the dup was
found instead of false. The return value is |'d with either
INSERT_SUCCESS or EXACT_MATCH depending on whether the entry was
inserted or it was a duplicate, resp.
This returns a failure if there's a duplicate match. The caller must do
the processing to check if the entry is actually deleted and can be
overwritten. This is foisted upon the caller rather than handled in this
object because there may be some latch releasing/retaking in order to
check a child LN.
Inserts the argument ChildReference into this IN. Assumes this node is
already latched by the caller.
Parameters: entry - The ChildReference to insert into the IN. either (1) the index of location in the IN where the entry wasinserted |'d with INSERT_SUCCESS, or (2) the index of the duplicate inthe IN |'d with EXACT_MATCH if the entry was found to be a duplicate. throws: InconsistentNodeException - if the node is full (it should havebeen split earlier). |
isAlwaysLatchedExclusively | boolean isAlwaysLatchedExclusively()(Code) | | |
isCompressible | public boolean isCompressible()(Code) | | |
isDbRoot | public boolean isDbRoot()(Code) | | |
isDirty | boolean isDirty(int idx)(Code) | | true if the object is dirty. |
isEntryKnownDeleted | public boolean isEntryKnownDeleted(int idx)(Code) | | true if the idx'th entry is deleted for sure. If a transactionperformed the deletion, it has been committed. |
isEntryPendingDeleted | public boolean isEntryPendingDeleted(int idx)(Code) | | true if the idx'th entry has been deleted, although thetransaction that performed the deletion may not be committed. |
isEvictable | public boolean isEvictable()(Code) | | Returns whether this node can be evicted. This is faster than
(getEvictionType() == MAY_EVICT_NODE) because it does a more static,
stringent check and is used by the evictor after a node has been
selected, to check that it is still evictable. The more complex
evaluation done by getEvictionType() is used when initially selecting
a node for inclusion in the eviction set.
|
isEvictionProhibited | boolean isEvictionProhibited()(Code) | | Returns whether the node is not evictable, irrespective of the status
of the children nodes.
|
isKeyInBounds | public boolean isKeyInBounds(byte[] keyVal)(Code) | | 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. This method
is used to determine whether a key to be inserted belongs in this IN,
without doing a tree search. If false is returned it is still possible
that the key belongs in this IN, but a tree search must be performed to
find out.
|
isLatchOwnerForRead | public boolean isLatchOwnerForRead()(Code) | | true if this thread holds the IN's latch |
isLatchOwnerForWrite | public boolean isLatchOwnerForWrite()(Code) | | |
isRoot | public boolean isRoot()(Code) | | |
isStateKnownDeleted | static boolean isStateKnownDeleted(byte state)(Code) | | Returns true if the given state is known deleted.
|
isStatePendingDeleted | static boolean isStatePendingDeleted(byte state)(Code) | | Returns true if the given state is known deleted.
|
isValidForDelete | boolean isValidForDelete() throws DatabaseException(Code) | | Check if this node fits the qualifications for being part of a deletable
subtree. It can only have one IN child and no LN children.
We assume that this is only called under an assert.
|
latch | public void latch(boolean updateGeneration) throws DatabaseException(Code) | | Latch this node exclusive, optionally setting the generation.
|
latchNoWait | public boolean latchNoWait(boolean updateGeneration) throws DatabaseException(Code) | | Latch this node if it is not latched by another thread, optionally
setting the generation if the latch succeeds.
|
latchNoWait | public boolean latchNoWait() throws DatabaseException(Code) | | Latch this node if it is not latched by another thread, and set the
generation if the latch succeeds.
|
latchShared | public void latchShared(boolean updateGeneration) throws DatabaseException(Code) | | Latch this node shared, optionally setting the generation.
|
log | public long log(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent) throws DatabaseException(Code) | | Log this node with all available options.
|
logDirtyChildren | public void logDirtyChildren() throws DatabaseException(Code) | | When splits and checkpoints intermingle in a deferred write databases,
a checkpoint target may appear which has a valid target but a null LSN.
Deferred write dbs are written out in checkpoint style by either
Database.sync() or a checkpoint which has cleaned a file containing
deferred write entries. For example,
INa
|
BINb
A checkpoint or Database.sync starts
The INList is traversed, dirty nodes are selected
BINb is bypassed on the INList, since it's not dirty
BINb is split, creating a new sibling, BINc, and dirtying INa
INa is selected as a dirty node for the ckpt
If this happens, INa is in the selected dirty set, but not its dirty
child BINb and new child BINc.
In a durable db, the existence of BINb and BINc are logged
anyway. But in a deferred write db, there is an entry that points to
BINc, but no logged version.
This will not cause problems with eviction, because INa can't be
evicted until BINb and BINc are logged, are non-dirty, and are detached.
But it can cause problems at recovery, because INa will have a null LSN
for a valid entry, and the LN children of BINc will not find a home.
To prevent this, search for all dirty children that might have been
missed during the selection phase, and write them out. It's not
sufficient to write only null-LSN children, because the existing sibling
must be logged lest LN children recover twice (once in the new sibling,
once in the old existing sibling.
|
logInternal | protected long logInternal(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent) throws DatabaseException(Code) | | Decide how to log this node. INs are always logged in full. Migration
never performed since it only applies to BINs.
|
needsSplitting | public boolean needsSplitting()(Code) | | Return true if this node needs splitting. For the moment, needing to be
split is defined by there being no free entries available.
|
notOverwritingDeferredWriteEntry | boolean notOverwritingDeferredWriteEntry(long newLsn)(Code) | | When a deferred write database calls one of the optionalLog methods,
it may receive a DbLsn.NULL_LSN as the return value, because the
logging didn't really happen. A NULL_LSN should never overwrite a
valid lsn (that resulted from Database.sync() or eviction), lest
we lose the handle to the last on disk version.
|
optionalLogProvisional | public long optionalLogProvisional(LogManager logManager, IN parent) throws DatabaseException(Code) | | Log this node provisionally and clear the dirty flag.
Parameters: item - object to be logged LSN of the new log entry |
postRecoveryInit | public void postRecoveryInit(DatabaseImpl db, long sourceLsn)(Code) | | Initialize a node read in during recovery.
|
rebuildINList | void rebuildINList(INList inList) throws DatabaseException(Code) | | Add self and children to this in-memory IN list. Called by recovery, can
run with no latching.
|
selectKey | public byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey)(Code) | | |
setDatabase | public void setDatabase(DatabaseImpl db)(Code) | | Set the database reference for this node.
|
setDirty | public void setDirty(boolean dirty)(Code) | | |
setEntry | public void setEntry(int idx, Node target, byte[] keyVal, long lsn, byte state)(Code) | | Set the idx'th entry of this node.
|
setGeneration | public void setGeneration()(Code) | | |
setGeneration | public void setGeneration(long newGeneration)(Code) | | |
setIdentifierKey | void setIdentifierKey(byte[] key)(Code) | | Set the identifier key for this node.
Parameters: key - - the new identifier key for this node. |
setInListResident | public void setInListResident(boolean resident)(Code) | | |
setIsRoot | void setIsRoot(boolean isRoot)(Code) | | |
setKnownDeleted | void setKnownDeleted(int idx)(Code) | | Set knownDeleted to true.
|
setLastFullLsn | void setLastFullLsn(long lsn)(Code) | | Sets the last logged LSN.
|
setLsnElement | void setLsnElement(int idx, long value)(Code) | | |
setMigrate | public void setMigrate(int idx, boolean migrate)(Code) | | Set the idx'th migrate status.
|
setPendingDeleted | public void setPendingDeleted(int idx)(Code) | | Set pendingDeleted to true.
|
setProhibitNextDelta | public void setProhibitNextDelta()(Code) | | Do nothing since INs don't support deltas.
|
setTarget | void setTarget(int idx, Node target)(Code) | | Sets the idx'th target. No need to make dirty, that state only applies
to key and LSN.
WARNING: This method does not update the memory budget. The caller
must update the budget.
|
split | void split(IN parent, int childIndex, int maxEntries) throws DatabaseException(Code) | | Split this into two nodes. Parent IN is passed in parent and should be
latched by the caller.
childIndex is the index in parent of where "this" can be found.
lsn of the newly logged parent |
splitInternal | protected void splitInternal(IN parent, int childIndex, int maxEntries, int splitIndex) throws DatabaseException(Code) | | |
splitSpecial | void splitSpecial(IN parent, int parentIndex, int maxEntriesPerNode, byte[] key, boolean leftSide) throws DatabaseException(Code) | | Called when we know we are about to split on behalf of a key that is the
minimum (leftSide) or maximum (!leftSide) of this node. This is
achieved by just forcing the split to occur either one element in from
the left or the right (i.e. splitIndex is 1 or nEntries - 1).
|
trackProvisionalObsolete | void trackProvisionalObsolete(IN child, long obsoleteLsn1, long obsoleteLsn2)(Code) | | Adds the given obsolete LSNs and any tracked obsolete LSNs for the given
child IN to this IN's tracking list. This method is called to track
obsolete LSNs when a child IN is logged provisionally. Such LSNs cannot
be considered obsolete until an ancestor IN is logged non-provisionally.
|
updateEntry | public void updateEntry(int idx, Node node)(Code) | | Update the idx'th entry of this node.
Note: does not dirty the node.
|
updateEntry | public void updateEntry(int idx, Node node, long lsn)(Code) | | Update the idx'th entry of this node.
|
updateEntry | public void updateEntry(int idx, Node node, long lsn, byte[] key)(Code) | | Update the idx'th entry of this node.
|
updateEntry | public void updateEntry(int idx, long lsn)(Code) | | Update the idx'th entry of this node.
|
updateEntry | public void updateEntry(int idx, long lsn, byte state)(Code) | | Update the idx'th entry of this node.
|
updateEntry | public void updateEntry(int idx, long lsn, long oldLNSize, long newLNSize)(Code) | | Update the idx'th entry of this node. This flavor is used when the
target LN is being modified, by an operation like a delete or update. We
don't have to check whether the LSN has been nulled or not, because we
know an LSN existed before. Also, the modification of the target is done
in the caller, so instead of passing in the old and new nodes, we pass
in the old and new node sizes.
|
updateKeyIfChanged | public void updateKeyIfChanged(int idx, byte[] newKey)(Code) | | Updates the idx'th key of this node if it is not identical to the given
key. [#15704]
This method is called when an LN is fetched in order to ensure the key
slot is transactionally correct. A key can change in three
circumstances, when a key comparator is configured that may not compare
all bytes of the key:
1) The user calls Cursor.putCurrent to update the data of a duplicate
data item. CursorImpl.putCurrent will call this method to update the
key.
2) A transaction aborts or a BIN becomes out of date due to the
non-transactional nature of INs. The Node is set to null during abort
and recovery. IN.fetchCurrent will call this method to update the key.
3) A slot for a deleted LN is reused. The key in the slot is updated
by IN.updateEntry along with the node and LSN.
Note that transaction abort and recovery of BIN (and DBIN) entries may
cause incorrect keys to be present in the tree, since these entries are
non-transactional. However, an incorrect key in a BIN slot may only be
present when the node in that slot is null. Undo/redo sets the node to
null. When the LN node is fetched, the key in the slot is set to the
LN's key (or data for DBINs), which is the source of truth and is
transactionally correct.
|
updateMemorySize | protected void updateMemorySize(long oldSize, long newSize)(Code) | | |
updateMemorySize | void updateMemorySize(Node oldNode, Node newNode)(Code) | | |
verify | public void verify(byte[] maxKey) throws DatabaseException(Code) | | Check that the IN is in a valid state. For now, validity means that the
keys are in sorted order and that there are more than 0 entries.
maxKey, if non-null specifies that all keys in this node must be less
than maxKey.
|
verifyMemorySize | public boolean verifyMemorySize()(Code) | | |
|
|