|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.tree.Node
com.sleepycat.je.tree.IN
public class IN
An IN represents an Internal Node in the JE tree.
Field Summary | |
---|---|
static int |
ACCUMULATED_LIMIT
|
static int |
BIN_LEVEL
|
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
|
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 | |
---|---|
void |
afterLog(LogManager logManager,
INLogItem item,
INLogContext context)
Post-log processing. |
void |
beforeLog(LogManager logManager,
INLogItem item,
INLogContext context)
Pre-log processing. |
java.lang.String |
beginTag()
|
protected boolean |
canBeAncestor(boolean targetContainsDuplicates)
|
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. |
int |
compareTo(IN argIN)
Sort based on equality key. |
boolean |
compress(BINReference binRef,
boolean canFetch,
LocalUtilizationTracker localTracker)
|
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. |
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)
|
void |
dumpLog(java.lang.StringBuffer sb,
boolean verbose)
Write the object into the string buffer for log dumping. |
protected void |
dumpLogAdditional(java.lang.StringBuffer sb)
Allows subclasses to add additional fields before the end tag. |
java.lang.String |
dumpString(int nSpaces,
boolean dumpTags)
For unit test support: |
java.lang.String |
endTag()
|
boolean |
equals(java.lang.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. |
int |
findEntry(byte[] key,
boolean indicateIfDuplicate,
boolean exact)
Find the entry in this IN for which key arg is >= the key. |
protected int |
generateLevel(DatabaseId dbId,
int newLevel)
|
long |
getBudgetedMemorySize()
Returns the amount of memory currently budgeted for this IN. |
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)
|
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. |
java.util.Comparator<byte[]> |
getKeyComparator()
Return the relevant user defined comparison function for this type of node. |
long |
getLastFullVersion()
Returns the last logged LSN, or null if never logged. |
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. |
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. |
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. |
protected void |
init(DatabaseImpl db,
byte[] identifierKey,
int initialCapacity,
int level)
Initialize IN object. |
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. |
boolean |
isCompressible()
|
boolean |
isDbRoot()
|
boolean |
isEntryKnownDeleted(int idx)
|
boolean |
isEntryPendingDeleted(int idx)
|
boolean |
isEvictable()
Returns whether this node can be evicted. |
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)
|
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 proactiveMigration,
boolean backgroundIO,
IN parent)
Log this node with all available options. |
long |
log(LogManager logManager,
boolean allowDeltas,
Provisional provisional,
boolean proactiveMigration,
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)
|
boolean |
needsSplitting()
Return true if this node needs splitting. |
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. |
void |
readFromLog(java.nio.ByteBuffer itemBuffer,
byte entryVersion)
Initialize this object from the data in itemBuf. |
void |
releaseLatch()
Release the latch on this node. |
void |
releaseLatchIfOwner()
Release the latch on this node. |
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)
|
void |
setInListResident(boolean resident)
Called when adding/removing this IN to/from the INList. |
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)
|
java.lang.String |
shortClassName()
|
protected void |
splitInternal(IN parent,
int childIndex,
int maxEntries,
int splitIndex,
CacheMode cacheMode)
|
java.lang.String |
toString()
Default toString method at the root of the tree. |
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)
|
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. |
void |
verify(byte[] maxKey)
Check that the IN is in a valid state. |
boolean |
verifyMemorySize()
|
void |
writeToLog(java.nio.ByteBuffer logBuffer)
Serialize this object into the buffer. |
Methods inherited from class com.sleepycat.je.tree.Node |
---|
containsDuplicates, dump, getMemorySizeIncludedByParent, getNodeId, getTransactionId, getType, 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 |
---|
public static final int DBMAP_LEVEL
public static final int MAIN_LEVEL
public static final int LEVEL_MASK
public static final int MIN_LEVEL
public static final int MAX_LEVEL
public static final int BIN_LEVEL
public static final int MAY_NOT_EVICT
public static final int MAY_EVICT_LNS
public static final int MAY_EVICT_NODE
protected SharedLatch latch
public static final int EXACT_MATCH
public static final int INSERT_SUCCESS
public static int ACCUMULATED_LIMIT
Constructor Detail |
---|
public IN()
public IN(DatabaseImpl dbImpl, byte[] identifierKey, int capacity, int level)
Method Detail |
---|
protected void init(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level)
protected void initMemorySize()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(IN argIN)
compareTo
in interface java.lang.Comparable<IN>
protected IN createNewInstance(byte[] identifierKey, int maxEntries, int level)
public void postFetchInit(DatabaseImpl db, long sourceLsn) throws DatabaseException
postFetchInit
in class Node
DatabaseException
public void postRecoveryInit(DatabaseImpl db, long sourceLsn)
public long getLastFullVersion()
public void latch(CacheMode cacheMode) throws DatabaseException
DatabaseException
public void latchShared(CacheMode cacheMode) throws DatabaseException
latchShared
in class Node
DatabaseException
public boolean latchNoWait(CacheMode cacheMode) throws DatabaseException
DatabaseException
public void latch() throws DatabaseException
DatabaseException
public void latchShared() throws DatabaseException
latchShared
in class Node
DatabaseException
public boolean latchNoWait() throws DatabaseException
DatabaseException
public void releaseLatch() throws LatchNotHeldException
releaseLatch
in class Node
LatchNotHeldException
public void releaseLatchIfOwner() throws LatchNotHeldException
LatchNotHeldException
public boolean isLatchOwnerForRead()
public boolean isLatchOwnerForWrite()
public long getGeneration()
public void setGeneration(CacheMode cacheMode)
public void setGeneration(long newGeneration)
public int getLevel()
Node
getLevel
in class Node
protected int generateLevel(DatabaseId dbId, int newLevel)
public boolean getDirty()
public void setDirty(boolean dirty)
public boolean getRecalcToggle()
public void setRecalcToggle(boolean toggle)
public boolean isRoot()
public boolean isDbRoot()
public byte[] getIdentifierKey()
public byte[] getChildKey(IN child) throws DatabaseException
DatabaseException
public byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey)
public byte[] getDupKey() throws DatabaseException
DatabaseException
public byte[] getDupTreeKey()
public byte[] getMainTreeKey()
public DatabaseImpl getDatabase()
public void setDatabase(DatabaseImpl db)
public DatabaseId getDatabaseId()
public byte[] getKey(int idx)
public boolean getMigrate(int idx)
public void setMigrate(int idx, boolean migrate)
public byte getState(int idx)
public Node getTarget(int idx)
public long getLsn(int idx)
public boolean isEntryPendingDeleted(int idx)
public void setPendingDeleted(int idx)
public void clearPendingDeleted(int idx)
public boolean isEntryKnownDeleted(int idx)
public int getNEntries()
public Node fetchTarget(int idx) throws DatabaseException
DatabaseException
public void setEntry(int idx, Node target, byte[] keyVal, long lsn, byte state)
public void clearLsn(int idx)
public void updateNode(int idx, Node node, long oldSize, long lsn, byte[] lnSlotKey)
public void updateNode(int idx, Node node, byte[] lnSlotKey)
public void updateNode(int idx, Node node, long lsn, byte[] lnSlotKey)
public void updateEntry(int idx, Node node, long lsn, byte[] key)
public void updateEntry(int idx, long lsn)
public void updateEntry(int idx, long lsn, byte state)
public boolean verifyMemorySize()
public long getBudgetedMemorySize()
public long getTreeAdminMemorySize()
public long getInMemorySize()
protected long getEntryInMemorySize(byte[] key, Node target)
protected long computeMemorySize()
public static long computeOverhead(DbConfigManager configManager) throws DatabaseException
DatabaseException
protected static long computeArraysOverhead(DbConfigManager configManager) throws DatabaseException
DatabaseException
protected long getMemoryOverhead(MemoryBudget mb)
protected void updateMemorySize(ChildReference oldRef, ChildReference newRef)
protected void updateMemorySize(long oldSize, long newSize)
public void setInListResident(boolean resident)
public boolean getInListResident()
public boolean isKeyInBounds(byte[] keyVal)
public int findEntry(byte[] key, boolean indicateIfDuplicate, boolean exact)
key
- - the key to search for.indicateIfDuplicate
- - true if EXACT_MATCH should
be or'd onto the return value if key is already present in this node.exact
- - true if an exact match must be found.
public boolean insertEntry(ChildReference entry) throws DatabaseException
entry
- The ChildReference to insert into the IN.
InconsistentNodeException
- if the node is full
(it should have been split earlier).
DatabaseException
public int insertEntry1(ChildReference entry) throws DatabaseException
entry
- The ChildReference to insert into the IN.
InconsistentNodeException
- if the node is full (it should have
been split earlier).
DatabaseException
public boolean deleteEntry(int index, boolean maybeValidate) throws DatabaseException
index
- The index of the entry to delete from the IN.maybeValidate
- true if asserts are enabled.
DatabaseException
public void setProhibitNextDelta()
public boolean compress(BINReference binRef, boolean canFetch, LocalUtilizationTracker localTracker) throws DatabaseException
DatabaseException
public boolean isCompressible()
public boolean needsSplitting()
protected void splitInternal(IN parent, int childIndex, int maxEntries, int splitIndex, CacheMode cacheMode) throws DatabaseException
DatabaseException
public java.util.Comparator<byte[]> getKeyComparator()
public void verify(byte[] maxKey) throws DatabaseException
verify
in class Node
DatabaseException
protected void descendOnParentSearch(SearchResult result, boolean targetContainsDuplicates, boolean targetIsRoot, long targetNodeId, Node child, boolean requireExactMatch) throws DatabaseException
DatabaseException
protected boolean isSoughtNode(long nid, CacheMode cacheMode) throws DatabaseException
isSoughtNode
in class Node
DatabaseException
protected boolean canBeAncestor(boolean targetContainsDuplicates)
canBeAncestor
in class Node
public boolean isEvictable()
public int getEvictionType()
public void logDirtyChildren() throws DatabaseException
DatabaseException
public long log(LogManager logManager) throws DatabaseException
DatabaseException
public long log(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent) throws DatabaseException
DatabaseException
public long log(LogManager logManager, boolean allowDeltas, Provisional provisional, boolean proactiveMigration, boolean backgroundIO, IN parent) throws DatabaseException
DatabaseException
public long optionalLog(LogManager logManager) throws DatabaseException
DatabaseException
public long optionalLogProvisional(LogManager logManager, IN parent) throws DatabaseException
item
- object to be logged
DatabaseException
public void beforeLog(LogManager logManager, INLogItem item, INLogContext context) throws DatabaseException
DatabaseException
public void afterLog(LogManager logManager, INLogItem item, INLogContext context) throws DatabaseException
DatabaseException
public LogEntryType getLogType()
getLogType
in class Node
Node.getLogType()
public int getLogSize()
getLogSize
in interface Loggable
getLogSize
in class Node
Loggable.getLogSize()
public void writeToLog(java.nio.ByteBuffer logBuffer)
Loggable
writeToLog
in interface Loggable
writeToLog
in class Node
logBuffer
- is the destination bufferLoggable.writeToLog(java.nio.ByteBuffer)
public void readFromLog(java.nio.ByteBuffer itemBuffer, byte entryVersion) throws LogException
Loggable
readFromLog
in interface Loggable
readFromLog
in class Node
LogException
Loggable.readFromLog(java.nio.ByteBuffer, byte)
public void dumpLog(java.lang.StringBuffer sb, boolean verbose)
Loggable
dumpLog
in interface Loggable
dumpLog
in class Node
sb
- destination string bufferverbose
- if true, dump the full, verbose versionLoggable.dumpLog(java.lang.StringBuffer, boolean)
public boolean logicalEquals(Loggable other)
logicalEquals
in interface Loggable
Always return false, this item should never be compared.
protected void dumpLogAdditional(java.lang.StringBuffer sb)
public java.lang.String beginTag()
public java.lang.String endTag()
public java.lang.String dumpString(int nSpaces, boolean dumpTags)
public java.lang.String toString()
Node
toString
in class Node
public java.lang.String shortClassName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |