Java Doc for IN.java in  » JMX » je » com » sleepycat » je » tree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » je » com.sleepycat.je.tree 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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,
IN
public class IN extends Node implements Comparable,Loggable(Code)
An IN represents an Internal Node in the JE tree.


Field Summary
public static  intACCUMULATED_LIMIT
    
final public static  intBIN_LEVEL
    
final public static  intDBMAP_LEVEL
    
final public static  intEXACT_MATCH
    
final public static  intINSERT_SUCCESS
    
final public static  intLEVEL_MASK
    
final public static  intMAIN_LEVEL
    
final public static  intMAX_LEVEL
    
final public static  intMAY_EVICT_LNS
    
final public static  intMAY_EVICT_NODE
    
final public static  intMAY_NOT_EVICT
    
final public static  intMIN_LEVEL
    
protected  SharedLatchlatch
    

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
 voidaccountForSubtreeRemoval(INList inList, UtilizationTracker tracker)
     Remove self and children from the in-memory IN list.
 voidaccumulateStats(TreeWalkerStatsAccumulator acc)
    
 voidadjustCursors(IN newSibling, int newSiblingLow, int newSiblingHigh)
    
 voidadjustCursorsForInsert(int insertIndex)
    
public  StringbeginTag()
    
protected  booleancanBeAncestor(boolean targetContainsDuplicates)
    
 voidclearKnownDeleted(int idx)
     Set knownDeleted to false.
public  voidclearPendingDeleted(int idx)
     Set pendingDeleted to false.
public  intcompareTo(Object o)
     Sort based on node id.
public  booleancompress(BINReference binRef, boolean canFetch, UtilizationTracker tracker)
    
protected static  longcomputeArraysOverhead(DbConfigManager configManager)
    
protected  longcomputeMemorySize()
     Count up the memory usage attributable to this node alone.
public static  longcomputeOverhead(DbConfigManager configManager)
    
protected  INcreateNewInstance(byte[] identifierKey, int maxEntries, int level)
     Create a new IN.
 booleandeleteEntry(byte[] key, boolean maybeValidate)
     Deletes the ChildReference with the key arg from this IN.
public  booleandeleteEntry(int index, boolean maybeValidate)
     Deletes the ChildReference at index from this IN.
protected  voiddescendOnParentSearch(SearchResult result, boolean targetContainsDuplicates, boolean targetIsRoot, long targetNodeId, Node child, boolean requireExactMatch)
    
static  voiddumpDeletedState(StringBuffer sb, byte state)
     Utility method for output of knownDeleted and pendingDelete.
 voiddumpKeys()
    
public  voiddumpLog(StringBuffer sb, boolean verbose)
    
protected  voiddumpLogAdditional(StringBuffer sb)
     Allows subclasses to add additional fields before the end tag.
public  StringdumpString(int nSpaces, boolean dumpTags)
    
public  StringendTag()
    
 booleanentryZeroKeyComparesLow()
     Indicates whether whether entry 0's key is "special" in that it always compares less than any other key.
public  booleanequals(Object obj)
    
public  NodefetchTarget(int idx)
     Returns the target of the idx'th entry or null if a pendingDeleted or knownDeleted entry has been cleaned.
