com.sleepycat.je.tree
Class IN

java.lang.Object
  extended by com.sleepycat.je.tree.Node
      extended by com.sleepycat.je.tree.IN
All Implemented Interfaces:
Loggable, Comparable<IN>
Direct Known Subclasses:
BIN, DIN

public class IN
extends Node
implements Comparable<IN>, Loggable

An IN represents an Internal Node in the JE tree. Explanation of KD (KnownDeleted) and PD (PendingDelete) entry flags =================================================================== PD: set for all LN entries which are deleted, even before the LN is committed. PD will be cleared if the txn for the deleted LN is aborted. KD: set under special conditions for entries containing LNs which are known to be obsolete. Not used for entries in an active/uncommitted transaction. First notice that IN.fetchTarget will allow a FileNotFoundException when the PD or KD flag is set on the entry. And it will allow a NULL_LSN when the KD flag is set. KD was implemented first, and was originally used when the cleaner attempts to migrate an LN and discovers it is deleted (see Cleaner.migrateLN). We need KD because the INCompressor may not have run, and may not have compressed the BIN. There's the danger that we'll try to fetch that entry, and that the file was deleted by the cleaner. KD was used more recently when an unexpected exception occurs while logging an LN, after inserting the entry. Rather than delete the entry to clean up, we mark the entry KD so it won't cause a fetch error later. In this case the entry LSN is NULL_LSN. See Tree.insert. PD is closely related to the first use of KD above (for cleaned deleted LNs) and came about because of a cleaner optimization we make. The cleaner considers all deleted LN log entries to be obsolete, without doing a tree lookup, and without any record of an obsolete offset. This makes the cost of cleaning of deleted LNs very low. For example, if the log looks like this: 100 LNA 200 delete of LNA then LSN 200 will be considered obsolete when this file is processed by the cleaner. After all, only two things can happen: (1) the txn commits, and we don't need LSN 200, because we can wipe this LN out of the tree, or (2) the txn aborts, and we don't need LSN 200, because we are going to revert to LSN 100/LNA. We set PD for the entry of a deleted LN at the time of the operation, and we clear PD if the transaction aborts. There is no real danger that this log entry will be processed by the cleaner before it's committed, because cleaning can only happen after the first active LSN. Just as in the first use of KD above, setting PD is necessary to avoid a fetch error, when the file is deleted by the cleaner but the entry containing the deleted LN has not been deleted by the INCompressor. PD is now also set in replication rollback, when LNs are marked as invisible. In addition to the setting and use of the KD/PD flags described above, the situation is complicated by the fact that we must restore the state of these flags during abort, recovery, and set them properly during slot reuse. We have been meaning to consider whether PD and KD can be consolidated into one flag: simply the Deleted flag. The Deleted flag would be set in the same way as PD is currently set, as well as the second use of KD described above (when the LSN is NULL_LSN after an insertion error). The use of KD and PD for invisible entries and recovery rollback should also be considered. If we consolidate the two flags and set the Deleted flag during a delete operation (like PD), we'll have to remove optimizations (in CursorImpl for example) that consider a slot deleted when KD is set. Since KD is rarely set currently, this shouldn't have a noticeable performance impact.


Field Summary
static int ACCUMULATED_LIMIT
           
static int BIN_LEVEL
           
(package private)  DatabaseImpl databaseImpl
           
static int DBMAP_LEVEL
           
static int EXACT_MATCH
           
static int INSERT_SUCCESS
           
protected  SharedLatch latch
           
static int LEVEL_MASK
           
static int MAIN_LEVEL
           
static int MAX_LEVEL
           
static int MAY_EVICT_LNS
           
static int MAY_EVICT_NODE
           
static int MAY_NOT_EVICT
           
static int MIN_LEVEL
           
 
Fields inherited from class com.sleepycat.je.tree.Node
NULL_NODE_ID
 
Constructor Summary
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.
 
Method Summary
(package private)  void accountForDeferredWriteSubtreeRemoval(INList inList, IN subtreeParent)
          For a deferred-write DB, account for a deleted subtree.
(package private)  void accountForSubtreeRemoval(INList inList, LocalUtilizationTracker localTracker)
          For a regular (not deferred-write) DB, account for a deleted subtree.
(package private)  void accumulateStats(TreeWalkerStatsAccumulator acc)
           
(package private)  void adjustCursors(IN newSibling, int newSiblingLow, int newSiblingHigh)
           
(package private)  void adjustCursorsForInsert(int insertIndex)
           
 void afterLog(LogManager logManager, INLogItem item, INLogContext context)
          Post-log processing.
 void beforeLog(LogManager logManager, INLogItem item, INLogContext context)
          Pre-log processing.
 String beginTag()
           
protected  boolean canBeAncestor(boolean targetContainsDuplicates)
           
(package private)  void changeMemorySize(long delta)
           
(package private)  void clearKnownDeleted(int idx)
          Set knownDeleted to false.
 void clearLsn(int idx)
          Set the LSN to null for the idx'th entry of this node.
 void clearPendingDeleted(int idx)
          Set pendingDeleted to false.
protected  void compactMemory()
           
 int compareTo(IN argIN)
          Sort based on equality key.
(package private)  boolean compareToKeyPrefix(byte[] newKey)
           
 boolean compress(BINReference binRef, boolean canFetch, LocalUtilizationTracker localTracker)
          Called by the incompressor.
protected static long computeArraysOverhead(DbConfigManager configManager)
           
protected  long computeMemorySize()
          Count up the memory usage attributable to this node alone.
