public class LN extends Node implements Loggable
Constructor and Description |
---|
LN()
Create an empty LN, to be filled in from the log.
|
LN(byte[] data)
Create a new LN from a byte array.
|
LN(DatabaseEntry dbt)
Create a new LN from a DatabaseEntry.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
beginTag() |
protected boolean |
canBeAncestor(boolean targetContainsDuplicates)
A LN can never be the ancestor of another node.
|
byte[] |
copyData() |
long |
delete(DatabaseImpl database,
byte[] lnKey,
byte[] dupKey,
long oldLsn,
Locker locker)
Delete this LN's data and log the new version.
|
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,
boolean verbose) |
java.lang.String |
dumpString(int nSpaces,
boolean dumpTags) |
java.lang.String |
endTag() |
byte[] |
getData() |
int |
getLastLoggedSize()
Returns the total last logged log size, including the LNLogEntry
overhead of this LN when it was last logged and the log entry
header.
|
int |
getLogSize() |
LogEntryType |
getLogType() |
long |
getMemorySizeIncludedByParent()
Compute the approximate size of this node in memory for evictor
invocation purposes.
|
protected LogEntryType |
getTransactionalLogType()
Log type for transactional entries
|
boolean |
isDeleted() |
boolean |
isDirty() |
protected boolean |
isSoughtNode(long nid,
boolean updateGeneration)
A LN can never be a child in the search chain.
|
long |
log(EnvironmentImpl env,
DatabaseId dbId,
byte[] key,
byte[] delDupKey,
long oldLsn,
int oldSize,
Locker locker,
boolean backgroundIO,
boolean isProvisional)
Log this LN.
|
long |
logUpdateMemUsage(DatabaseImpl database,
byte[] lnKey,
long oldLsn,
Locker locker,
IN parent)
Veriation of logUpdateMemUsage that specifies false for the backgroundIO
parameter.
|
long |
logUpdateMemUsage(DatabaseImpl database,
byte[] lnKey,
long oldLsn,
Locker locker,
IN parent,
boolean backgroundIO)
Logs an LN that is already present in the parent IN, adjusting the
memory budget if the size of the LN changes during logging, such as
for FileSummaryLNs.
|
long |
modify(byte[] newData,
DatabaseImpl database,
byte[] lnKey,
long oldLsn,
Locker locker)
Modify the LN's data and log the new version.
|
long |
optionalLog(EnvironmentImpl env,
DatabaseImpl databaseImpl,
byte[] key,
long oldLsn,
int oldSize,
Locker locker)
Log this LN if it's not part of a deferred-write db.
|
long |
optionalLogProvisional(EnvironmentImpl env,
DatabaseImpl databaseImpl,
byte[] key,
long oldLsn,
int oldSize)
Log a provisional, non-txnal version of an LN.
|
long |
optionalLogUpdateMemUsage(DatabaseImpl database,
byte[] lnKey,
long oldLsn,
Locker locker,
IN parent)
Veriation of logUpdateMemUsage that does not log for a DeferredWrite DB.
|
void |
readFromLog(java.nio.ByteBuffer itemBuffer,
byte entryTypeVersion)
Initialize this object from the data in itemBuf.
|
void |
setLastLoggedSize(int size)
Saves the last logged size.
|
void |
writeToLog(java.nio.ByteBuffer logBuffer)
Serialize this object into the buffer.
|
containsDuplicates, dump, getLastId, getNextNodeId, getNodeId, getTransactionId, getType, latchShared, postFetchInit, releaseLatch, setLastNodeId, shortDescription, toString, verify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getTransactionId
public LN()
public LN(byte[] data)
public LN(DatabaseEntry dbt)
public byte[] getData()
public byte[] copyData()
public boolean isDeleted()
public boolean isDirty()
protected boolean isSoughtNode(long nid, boolean updateGeneration)
isSoughtNode
in class Node
protected boolean canBeAncestor(boolean targetContainsDuplicates)
canBeAncestor
in class Node
public long delete(DatabaseImpl database, byte[] lnKey, byte[] dupKey, long oldLsn, Locker locker) throws DatabaseException
DatabaseException
public long modify(byte[] newData, DatabaseImpl database, byte[] lnKey, long oldLsn, Locker locker) throws DatabaseException
DatabaseException
public long logUpdateMemUsage(DatabaseImpl database, byte[] lnKey, long oldLsn, Locker locker, IN parent, boolean backgroundIO) throws DatabaseException
DatabaseException
public long logUpdateMemUsage(DatabaseImpl database, byte[] lnKey, long oldLsn, Locker locker, IN parent) throws DatabaseException
DatabaseException
public long optionalLogUpdateMemUsage(DatabaseImpl database, byte[] lnKey, long oldLsn, Locker locker, IN parent) throws DatabaseException
DatabaseException
public long getMemorySizeIncludedByParent()
getMemorySizeIncludedByParent
in class Node
public java.lang.String beginTag()
public java.lang.String endTag()
public java.lang.String dumpString(int nSpaces, boolean dumpTags)
public long optionalLog(EnvironmentImpl env, DatabaseImpl databaseImpl, byte[] key, long oldLsn, int oldSize, Locker locker) throws DatabaseException
env
- the environment.dbId
- database id of this node. (Not stored in LN)key
- key of this node. (Not stored in LN)oldLsn
- is the LSN of the previous version or NULL_LSN.oldSize
- is the size of the previous version or zero.locker
- owning locker.DatabaseException
public long optionalLogProvisional(EnvironmentImpl env, DatabaseImpl databaseImpl, byte[] key, long oldLsn, int oldSize) throws DatabaseException
env
- the environment.dbId
- database id of this node. (Not stored in LN)key
- key of this node. (Not stored in LN)oldLsn
- is the LSN of the previous version or NULL_LSN.oldSize
- is the size of the previous version or zero.DatabaseException
public long log(EnvironmentImpl env, DatabaseId dbId, byte[] key, byte[] delDupKey, long oldLsn, int oldSize, Locker locker, boolean backgroundIO, boolean isProvisional) throws DatabaseException
env
- the environment.dbId
- database id of this node. (Not stored in LN)key
- key of this node. (Not stored in LN)delDupKey
- if non-null, the dupKey for deleting the LN.oldLsn
- is the LSN of the previous version or NULL_LSN.oldSize
- is the size of the previous version or zero.locker
- owning locker.DatabaseException
protected LogEntryType getTransactionalLogType()
public LogEntryType getLogType()
getLogType
in class Node
Node.getLogType()
public int getLastLoggedSize()
public void setLastLoggedSize(int size)
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 entryTypeVersion) 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)
protected void dumpLogAdditional(java.lang.StringBuffer sb, boolean verbose)