public class LogRecordWithDLSN extends LogRecord
A log record will be assigned with an unique system generated sequence number
DLSN when it is
written to a log. At the mean time, a 64-bits long number is assigned to the record indicates its position
within a log, which is called
application can assign its own sequence number (called
TransactionID) to the log record while
Transaction ID is a positive 64-bits long number that is assigned by the application. It is a very helpful
field when application wants to organize the records and position the readers using their own sequencing method.
A typical use case of
TransactionID is DistributedLog Write Proxy. It assigns the non-decreasing
timestamps to log records, which the timestamps could be used as `physical time` to implement `TTL` in a strong
consistent database to achieve consistent `TTL` over replicas.
DistributedLog Sequence Number (DLSN) is the sequence number generated during written time.
It is comparable and could be used to figure out the order between records. The DLSN is comprised with 3 components.
They are Log Segment Sequence Number, Entry Id and Slot Id. (See
DLSN for more details).
The DLSN is usually used for comparison, positioning and truncation.
Sequence ID is introduced to address the drawback of
DLSN, in favor of answering questions like
`how many records written between two DLSNs`. It is a 64-bits monotonic increasing number (starting from zero).
Sequence ids are only accessible by readers. That means writers don't know the sequence ids of records after they
|Constructor and Description|
|Modifier and Type||Method and Description|
Get the DLSN of the record in the log.
Get the sequence id of the record in the log.
getMetadata, getPayload, getPayloadBuf, getPayLoadInputStream, getPositionWithinLogSegment, getTransactionId, isControl, isControl, isRecordSet, isRecordSet, readPayload, setControl, setMetadata, setRecordSet, setTransactionId
public LogRecordWithDLSN(DLSN dlsn, long txid, byte data, long startSequenceIdOfCurrentSegment)
public LogRecordWithDLSN(DLSN dlsn, long txid, io.netty.buffer.ByteBuf buffer, long startSequenceIdOfCurrentSegment)
public long getSequenceId()
public DLSN getDlsn()
Copyright © 2016-2018 The Apache Software Foundation. All Rights Reserved.