static long computeOverhead(DbConfigManager configManager)
           
protected  IN createNewInstance(byte[] identifierKey, int maxEntries, int level)
          Create a new IN.
(package private)  boolean deleteEntry(byte[] key, boolean maybeValidate)
          Deletes the ChildReference with the key arg from this IN.
 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)
           
(package private) static void dumpDeletedState(StringBuilder sb, byte state)
          Utility method for output of knownDeleted and pendingDelete.
(package private)  void dumpKeys()
           
 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()
           
(package private)  boolean entryZeroKeyComparesLow()
          Indicates whether whether entry 0's key is "special" in that it always compares less than any other key.
 boolean equals(Object obj)
           
 Node fetchTarget(int idx)
          Returns the target of the idx'th entry or null if a pendingDeleted or knownDeleted entry has been cleaned.
 Node fetchTargetWithExclusiveLatch(int idx)
          Variant of fetchTarget that is called while holding an exclusive latch and therefore does not throw RelatchRequiredException.
 int findEntry(byte[] key, boolean indicateIfDuplicate, boolean exact)
          Find the entry in this IN for which key arg is >= the key.
(package private)  void findParent(Tree.SearchType searchType, long targetNodeId, boolean targetContainsDuplicates, boolean targetIsRoot, byte[] targetMainTreeKey, byte[] targetDupTreeKey, SearchResult result, boolean requireExactMatch, CacheMode cacheMode, int targetLevel, List<TrackingInfo> trackingList, boolean doFetch)
          Determine if 'this' is the parent of a child (targetNodeId).
protected  int generateLevel(DatabaseId dbId, int newLevel)
           
 long getBudgetedMemorySize()
          Returns the amount of memory currently budgeted for this IN.
(package private)  int getChildEvictionType()
          Returns the eviction type based on the status of child nodes, irrespective of isEvictionProhibited.
 byte[] getChildKey(IN child)
          Get the key (dupe or identifier) in child that is used to locate it in 'this' node.
 DatabaseImpl getDatabase()
          Get the database for this IN.
 DatabaseId getDatabaseId()
           
 boolean getDirty()
           
 byte[] getDupKey()
          Return the key for this duplicate set.
 byte[] getDupTreeKey()
          Return the key for navigating through the duplicate tree.
protected  long getEntryInMemorySize(byte[] key, Node target)
           
(package private)  byte[] getEntryLsnByteArray()
           
(package private)  long[] getEntryLsnLongArray()
           
 int getEvictionType()
          Returns the eviction type for this IN, for use by the evictor.
 long getGeneration()
           
 byte[] getIdentifierKey()
           
 boolean getInListResident()
          Returns whether this IN is on the INList.
 long getInMemorySize()
          For unit tests.
 byte[] getKey(int idx)
          Return the idx'th key.
 Comparator<byte[]> getKeyComparator()
          Return the relevant user defined comparison function for this type of node.
(package private)  byte[] getKeyPrefix()
           
 INKeyRep getKeyVals()
           
 long getLastFullVersion()
          Returns the last logged LSN, or null if never logged.
 int getLatchQueueLength()
           
 int getLevel()
          Cover for LN's and just return 0 since they'll always be at the bottom of the tree.
 int getLogSize()
           
 LogEntryType getLogType()
           
 long getLsn(int idx)
          Return the idx'th LSN for this entry.
 byte[] getMainTreeKey()
          Return the key for navigating through the main tree.
(package private)  int getMaxEntries()
           
protected  long getMemoryOverhead(MemoryBudget mb)
           
 boolean getMigrate(int idx)
          Get the idx'th migrate status.
 int getNEntries()
           
 boolean getRecalcToggle()
           
 byte getState(int idx)
           
 Node getTarget(int idx)
          Return the idx'th target.
 INArrayRep<INTargetRep,INTargetRep.Type,Node> getTargets()
           
 long getTreeAdminMemorySize()
          Returns the treeAdmin memory in objects referenced by this IN.
 int hashCode()
          We would like as even a hash distribution as possible so that the Evictor's LRU is as accurate as possible.
(package private)  boolean hasPinnedChildren()
          Returns whether any resident children are not LNs (are INs).
(package private)  boolean hasResidentChildren()
          Returns whether any child is non-null.
 void incEvictStats(Evictor.EvictionSource source)
          We categorize eviction stats by the type of IN, so IN subclasses update different stats.
 void incFetchStats(EnvironmentImpl envImpl, boolean isMiss)
          We categorize fetch stats by the type of node, so node subclasses update different stats.
protected  void init(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level)
          Initialize IN object.
(package private)  void initEntryLsn(int capacity)
           
protected  void initMemorySize()
          Initialize the per-node memory count by computing its memory usage.
 boolean insertEntry(ChildReference entry)
          Inserts the argument ChildReference into this IN.
 int insertEntry1(ChildReference entry)
          Same as insertEntry except that it returns the index where the dup was found instead of false.
(package private)  boolean isAlwaysLatchedExclusively()
           
(package private)  boolean isBottomMostNode()
           
 boolean isCompressible()
           
 boolean isDbRoot()
           
(package private)  boolean isDirty(int idx)
           
 boolean isEntryKnownDeleted(int idx)
           
 boolean isEntryPendingDeleted(int idx)
           
 boolean isEvictable()
          Returns whether this node can be evicted.
(package private)  boolean isEvictionProhibited()
          Returns whether the node is not evictable, irrespective of the status of the children nodes.
 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.
 boolean isLatchOwnerForRead()
           
 boolean isLatchOwnerForWrite()
           
 boolean isRoot()
           