public  intfindEntry(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.
 voidfindParent(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.
 voidflushProvisionalObsolete(LogManager logManager)
     Adds the provisional obsolete tracking information in this node to the live tracker.
protected  intgenerateLevel(DatabaseId dbId, int newLevel)
    
public  intgetAccumulatedDelta()
    
 intgetChildEvictionType()
     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  DatabaseImplgetDatabase()
     Get the database for this IN.
public  DatabaseIdgetDatabaseId()
    
public  booleangetDirty()
    
public  byte[]getDupKey()
     Return the key for this duplicate set.
public  byte[]getDupTreeKey()
     Return the key for navigating through the duplicate tree.
protected  longgetEntryInMemorySize(byte[] key, Node target)
    
 byte[]getEntryLsnByteArray()
    
 long[]getEntryLsnLongArray()
    
public  intgetEvictionType()
     Returns the eviction type for this IN, for use by the evictor.
public  longgetGeneration()
    
public  byte[]getIdentifierKey()
    
public  longgetInMemorySize()
     Return the number of bytes used by this IN.
public  byte[]getKey(int idx)
     Return the idx'th key.
public  ComparatorgetKeyComparator()
     Return the relevant user defined comparison function for this type of node.
public  longgetLastFullVersion()
     Returns the last logged LSN, or null if never logged.
public  intgetLevel()
    
public  intgetLogSize()
    
public  LogEntryTypegetLogType()
    
public  longgetLsn(int idx)
     Return the idx'th LSN for this entry.
public  byte[]getMainTreeKey()
     Return the key for navigating through the main tree.
 intgetMaxEntries()
    
protected  longgetMemoryOverhead(MemoryBudget mb)
    
public  booleangetMigrate(int idx)
     Get the idx'th migrate status.
public  intgetNEntries()
    
public  bytegetState(int idx)
    
public  NodegetTarget(int idx)
     Return the idx'th target.
 booleanhasPinnedChildren()
     Returns whether any resident children are not LNs (are INs).
final  booleanhasResidentChildren()
     Returns whether any child is non-null.
public  inthashCode()
    
protected  voidinit(DatabaseImpl db, byte[] identifierKey, int initialCapacity, int level)
     Initialize IN object.
 voidinitEntryLsn(int capacity)
    
protected  voidinitMemorySize()
     Initialize the per-node memory count by computing its memory usage.
public  booleaninsertEntry(ChildReference entry)
     Inserts the argument ChildReference into this IN.
public  intinsertEntry1(ChildReference entry)
     Same as insertEntry except that it returns the index where the dup was found instead of false.
 booleanisAlwaysLatchedExclusively()
    
public  booleanisCompressible()
    
public  booleanisDbRoot()
    
 booleanisDirty(int idx)
    
public  booleanisEntryKnownDeleted(int idx)
     true if the idx'th entry is deleted for sure.
public  booleanisEntryPendingDeleted(int idx)
    
public  booleanisEvictable()
     Returns whether this node can be evicted.
 booleanisEvictionProhibited()
     Returns whether the node is not evictable, irrespective of the status of the children nodes.
public  booleanisKeyInBounds(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  booleanisLatchOwnerForRead()
    
public  booleanisLatchOwnerForWrite()
    
public  booleanisRoot()
    
protected  booleanisSoughtNode(long nid, boolean updateGeneration)
    
static  booleanisStateKnownDeleted(byte state)
     Returns true if the given state is known deleted.
static  booleanisStatePendingDeleted(byte state)
     Returns true if the given state is known deleted.
 booleanisValidForDelete()
     Check if this node fits the qualifications for being part of a deletable subtree.
public  voidlatch(boolean updateGeneration)
     Latch this node exclusive, optionally setting the generation.
public  voidlatch()
     Latch this node exclusive and set the generation.
public  booleanlatchNoWait(boolean updateGeneration)
     Latch this node if it is not latched by another thread, optionally setting the generation if the latch succeeds.
public  booleanlatchNoWait()
     Latch this node if it is not latched by another thread, and set the generation if the latch succeeds.
public  voidlatchShared(boolean updateGeneration)
     Latch this node shared, optionally setting the generation.
public  voidlatchShared()
     Latch this node shared and set the generation.
public  longlog(LogManager logManager)
     Log this IN and clear the dirty flag.
public  longlog(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent)
     Log this node with all available options.
public  voidlogDirtyChildren()
     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  longlogInternal(LogManager logManager, boolean allowDeltas, boolean isProvisional, boolean proactiveMigration, boolean backgroundIO, IN parent)
     Decide how to log this node.
static  StringmakeFetchErrorMsg(String msg, IN in, long lsn, byte state)
    
public  booleanneedsSplitting()
     Return true if this node needs splitting.
 booleannotOverwritingDeferredWriteEntry(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  longoptionalLog(LogManager logManager)
     Log this IN and clear the dirty flag.
public  longoptionalLogProvisional(LogManager logManager, IN parent)
     Log this node provisionally and clear the dirty flag.
public  voidpostFetchInit(DatabaseImpl db, long sourceLsn)
     Initialize a node that has been read in from the log.
public  voidpostRecoveryInit(DatabaseImpl db, long sourceLsn)
     Initialize a node read in during recovery.
public  voidreadFromLog(ByteBuffer itemBuffer, byte entryTypeVersion)
    
 voidrebuildINList(INList inList)
     Add self and children to this in-memory IN list.
public  voidreleaseLatch()
     Release the latch on this node.
public  voidreleaseLatchIfOwner()
     Release the latch on this node.
public  byte[]selectKey(byte[] mainTreeKey, byte[] dupTreeKey)
    
public  voidsetDatabase(DatabaseImpl db)
     Set the database reference for this node.
public  voidsetDirty(boolean dirty)
    
public  voidsetEntry(int idx, Node target, byte[] keyVal, long lsn, byte state)
     Set the idx'th entry of this node.
public  voidsetGeneration()
    
public  voidsetGeneration(long newGeneration)
    
 voidsetIdentifierKey(byte[] key)
     Set the identifier key for this node.
public  voidsetInListResident(boolean resident)
    
 voidsetIsRoot(boolean isRoot)
    
 voidsetKnownDeleted(int idx)
     Set knownDeleted to true.
 voidsetLastFullLsn(long lsn)
     Sets the last logged LSN.
 voidsetLsnElement(int idx, long value)
    
public  voidsetMigrate(int idx, boolean migrate)
     Set the idx'th migrate status.
public  voidsetPendingDeleted(int idx)
     Set pendingDeleted to true.
public  voidsetProhibitNextDelta()
     Do nothing since INs don't support deltas.
 voidsetTarget(int idx, Node target)
     Sets the idx'th target.
public  StringshortClassName()
    
 voidsplit(IN parent, int childIndex, int maxEntries)
     Split this into two nodes.
protected  voidsplitInternal(IN parent, int childIndex, int maxEntries, int splitIndex)
    
 voidsplitSpecial(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  StringtoString()
    
 voidtrackProvisionalObsolete(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  voidupdateEntry(int idx, Node node)
     Update the idx'th entry of this node.
public  voidupdateEntry(int idx, Node node, long lsn)
     Update the idx'th entry of this node.
public  voidupdateEntry(int idx, Node node, long lsn, byte[] key)
     Update the idx'th entry of this node.
public  voidupdateEntry(int idx, long lsn)
     Update the idx'th entry of this node.
public  voidupdateEntry(int idx, long lsn, byte state)
     Update the idx'th entry of this node.
public  voidupdateEntry(int idx, long lsn, long oldLNSize, long newLNSize)
     Update the idx'th entry of this node.
public  voidupdateKeyIfChanged(int idx, byte[] newKey)
     Updates the idx'th key of this node if it is not identical to the given key.
protected  voidupdateMemorySize(ChildReference oldRef, ChildReference newRef)
    
protected  voidupdateMemorySize(long oldSize, long newSize)
    
 voidupdateMemorySize(Node oldNode, Node newNode)
    
 booleanvalidateSubtreeBeforeDelete(int index)
    
public  voidverify(byte[] maxKey)
     Check that the IN is in a valid state.
public  booleanverifyMemorySize()
    
public  voidwriteToLog(ByteBuffer logBuffer)
    

Field Detail
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)



latch
protected SharedLatch latch(Code)




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




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



accumulateStats
void accumulateStats(TreeWalkerStatsAccumulator acc)(Code)



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



adjustCursorsForInsert
void adjustCursorsForInsert(int insertIndex)(Code)



beginTag
public String beginTag()(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.



compress
public boolean compress(BINReference binRef, boolean canFetch, UtilizationTracker tracker) throws DatabaseException(Code)



computeArraysOverhead
protected static long computeArraysOverhead(DbConfigManager configManager) throws DatabaseException(Code)



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.



computeOverhead
public static long computeOverhead(DbConfigManager configManager) throws DatabaseException(Code)



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.



dumpKeys
void dumpKeys() throws DatabaseException(Code)



dumpLog
public void dumpLog(StringBuffer sb, boolean verbose)(Code)

See Also:   Loggable.dumpLog



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



endTag
public String endTag()(Code)



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.



equals
public boolean equals(Object obj)(Code)



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.



generateLevel
protected int generateLevel(DatabaseId dbId, int newLevel)(Code)



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.



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



getDatabaseId
public DatabaseId getDatabaseId()(Code)



getDirty
public boolean getDirty()(Code)



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



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)



getLogSize
public int getLogSize()(Code)

See Also:   Loggable.getLogSize



getLogType
public LogEntryType getLogType()(Code)

See Also:   Node.getLogType



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.



getMemoryOverhead
protected long getMemoryOverhead(MemoryBudget mb)(Code)



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)



isSoughtNode
protected boolean isSoughtNode(long nid, boolean updateGeneration) throws DatabaseException(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.



latch
public void latch() throws DatabaseException(Code)
Latch this node exclusive and set 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.



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



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



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.



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



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.



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



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



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



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



readFromLog
public void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion) throws LogException(Code)

See Also:   Loggable.readFromLog



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.



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



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



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.




shortClassName
public String shortClassName()(Code)



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



toString
public String toString()(Code)



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(ChildReference oldRef, ChildReference newRef)(Code)



updateMemorySize
protected void updateMemorySize(long oldSize, long newSize)(Code)



updateMemorySize
void updateMemorySize(Node oldNode, Node newNode)(Code)



validateSubtreeBeforeDelete
boolean validateSubtreeBeforeDelete(int index) throws DatabaseException(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)



writeToLog
public void writeToLog(ByteBuffer logBuffer)(Code)

See Also:   Loggable.writeToLog



Methods inherited from com.sleepycat.je.tree.Node
abstract void accountForSubtreeRemoval(INList inList, UtilizationTracker tracker) throws DatabaseException(Code)(Java Doc)
abstract protected boolean canBeAncestor(boolean targetContainsDuplicates)(Code)(Java Doc)
public boolean containsDuplicates()(Code)(Java Doc)
public void dump(int nSpaces)(Code)(Java Doc)
public void dumpLog(StringBuffer sb, boolean verbose)(Code)(Java Doc)
String dumpString(int nSpaces, boolean dumpTags)(Code)(Java Doc)
public static synchronized long getLastId()(Code)(Java Doc)
int getLevel()(Code)(Java Doc)
public int getLogSize()(Code)(Java Doc)
abstract public LogEntryType getLogType()(Code)(Java Doc)
protected long getMemorySizeIncludedByParent()(Code)(Java Doc)
public static synchronized long getNextNodeId()(Code)(Java Doc)
public long getNodeId()(Code)(Java Doc)
public long getTransactionId()(Code)(Java Doc)
public String getType()(Code)(Java Doc)
abstract protected boolean isSoughtNode(long nid, boolean updateGeneration) throws DatabaseException(Code)(Java Doc)
abstract boolean isValidForDelete() throws DatabaseException(Code)(Java Doc)
public void latchShared() throws DatabaseException(Code)(Java Doc)
boolean matchLNByNodeId(TreeLocation location, long nodeId) throws DatabaseException(Code)(Java Doc)
public void postFetchInit(DatabaseImpl db, long sourceLsn) throws DatabaseException(Code)(Java Doc)
public void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion) throws LogException(Code)(Java Doc)
abstract void rebuildINList(INList inList) throws DatabaseException(Code)(Java Doc)
public void releaseLatch() throws LatchNotHeldException(Code)(Java Doc)
public static synchronized void setLastNodeId(long id)(Code)(Java Doc)
void setNodeId(long nid)(Code)(Java Doc)
public String shortDescription()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void verify(byte[] maxKey) throws DatabaseException(Code)(Java Doc)
public void writeToLog(ByteBuffer logBuffer)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.