public class TraceLogEntry extends SingleItemEntry<T>
| Constructor and Description |
|---|
TraceLogEntry()
Construct a log entry for reading a
Trace object. |
TraceLogEntry(Trace trace)
Construct a log entry for writing a
Trace object. |
| Modifier and Type | Method and Description |
|---|---|
LogEntry |
clone() |
Collection<VersionedWriteLoggable> |
getEmbeddedLoggables()
Returns all possible
VersionedWriteLoggable objects that may be
embedded in the binary data of this log entry. |
int |
getLastFormatChange()
Returns the log version of the most recent format change for this log
entry.
|
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() |
Object |
getResolvedItem(DatabaseImpl dbImpl)
By default, this log entry is complete and does not require fetching
additional entries.
|
int |
getSize(int logVersion,
boolean forReplication)
Returns the number of bytes needed to store this entry in the format for
the specified log version.
|
boolean |
hasReplicationFormat()
Returns whether this format has a variant that is optimized for
replication.
|
boolean |
isDeleted()
Returns whether this is a deleted LN.
|
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.
|
void |
postFetchInit(DatabaseImpl dbImpl) |
void |
postLogWork(LogEntryHeader header,
long justLoggedLsn,
VLSN vlsn)
Do any processing we need to do after logging, while under the logging
latch.
|
void |
setLogType(LogEntryType entryType)
Inform a BaseEntry instance of its corresponding LogEntryType.
|
static void |
setTestPriorItem(Loggable priorItem)
Specify an object to write instead of the enclosed item when asked to
write this entry in the log format prior to the last changed version,
for testing.
|
String |
toString() |
void |
writeEntry(ByteBuffer destBuffer,
int logVersion,
boolean forReplication)
Serializes this object into the specified buffer in the format for the
the specified log version.
|
create, create, dumpEntry, dumpRep, getDbId, getMainItem, getSize, getTransactionId, logicalEquals, readEntry, writeEntryequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclone, dumpEntry, dumpRep, getDbId, getLogType, getMainItem, getResolvedItem, getSize, getTransactionId, isDeleted, isImmediatelyObsolete, logicalEquals, postLogWork, readEntry, setLogType, writeEntrypublic TraceLogEntry()
Trace object.public static void setTestPriorItem(Loggable priorItem)
public int getLastFormatChange()
ReplicableLogEntrypublic int getSize(int logVersion,
boolean forReplication)
LogEntryType.LOG_VERSION_REPLICATE_OLDER or greater.
This implementation provides additional behavior for testing.
getSize in interface ReplicableLogEntrylogVersion - 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)
LogEntryType.LOG_VERSION_REPLICATE_OLDER or greater.
This implementation provides additional behavior for testing.
writeEntry in interface ReplicableLogEntrydestBuffer - the destination bufferlogVersion - the log versionforReplication - whether the entry will be sent over the wire,
and not written to the log.public 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.
getEmbeddedLoggables in interface ReplicableLogEntrypublic 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 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 boolean isImmediatelyObsolete(DatabaseImpl dbImpl)
LogEntryisImmediatelyObsolete in interface LogEntrypublic boolean isDeleted()
LogEntrypublic void postLogWork(LogEntryHeader header, long justLoggedLsn, VLSN vlsn)
postLogWork in interface LogEntryDatabaseException - from subclasses.public void postFetchInit(DatabaseImpl dbImpl)
public LogEntry clone()
Copyright © 2024. All rights reserved.