protected  boolean isSoughtNode(long nid, CacheMode cacheMode, boolean doFetch)
           
(package private) static boolean isStateKnownDeleted(byte state)
          Returns true if the given state is known deleted.
(package private) static boolean isStatePendingDeleted(byte state)
          Returns true if the given state is pending deleted.
(package private)  boolean isValidForDelete()
          Check if this node fits the qualifications for being part of a deletable subtree.
 void latch()
          Latch this node exclusive and set the generation.
 void latch(CacheMode cacheMode)
          Latch this node exclusive, optionally setting the generation.
 boolean latchNoWait()
          Latch this node if it is not latched by another thread, and set the generation if the latch succeeds.
 boolean latchNoWait(CacheMode cacheMode)
          Latch this node if it is not latched by another thread, optionally setting the generation if the latch succeeds.
 void latchShared()
          Latch this node shared and set the generation.
 void latchShared(CacheMode cacheMode)
          Latch this node shared, optionally setting the generation.
 long log(LogManager logManager)
          Log this IN and clear the dirty flag.
 long log(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean backgroundIO, IN parent)
          Log this node with all available options.
 long log(LogManager logManager, 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.
 boolean logicalEquals(Loggable other)
           
(package private) static String makeFetchErrorMsg(String msg, IN in, long lsn, byte state)
           
 boolean needsSplitting()
          Return true if this node needs splitting.
(package private)  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.
 long optionalLog(LogManager logManager)
          Log this IN and clear the dirty flag.
 long optionalLogProvisional(LogManager logManager, IN parent)
          Log this node provisionally and clear the dirty flag.
 void postFetchInit(DatabaseImpl db, long sourceLsn)
          Initialize a node that has been read in from the log.
 void postRecoveryInit(DatabaseImpl db, long sourceLsn)
          Initialize a node read in during recovery.
protected  long printMemorySize()
           
 void readFromLog(ByteBuffer itemBuffer, int entryVersion)
          Initialize this object from the data in itemBuf.
(package private)  void rebuildINList(INList inList)
          Add self and children to this in-memory IN list.
 void releaseLatch()
          Release the latch on this node.
 void releaseLatchIfOwner()
          Release the latch on this node.
 long resetAndGetMemorySize()
          Called as part of a memory budget reset (during a checkpoint) to clear the accumulated delta and return the total memory size.
 byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey)
           
 void setDatabase(DatabaseImpl db)
          Set the database reference for this node.
 void setDirty(boolean dirty)
           
 void setEntry(int idx, Node target, byte[] keyVal, long lsn, byte state)
          Set the idx'th entry of this node.
 void setGeneration(CacheMode cacheMode)
           
 void setGeneration(long newGeneration)
           
(package private)  void setIdentifierKey(byte[] key)
          Set the identifier key for this node.
 void setInListResident(boolean resident)
          Called when adding/removing this IN to/from the INList.
(package private)  void setIsRoot(boolean isRoot)
           
(package private)  void setKeyPrefix(byte[] keyPrefix)
           
(package private)  void setKnownDeleted(int idx)
          Set knownDeleted to true.
(package private)  void setLastFullLsn(long lsn)
          Sets the last logged LSN.
(package private)  void setLsnElement(int idx, long value)
           
 void setMigrate(int idx, boolean migrate)
          Set the idx'th migrate status.
 void setPendingDeleted(int idx)
          Set pendingDeleted to true.
 void setProhibitNextDelta()
          Do nothing since INs don't support deltas.
 void setRecalcToggle(boolean toggle)
           
(package private)  void setTarget(int idx, Node target)
          Sets the idx'th target.
 String shortClassName()
           
(package private)  void split(IN parent, int childIndex, int maxEntries, CacheMode cacheMode)
          Split this into two nodes.
protected  void splitInternal(IN parent, int childIndex, int maxEntries, int splitIndex, CacheMode cacheMode)
           
(package private)  void splitSpecial(IN parent, int parentIndex, int maxEntriesPerNode, byte[] key, boolean leftSide, CacheMode cacheMode)
          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.
 String toString()
          Default toString method at the root of the tree.
(package private)  void trackProvisionalObsolete(IN childIN, long obsoleteLsn, boolean isObsoleteLN, int obsoleteSize)
          Adds the given obsolete LSN and any tracked obsolete LSNs for the given child IN to this IN's tracking list.
 void updateEntry(int idx, long lsn)
          Update the idx'th entry of this node.
 void updateEntry(int idx, long lsn, byte state)
          Update the idx'th entry of this node.
 void updateEntry(int idx, Node node, long lsn, byte[] key)
          Update the idx'th entry of this node.
protected  void updateMemorySize(ChildReference oldRef, ChildReference newRef)
           
protected  void updateMemorySize(long oldSize, long newSize)
           
(package private)  void updateMemorySize(Node oldNode, Node newNode)
           
 void updateNode(int idx, Node node, byte[] lnSlotKey)
          Update the idx'th entry, replacing the node and, if appropriate, the LN slot key.
 void updateNode(int idx, Node node, long lsn, byte[] lnSlotKey)
          Update the idx'th entry, replacing the node and, if appropriate, the LN slot key.
 void updateNode(int idx, Node node, long oldSize, long lsn, byte[] lnSlotKey)
          Update the idx'th entry of this node.
(package private)  boolean validateSubtreeBeforeDelete(int index)
           
 void verify(byte[] maxKey)
          Check that the IN is in a valid state.
