public class LNLogEntry<T extends LN> extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_LOG_SIZE
Used for computing the minimum log space used by an LNLogEntry.
|
| Constructor and Description |
|---|
LNLogEntry(LogEntryType entryType,
DatabaseId dbId,
Txn txn,
long abortLsn,
boolean abortKD,
byte[] abortKey,
byte[] abortData,
long abortVLSN,
int abortExpiration,
boolean abortExpirationInHours,
byte[] key,
T ln,
boolean embeddedLN,
int expiration,
boolean expirationInHours,
int priorSize,
long priorLsn) |
| Modifier and Type | Method and Description |
|---|---|
LogEntry |
clone() |
boolean |
countPriorVersionObsolete()
Returns true if recovery should count the prior version obsolete using
getPriorVersionSize() and getPriorVersionLsn() ()}. |
static <T extends LN> |
create(Class<T> cls)
Creates an instance to read an entry.
|
StringBuilder |
dumpEntry(StringBuilder sb,
boolean verbose)
Print out the contents of an entry.
|
void |
dumpRep(StringBuilder sb)
Dump the contents of the log entry that are interesting for
replication.
|
byte[] |
getAbortData() |
int |
getAbortExpiration() |
byte[] |
getAbortKey() |
boolean |
getAbortKnownDeleted() |
long |
getAbortLsn() |
long |
getAbortVLSN() |
byte[] |
getData() |
DatabaseId |
getDbId() |
byte[] |
getEmbeddedData() |
Collection<VersionedWriteLoggable> |
getEmbeddedLoggables()
Returns all possible
VersionedWriteLoggable objects that may be
embedded in the binary data of this log entry. |
int |
getExpiration() |
byte[] |
getKey() |
int |
getLastFormatChange()
Returns the log version of the most recent format change for this log
entry.
|
LN |
getLN() |
Class<T> |
getLogClass()
Returns the class of the contained loggable item or items, or null if
the instance was created to write an entry.
|
LogEntryType |
getLogType() |
LN |
getMainItem() |
long |
getPriorVersionLsn()
Returns the LSN of the prior version of this LN, for purposes of
obsolete counting -- the LSN offset may be incorrect, but the LSN file
is correct.
|
int |
getPriorVersionSize()
Returns the log size of the prior version of this LN.
|
Object |
getResolvedItem(DatabaseImpl dbImpl)
By default, this log entry is complete and does not require fetching
additional entries.
|
int |
getSize() |
int |
getSize(int logVersion,
boolean forReplication)
Returns the number of bytes needed to store this entry in the format for
the specified log version.
|
long |
getTransactionId() |
Long |
getTxnId() |
int |
getUnconvertedDataLength()
This method is only used when the converted length is not needed, for
example by StatsFileReader.
|
int |
getUnconvertedKeyLength()
This method is only used when the converted length is not needed, for
example by StatsFileReader.
|
void |
getUserKeyData(DatabaseEntry keyParam,
DatabaseEntry dataParam)
Translates two-part keys in duplicate DBs back to the original user
operation params.
|
Txn |
getUserTxn() |
boolean |
hasReplicationFormat()
Returns whether this format has a variant that is optimized for
replication.
|
boolean |
isAbortExpirationInHours() |
boolean |
isDeleted()
Returns whether this is a deleted LN.
|
boolean |
isEmbeddedLN() |
boolean |
isExpirationInHours() |
boolean |
isImmediatelyObsolete(DatabaseImpl dbImpl)
Returns true if this item should be counted as obsolete when logged.
|
boolean |
isReplicationFormatWorthwhile(ByteBuffer logBuffer,
int srcVersion,
int destVersion)
Returns whether it is worthwhile to materialize and then re-serialize a
log entry in a format optimized for replication.
|
boolean |
logicalEquals(LogEntry other) |
void |
postFetchInit(boolean isDupDb)
Converts the key/data for old format LNs in a duplicates DB.
|
void |
postFetchInit(DatabaseImpl dbImpl) |
void |
postLogWork(LogEntryHeader header,
long justLoggedLsn,
VLSN vlsn)
For LN entries, we need to record the latest LSN for that node with the
owning transaction, within the protection of the log latch.
|
void |
readEntry(EnvironmentImpl envImpl,
LogEntryHeader header,
ByteBuffer entryBuffer)
Read in a log entry.
|
void |
setLogType(LogEntryType entryType)
Inform a BaseEntry instance of its corresponding LogEntryType.
|
String |
toString() |
void |
writeEntry(ByteBuffer destBuffer)
Serialize this object into the buffer.
|
void |
writeEntry(ByteBuffer destBuffer,
int logVersion,
boolean forReplication)
Serializes this object into the specified buffer in the format for the
the specified log version.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclone, getLogType, getResolvedItem, setLogTypepublic static final int MIN_LOG_SIZE
public LNLogEntry(LogEntryType entryType, DatabaseId dbId, Txn txn, long abortLsn, boolean abortKD, byte[] abortKey, byte[] abortData, long abortVLSN, int abortExpiration, boolean abortExpirationInHours, byte[] key, T ln, boolean embeddedLN, int expiration, boolean expirationInHours, int priorSize, long priorLsn)
public static <T extends LN> LNLogEntry<T> create(Class<T> cls)
T - the type of the contained LNcls - the class of the contained LNpublic void readEntry(EnvironmentImpl envImpl, LogEntryHeader header, ByteBuffer entryBuffer)
LogEntrypublic boolean hasReplicationFormat()
ReplicableLogEntryhasReplicationFormat in interface ReplicableLogEntrypublic boolean isReplicationFormatWorthwhile(ByteBuffer logBuffer, int srcVersion, int destVersion)
ReplicableLogEntryWARNING: The logBuffer position must not be changed by this method.
WARNING: The shared LogEntry object is used for calling this method, and this method must not change any of the fields in the object.
isReplicationFormatWorthwhile in interface ReplicableLogEntrylogBuffer - contains the entry that would be re-serialized.srcVersion - the log version of entry in logBuffer.destVersion - the version that would be used for re-serialization.public StringBuilder dumpEntry(StringBuilder sb, boolean verbose)
LogEntrypublic void dumpRep(StringBuilder sb)
LogEntrypublic LN getMainItem()
public long getTransactionId()
public int getLastFormatChange()
ReplicableLogEntrypublic Collection<VersionedWriteLoggable> getEmbeddedLoggables()
ReplicableLogEntryVersionedWriteLoggable objects that may be
embedded in the binary data of this log entry.
This is used by tests to ensure that for each X:Y pair, where X is a ReplicableLogEntry and Y is a VersionedWriteLoggable, and X embeds Y either directly or indirectly, X.getLastFormatChange is greater than or equal to Y.getLastFormatChange.
Each ReplicableLogEntry and VersionedWriteLoggable class typically has a LAST_FORMAT_CHANGE constant that is returned by its getLastFormatChange method. When bumping this constant for an object X embedded by an log entry Y, Y.LAST_FORMAT_CHANGE should also be set to the minimum of its current value and X.LAST_FORMAT_CHANGE.
Enforcing this rule in a general way is made possible by the getEmbeddedLoggables method of each ReplicableLogEntry and VersionedWriteLoggable. Note that this method is not intended to be called outside of tests.
public int getSize(int logVersion,
boolean forReplication)
ReplicableLogEntryLogEntryType.LOG_VERSION_REPLICATE_OLDER or greater.logVersion - the log versionforReplication - whether the entry will be sent over the wire,
and not written to the log.public void writeEntry(ByteBuffer destBuffer, int logVersion, boolean forReplication)
ReplicableLogEntryLogEntryType.LOG_VERSION_REPLICATE_OLDER or greater.destBuffer - the destination bufferlogVersion - the log versionforReplication - whether the entry will be sent over the wire,
and not written to the log.public boolean isImmediatelyObsolete(DatabaseImpl dbImpl)
LogEntryisImmediatelyObsolete in interface LogEntrypublic boolean isDeleted()
LogEntrypublic void postLogWork(LogEntryHeader header, long justLoggedLsn, VLSN vlsn)
postLogWork in interface LogEntrypublic void postFetchInit(DatabaseImpl dbImpl)
public void postFetchInit(boolean isDupDb)
public void getUserKeyData(DatabaseEntry keyParam, DatabaseEntry dataParam)
public boolean isEmbeddedLN()
public LN getLN()
public byte[] getKey()
public byte[] getData()
public byte[] getEmbeddedData()
public int getExpiration()
public boolean isExpirationInHours()
public int getUnconvertedDataLength()
public int getUnconvertedKeyLength()
public DatabaseId getDbId()
public long getAbortLsn()
public boolean getAbortKnownDeleted()
public byte[] getAbortKey()
public byte[] getAbortData()
public long getAbortVLSN()
public boolean countPriorVersionObsolete()
getPriorVersionSize() and getPriorVersionLsn() ()}.
True is returned if there is a prior version of this LN that is not
immediately obsolete.public int getPriorVersionSize()
countPriorVersionObsolete() returns
false.public long getPriorVersionLsn()
countPriorVersionObsolete() returns
false.public int getAbortExpiration()
public boolean isAbortExpirationInHours()
public Long getTxnId()
public Txn getUserTxn()
public boolean logicalEquals(LogEntry other)
public void writeEntry(ByteBuffer destBuffer)
LogEntrywriteEntry in interface LogEntrydestBuffer - is the destination bufferpublic int getSize()
public Class<T> getLogClass()
public void setLogType(LogEntryType entryType)
setLogType in interface LogEntrypublic LogEntryType getLogType()
getLogType in interface LogEntrypublic Object getResolvedItem(DatabaseImpl dbImpl)
getResolvedItem in interface LogEntrypublic LogEntry clone()
Copyright © 2024. All rights reserved.