(package private)  boolean verifyKeyPrefix()
           
 boolean verifyMemorySize()
           
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.tree.Node
containsDuplicates, dump, getMemorySizeIncludedByParent, getNodeId, getTransactionId, getType, matchLNByNodeId, setNodeId, shortDescription
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.Loggable
getTransactionId
 

Field Detail

DBMAP_LEVEL

public static final int DBMAP_LEVEL
See Also:
Constant Field Values

MAIN_LEVEL

public static final int MAIN_LEVEL
See Also:
Constant Field Values

LEVEL_MASK

public static final int LEVEL_MASK
See Also:
Constant Field Values

MIN_LEVEL

public static final int MIN_LEVEL
See Also:
Constant Field Values

MAX_LEVEL

public static final int MAX_LEVEL
See Also:
Constant Field Values

BIN_LEVEL

public static final int BIN_LEVEL
See Also:
Constant Field Values

MAY_NOT_EVICT

public static final int MAY_NOT_EVICT
See Also:
Constant Field Values

MAY_EVICT_LNS

public static final int MAY_EVICT_LNS
See Also:
Constant Field Values

MAY_EVICT_NODE

public static final int MAY_EVICT_NODE
See Also:
Constant Field Values

latch

protected SharedLatch latch

databaseImpl

DatabaseImpl databaseImpl

EXACT_MATCH

public static final int EXACT_MATCH
See Also:
Constant Field Values

INSERT_SUCCESS

public static final int INSERT_SUCCESS
See Also:
Constant Field Values

ACCUMULATED_LIMIT

public static int ACCUMULATED_LIMIT
Constructor Detail

IN

public IN()
Create an empty IN, with no node id, to be filled in from the log.


IN

public IN(DatabaseImpl dbImpl,
          byte[] identifierKey,
          int capacity,
          int level)
Create a new IN.

Method Detail

init

protected void init(DatabaseImpl db,
                    byte[] identifierKey,
                    int initialCapacity,
                    int level)
Initialize IN object.


initMemorySize

protected void initMemorySize()
Initialize the per-node memory count by computing its memory usage.


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
We would like as even a hash distribution as possible so that the Evictor's LRU is as accurate as possible. ConcurrentHashMap takes the value returned by this method and runs its own hash algorithm on it. So a bit complement of the node ID is sufficent as the return value and is a little better than returning just the node ID. If we use a different container in the future that does not re-hash the return value, we should probably implement the Wang-Jenkins hash function here.

Overrides:
hashCode in class Object

compareTo

public int compareTo(IN argIN)
Sort based on equality key.

Specified by:
compareTo in interface Comparable<IN>

createNewInstance

protected IN createNewInstance(byte[] identifierKey,
                               int maxEntries,
                               int level)
Create a new IN. Need this because we can't call newInstance() without getting a 0 for nodeid.


isAlwaysLatchedExclusively

boolean isAlwaysLatchedExclusively()

postFetchInit

public void postFetchInit(DatabaseImpl db,
                          long sourceLsn)
Initialize a node that has been read in from the log.

Overrides:
postFetchInit in class Node

postRecoveryInit

public void postRecoveryInit(DatabaseImpl db,
                             long sourceLsn)
Initialize a node read in during recovery.


setLastFullLsn

void setLastFullLsn(long lsn)
Sets the last logged LSN.


getLastFullVersion

public long getLastFullVersion()
Returns the last logged LSN, or null if never logged. Is public for unit testing.


latch

public void latch(CacheMode cacheMode)
           throws DatabaseException
Latch this node exclusive, optionally setting the generation.

Throws:
DatabaseException

latchShared

public void latchShared(CacheMode cacheMode)
                 throws DatabaseException
Latch this node shared, optionally setting the generation.

Overrides:
latchShared in class Node
Throws:
DatabaseException - from subclasses.

latchNoWait

public boolean latchNoWait(CacheMode cacheMode)
                    throws DatabaseException
Latch this node if it is not latched by another thread, optionally setting the generation if the latch succeeds.

Throws:
DatabaseException

latch

public void latch()
           throws DatabaseException
Latch this node exclusive and set the generation.

Throws:
DatabaseException

latchShared

public void latchShared()
                 throws DatabaseException
Latch this node shared and set the generation.

Overrides:
latchShared in class Node
Throws:
DatabaseException - from subclasses.

latchNoWait

public boolean latchNoWait()
                    throws DatabaseException
Latch this node if it is not latched by another thread, and set the generation if the latch succeeds.

Throws:
DatabaseException

releaseLatch

public void releaseLatch()
Release the latch on this node.

Overrides:
releaseLatch in class Node

releaseLatchIfOwner

public void releaseLatchIfOwner()
Release the latch on this node.


isLatchOwnerForRead

public boolean isLatchOwnerForRead()
Returns:
true if this thread holds the IN's latch

isLatchOwnerForWrite

public boolean isLatchOwnerForWrite()

getLatchQueueLength

public int getLatchQueueLength()

getGeneration

public long getGeneration()

setGeneration

public void setGeneration(CacheMode cacheMode)

setGeneration

public void setGeneration(long newGeneration)

getLevel

public int getLevel()
Description copied from class: Node
Cover for LN's and just return 0 since they'll always be at the bottom of the tree.

Overrides:
getLevel in class Node

isBottomMostNode

boolean isBottomMostNode()
Returns:
true if this node cannot contain contain children INs, i.e., if this is a DBIN, or this is a BIN in a non-duplicates DB.

generateLevel

protected int generateLevel(DatabaseId dbId,
                            int newLevel)

setKeyPrefix

void setKeyPrefix(byte[] keyPrefix)

getKeyPrefix

byte[] getKeyPrefix()

getDirty

public boolean getDirty()

setDirty

public void setDirty(boolean dirty)

getRecalcToggle

public boolean getRecalcToggle()

setRecalcToggle

public void setRecalcToggle(boolean toggle)

isRoot

public boolean isRoot()

isDbRoot

public boolean isDbRoot()

setIsRoot

void setIsRoot(boolean isRoot)

getIdentifierKey

public byte[] getIdentifierKey()
Returns:
the identifier key for this node.

setIdentifierKey

void setIdentifierKey(byte[] key)
Set the identifier key for this node.

Parameters:
key - - the new identifier key for this node.

getChildKey

public byte[] getChildKey(IN child)
Get the key (dupe or identifier) in child that is used to locate it in 'this' node.


selectKey

public byte[] selectKey(byte[] mainTreeKey,
                        byte[] dupTreeKey)

getDupKey

public byte[] getDupKey()
Return the key for this duplicate set.


getDupTreeKey

public byte[] getDupTreeKey()
Return the key for navigating through the duplicate tree.


getMainTreeKey

public byte[] getMainTreeKey()
Return the key for navigating through the main tree.


getDatabase

public DatabaseImpl getDatabase()
Get the database for this IN.


setDatabase

public void setDatabase(DatabaseImpl db)
Set the database reference for this node.


getDatabaseId

public DatabaseId getDatabaseId()

getKey

public byte[] getKey(int idx)
Return the idx'th key. If prefixing is enabled, construct a new byte[] containing the prefix and suffix. If prefixing is not enabled, just return the current byte[] in entryKeyVals[].


compareToKeyPrefix

boolean compareToKeyPrefix(byte[] newKey)

verifyKeyPrefix

boolean verifyKeyPrefix()

getMigrate

public boolean getMigrate(int idx)
Get the idx'th migrate status.


setMigrate

public void setMigrate(int idx,
                       boolean migrate)
Set the idx'th migrate status.


getState

public byte getState(int idx)

getTarget

public Node getTarget(int idx)
Return the idx'th target.


setTarget

void setTarget(int idx,
               Node target)
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.


getLsn

public long getLsn(int idx)
Return the idx'th LSN for this entry.

Returns:
the idx'th LSN for this entry.

getEntryLsnLongArray

long[] getEntryLsnLongArray()

getEntryLsnByteArray

byte[] getEntryLsnByteArray()

initEntryLsn

void initEntryLsn(int capacity)

setLsnElement

void setLsnElement(int idx,
                   long value)

isEntryPendingDeleted

public boolean isEntryPendingDeleted(int idx)
Returns:
true if the idx'th entry has been deleted, although the transaction that performed the deletion may not be committed.

setPendingDeleted

public void setPendingDeleted(int idx)
Set pendingDeleted to true.


clearPendingDeleted

public void clearPendingDeleted(int idx)
Set pendingDeleted to false.


isEntryKnownDeleted

public boolean isEntryKnownDeleted(int idx)
Returns:
true if the idx'th entry is deleted for sure. If a transaction performed the deletion, it has been committed.

setKnownDeleted

void setKnownDeleted(int idx)
Set knownDeleted to true.


clearKnownDeleted

void clearKnownDeleted(int idx)
Set knownDeleted to false.


isDirty

boolean isDirty(int idx)
Returns:
true if the object is dirty.

getNEntries

public int getNEntries()
Returns:
the number of entries in this node.

isStateKnownDeleted

static boolean isStateKnownDeleted(byte state)
Returns true if the given state is known deleted.


isStatePendingDeleted

static boolean isStatePendingDeleted(byte state)
Returns true if the given state is pending deleted.


getMaxEntries

int getMaxEntries()
Returns:
the maximum number of entries in this node.

fetchTargetWithExclusiveLatch

public final Node fetchTargetWithExclusiveLatch(int idx)
                                         throws DatabaseException
Variant of fetchTarget that is called while holding an exclusive latch and therefore does not throw RelatchRequiredException.

Throws:
DatabaseException

fetchTarget

public Node fetchTarget(int idx)
                 throws RelatchRequiredException,
                        DatabaseException
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.

Returns:
the target node or null.
Throws:
RelatchRequiredException
DatabaseException

makeFetchErrorMsg

static String makeFetchErrorMsg(String msg,
                                IN in,
                                long lsn,
                                byte state)

setEntry

public void setEntry(int idx,
                     Node target,
                     byte[] keyVal,
                     long lsn,
                     byte state)
Set the idx'th entry of this node.


clearLsn

public void clearLsn(int idx)
Set the LSN to null for the idx'th entry of this node. Only allowed for a temporary database. Used to wipe an LSN for a file that is being cleaned and will be deleted.


updateNode

public void updateNode(int idx,
                       Node node,
                       long oldSize,
                       long lsn,
                       byte[] lnSlotKey)
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 new node and old size.


updateNode

public void updateNode(int idx,
                       Node node,
                       byte[] lnSlotKey)
Update the idx'th entry, replacing the node and, if appropriate, the LN slot key. See updateNode(int, Node, long, byte[]) for details. Note that the LSN is not passed to this method because the node has been either (a) fetched in from disk and is not dirty, or (b) will be written out later by something like a checkpoint. Note: does not dirty the node unless the LN slot key is changed.


updateNode

public void updateNode(int idx,
                       Node node,
                       long lsn,
                       byte[] lnSlotKey)
Update the idx'th entry, replacing the node and, if appropriate, the LN slot key. The updateNode methods are special versions of updateEntry that are called to update the node in a slot. When an LN node is changed, the slot key may also need to be updated when a partial key comparator is used. Callers must be sure to pass the correct lnSlotKey parameter when passing an LN for the node parameter. See setLNSlotKey for details. [#15704]


updateEntry

public void updateEntry(int idx,
                        Node node,
                        long lsn,
                        byte[] key)
Update the idx'th entry of this node. Note that although this method allows updating the node, it always replaces the key and therefore does not need an lnSlotKey parameter. See the updateNode methods for more information. [#15704]


updateEntry

public void updateEntry(int idx,
                        long lsn)
Update the idx'th entry of this node.


updateEntry

public void updateEntry(int idx,
                        long lsn,
                        byte state)
Update the idx'th entry of this node.


notOverwritingDeferredWriteEntry

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. 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.


verifyMemorySize

public boolean verifyMemorySize()

getBudgetedMemorySize

public long getBudgetedMemorySize()
Returns the amount of memory currently budgeted for this IN.


resetAndGetMemorySize

public long resetAndGetMemorySize()
Called as part of a memory budget reset (during a checkpoint) to clear the accumulated delta and return the total memory size.


getTreeAdminMemorySize

public long getTreeAdminMemorySize()
Returns the treeAdmin memory in objects referenced by this IN. Specifically, this refers to the DbFileSummaryMap held by MapLNs


getInMemorySize

public long getInMemorySize()
For unit tests.


getEntryInMemorySize

protected long getEntryInMemorySize(byte[] key,
                                    Node target)

getTargets

public INArrayRep<INTargetRep,INTargetRep.Type,Node> getTargets()

getKeyVals

public INKeyRep getKeyVals()

computeMemorySize

protected long computeMemorySize()
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. The identifierKey is "intentionally" not kept track of in the memory budget.


printMemorySize

protected long printMemorySize()

computeOverhead

public static long computeOverhead(DbConfigManager configManager)

computeArraysOverhead

protected static long computeArraysOverhead(DbConfigManager configManager)

getMemoryOverhead

protected long getMemoryOverhead(MemoryBudget mb)

updateMemorySize

protected void updateMemorySize(ChildReference oldRef,
                                ChildReference newRef)

updateMemorySize

protected void updateMemorySize(long oldSize,
                                long newSize)

compactMemory

protected void compactMemory()

updateMemorySize

void updateMemorySize(Node oldNode,
                      Node newNode)

changeMemorySize

void changeMemorySize(long delta)

setInListResident

public void setInListResident(boolean resident)
Called when adding/removing this IN to/from the INList.


getInListResident

public boolean getInListResident()
Returns whether this IN is on the INList.


isKeyInBounds

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. 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.


findEntry

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. It always compares lower than any other key. This is public so that DbCursorTest can access it.

Parameters:
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.
Returns:
offset for the entry that has a key >= the arg. 0 if key is less than the 1st entry. -1 if exact is true and no exact match is found. If indicateIfDuplicate is true and an exact match was found then EXACT_MATCH is or'd onto the return value.

insertEntry

public boolean insertEntry(ChildReference entry)
                    throws DatabaseException
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.
Returns:
true if the entry was successfully inserted, false if it was a duplicate.
Throws:
EnvironmentFailureException - if the node is full (it should have been split earlier).
DatabaseException

insertEntry1

public int insertEntry1(ChildReference entry)
                 throws DatabaseException
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.
Returns:
either (1) the index of location in the IN where the entry was inserted |'d with INSERT_SUCCESS, or (2) the index of the duplicate in the IN |'d with EXACT_MATCH if the entry was found to be a duplicate.
Throws:
EnvironmentFailureException - if the node is full (it should have been split earlier).
DatabaseException

deleteEntry

boolean deleteEntry(byte[] key,
                    boolean maybeValidate)
              throws DatabaseException
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.
maybeValidate - true if assert validation should occur prior to delete. Set this to false during recovery.
Returns:
true if the entry was successfully deleted, false if it was not found.
Throws:
DatabaseException

deleteEntry

public boolean deleteEntry(int index,
                           boolean maybeValidate)
                    throws DatabaseException
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.
maybeValidate - true if asserts are enabled.
Returns:
true if the entry was successfully deleted, false if it was not found.
Throws:
DatabaseException

setProhibitNextDelta

public void setProhibitNextDelta()
Do nothing since INs don't support deltas.


compress

public boolean compress(BINReference binRef,
                        boolean canFetch,
                        LocalUtilizationTracker localTracker)
                 throws DatabaseException
Called by the incompressor.

Throws:
DatabaseException - from subclasses.

isCompressible

public boolean isCompressible()

validateSubtreeBeforeDelete

boolean validateSubtreeBeforeDelete(int index)
                              throws DatabaseException
Throws:
DatabaseException

needsSplitting

public boolean needsSplitting()
Return true if this node needs splitting. For the moment, needing to be split is defined by there being no free entries available.


entryZeroKeyComparesLow

boolean entryZeroKeyComparesLow()
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.


split

void split(IN parent,
           int childIndex,
           int maxEntries,
           CacheMode cacheMode)
     throws DatabaseException
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.

Throws:
DatabaseException

splitInternal

protected void splitInternal(IN parent,
                             int childIndex,
                             int maxEntries,
                             int splitIndex,
                             CacheMode cacheMode)
                      throws DatabaseException
Throws:
DatabaseException

splitSpecial

void splitSpecial(IN parent,
                  int parentIndex,
                  int maxEntriesPerNode,
                  byte[] key,
                  boolean leftSide,
                  CacheMode cacheMode)
            throws DatabaseException
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).

Throws:
DatabaseException

adjustCursors

void adjustCursors(IN newSibling,
                   int newSiblingLow,
                   int newSiblingHigh)

adjustCursorsForInsert

void adjustCursorsForInsert(int insertIndex)

getKeyComparator

public Comparator<byte[]> getKeyComparator()
Return the relevant user defined comparison function for this type of node. For IN's and BIN's, this is the BTree Comparison function.


verify

public void verify(byte[] maxKey)
            throws EnvironmentFailureException
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.

Overrides:
verify in class Node
Throws:
EnvironmentFailureException - when implemented.

rebuildINList

void rebuildINList(INList inList)
             throws DatabaseException
Add self and children to this in-memory IN list. Called by recovery, can run with no latching.

Specified by:
rebuildINList in class Node
Throws:
DatabaseException

accountForSubtreeRemoval

void accountForSubtreeRemoval(INList inList,
                              LocalUtilizationTracker localTracker)
                        throws DatabaseException
For a regular (not deferred-write) DB, account for a deleted subtree.

Remove self and children from the in-memory IN list. Also count removed nodes as obsolete in the local tracker. The local tracker will be flushed by the compressor.

TODO: Note that we neglect to transfer any accumulated provisional obsolete info from the deleted INs to the tracker. See accountForDeferredWriteSubtreeRemoval for the case where this comes up. Ideally, in a future release we will record all obsolete info for regular as well as deferred-write DBs, including any accumulated provisional info, from the deleted INs to the subtree parent, as we do in accountForDeferredWriteSubtreeRemoval, and then rely on the logging of the subtree parent (for a regular DB) to flush that info. This was not done as part of SR [#21348] because logging the subtree parent does not flush the utilization info all the way to the log, while the compressor does flush the local tracker info all the way to the log. With further thought we may decide this change in behavior is acceptable, but it was too risky for a patch release. See the SR [#21348] for more details.

Specified by:
accountForSubtreeRemoval in class Node
Throws:
DatabaseException

accountForDeferredWriteSubtreeRemoval

void accountForDeferredWriteSubtreeRemoval(INList inList,
                                           IN subtreeParent)
                                     throws DatabaseException
For a deferred-write DB, account for a deleted subtree. [#21348]

Remove self and children from the in-memory IN list. Also count removed nodes as provisionally obsolete, recording this information in the parent of the subtree. When the root IN is logged non-provisionally by a checkpoint or Database.sync, the provisional obsolete info will be flushed to the log.

When removed nodes are counted obsolete, also transfer their accumulated provisional obsolete to the subtree parent. This accounts for the case where a subtree is removed in the middle of a checkpoint.

For example, say a two level subtree is removed, INa-BINb, and the grandparent, INc, is the subtree parent. Say a checkpoint logged BINb provisionally, but did not log INa (or INc). The provisional obsolete info for BINb will be present in INa. In this method, we transfer that info to INc, so it will be flushed when INc is logged non-provisionally.

Specified by:
accountForDeferredWriteSubtreeRemoval in class Node
Throws:
DatabaseException

isValidForDelete

boolean isValidForDelete()
                   throws DatabaseException
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.

Specified by:
isValidForDelete in class Node
Returns:
true if you're part of a deletable subtree.
Throws:
DatabaseException

findParent

void findParent(Tree.SearchType searchType,
                long targetNodeId,
                boolean targetContainsDuplicates,
                boolean targetIsRoot,
                byte[] targetMainTreeKey,
                byte[] targetDupTreeKey,
                SearchResult result,
                boolean requireExactMatch,
                CacheMode cacheMode,
                int targetLevel,
                List<TrackingInfo> trackingList,
                boolean doFetch)
          throws RelatchRequiredException,
                 DatabaseException
Determine if 'this' is the parent of a child (targetNodeId). If not, find a child of 'this' that may be the parent and return it. If there are no possibilities, then return null. Note that the keys of the target are passed in as args so we don't have to latch the target to look at them. Also, 'this' 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 have a potential ancestor, but are not sure if this is the parent. On return, if result.parent is non-null, then the IN that it refers to will be latched. If an exception is thrown, then "this" is latched.
Throws:
RelatchRequiredException
DatabaseException

descendOnParentSearch

protected void descendOnParentSearch(SearchResult result,
                                     boolean targetContainsDuplicates,
                                     boolean targetIsRoot,
                                     long targetNodeId,
                                     Node child,
                                     boolean requireExactMatch)
                              throws DatabaseException
Throws:
DatabaseException

isSoughtNode

protected boolean isSoughtNode(long nid,
                               CacheMode cacheMode,
                               boolean doFetch)
                        throws DatabaseException
Specified by:
isSoughtNode in class Node
Returns:
true if you're an IN in the search path
Throws:
DatabaseException

canBeAncestor

protected boolean canBeAncestor(boolean targetContainsDuplicates)
Specified by:
canBeAncestor in class Node
Returns:
true if you can be the ancestor of the target IN. Currently the determining factor is whether the target IN contains duplicates.

isEvictable

public boolean isEvictable()
Returns whether this node can be evicted. This is slower 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 specific evaluation done by getEvictionType() is used when initially selecting a node for inclusion in the eviction set. Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.


getEvictionType

public int getEvictionType()
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. Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.

Returns:
MAY_EVICT_LNS if evictable LNs may be stripped; otherwise, MAY_EVICT_NODE if the node itself may be evicted; otherwise, MAY_NOT_EVICT.

isEvictionProhibited

boolean isEvictionProhibited()
Returns whether the node is not evictable, irrespective of the status of the children nodes. Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.


hasPinnedChildren

boolean hasPinnedChildren()
Returns whether any resident children are not LNs (are INs). For an IN, that equates to whether there are any resident children at all. Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.


getChildEvictionType

int getChildEvictionType()
Returns the eviction type based on the status of child nodes, irrespective of isEvictionProhibited. Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.


hasResidentChildren

final boolean hasResidentChildren()
Returns whether any child is non-null. Is final to indicate it is not overridden (unlike hasPinnedChildren, isEvictionProhibited, etc). Note that the IN may or may not be latched when this method is called. Returning the wrong answer is OK in that case (it will be called again later when latched), but an exception should not occur.


accumulateStats

void accumulateStats(TreeWalkerStatsAccumulator acc)

logDirtyChildren

public void logDirtyChildren()
                      throws DatabaseException
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.

Throws:
DatabaseException

log

public long log(LogManager logManager)
         throws DatabaseException
Log this IN and clear the dirty flag.

Throws:
DatabaseException

log

public long log(LogManager logManager,
                boolean allowDeltas,
                boolean isProvisional,
                boolean backgroundIO,
                IN parent)
         throws DatabaseException
Log this node with all available options.

Throws:
DatabaseException

log

public long log(LogManager logManager,
                boolean allowDeltas,
                Provisional provisional,
                boolean backgroundIO,
                IN parent)
         throws DatabaseException
Throws:
DatabaseException

optionalLog

public long optionalLog(LogManager logManager)
                 throws DatabaseException
Log this IN and clear the dirty flag.

Throws:
DatabaseException

optionalLogProvisional

public long optionalLogProvisional(LogManager logManager,
                                   IN parent)
                            throws DatabaseException
Log this node provisionally and clear the dirty flag.

Parameters:
item - object to be logged
Returns:
LSN of the new log entry
Throws:
DatabaseException

beforeLog

public void beforeLog(LogManager logManager,
                      INLogItem item,
                      INLogContext context)
               throws DatabaseException
Pre-log processing. Used implicitly for single-item logging and explicitly for multi-item logging. Overridden by subclasses as needed. Decide how to log this node. INs are always logged in full. Cleaner LN migration is never performed since it only applies to BINs.

Throws:
DatabaseException - from subclasses.

afterLog

public void afterLog(LogManager logManager,
                     INLogItem item,
                     INLogContext context)
              throws DatabaseException
Post-log processing. Used implicitly for single-item logging and explicitly for multi-item logging. Overridden by subclasses as needed. The last version of this node must be counted obsolete at the correct time. If logging non-provisionally, the last version of this node and any provisionally logged descendants are immediately obsolete and can be flushed. If logging provisionally, the last version isn't obsolete until an ancestor is logged non-provisionally, so propagate obsolete lsns upwards.

Throws:
DatabaseException

trackProvisionalObsolete

void trackProvisionalObsolete(IN childIN,
                              long obsoleteLsn,
                              boolean isObsoleteLN,
                              int obsoleteSize)
Adds the given obsolete LSN 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 or LN is logged provisionally. Such LSNs cannot be considered obsolete until an ancestor IN is logged non-provisionally.


incEvictStats

public void incEvictStats(Evictor.EvictionSource source)
We categorize eviction stats by the type of IN, so IN subclasses update different stats.


incFetchStats

public void incFetchStats(EnvironmentImpl envImpl,
                          boolean isMiss)
Description copied from class: Node
We categorize fetch stats by the type of node, so node subclasses update different stats.

Specified by:
incFetchStats in class Node
See Also:
Node.incFetchStats(com.sleepycat.je.dbi.EnvironmentImpl, boolean)

getLogType

public LogEntryType getLogType()
Specified by:
getLogType in class Node
See Also:
Node.getLogType()

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Overrides:
getLogSize in class Node
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer logBuffer)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Overrides:
writeToLog in class Node
Parameters:
logBuffer - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        int entryVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
Overrides:
readFromLog in class Node
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, int)

dumpLog

public void dumpLog(StringBuilder sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Overrides:
dumpLog in class Node
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuilder, boolean)

logicalEquals

public boolean logicalEquals(Loggable other)
Specified by:
logicalEquals in interface Loggable
Returns:
true if these two loggable items are logically the same. Used for replication testing.
See Also:
Always return false, this item should never be compared.

dumpLogAdditional

protected void dumpLogAdditional(StringBuilder sb)
Allows subclasses to add additional fields before the end tag. If they just overload dumpLog, the xml isn't nested.


beginTag

public String beginTag()

endTag

public String endTag()

dumpKeys

void dumpKeys()

dumpString

public String dumpString(int nSpaces,
                         boolean dumpTags)
For unit test support:

Overrides:
dumpString in class Node
Returns:
a string that dumps information about this IN, without

dumpDeletedState

static void dumpDeletedState(StringBuilder sb,
                             byte state)
Utility method for output of knownDeleted and pendingDelete.


toString

public String toString()
Description copied from class: Node
Default toString method at the root of the tree.

Overrides:
toString in class Node

shortClassName

public String shortClassName()


Copyright (c) 2004-2010 Oracle. All rights reserved.