Class RemoteLogSegmentMetadata
java.lang.Object
org.apache.kafka.server.log.remote.storage.RemoteLogMetadata
org.apache.kafka.server.log.remote.storage.RemoteLogSegmentMetadata
It describes the metadata about a topic partition's remote log segment in the remote storage. This is uniquely
represented with
RemoteLogSegmentId
.
New instance is always created with the state as RemoteLogSegmentState.COPY_SEGMENT_STARTED
. This can be
updated by applying RemoteLogSegmentMetadataUpdate
for the respective RemoteLogSegmentId
of the
RemoteLogSegmentMetadata
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Custom metadata from aRemoteStorageManager
plugin. -
Constructor Summary
ConstructorDescriptionRemoteLogSegmentMetadata
(RemoteLogSegmentId remoteLogSegmentId, long startOffset, long endOffset, long maxTimestampMs, int brokerId, long eventTimestampMs, int segmentSizeInBytes, Map<Integer, Long> segmentLeaderEpochs) Creates an instance with the given metadata of remote log segment and its state asRemoteLogSegmentState.COPY_SEGMENT_STARTED
.RemoteLogSegmentMetadata
(RemoteLogSegmentId remoteLogSegmentId, long startOffset, long endOffset, long maxTimestampMs, int brokerId, long eventTimestampMs, int segmentSizeInBytes, Optional<RemoteLogSegmentMetadata.CustomMetadata> customMetadata, RemoteLogSegmentState state, Map<Integer, Long> segmentLeaderEpochs) Creates an instance with the given metadata of remote log segment. -
Method Summary
Modifier and TypeMethodDescriptioncreateWithUpdates
(RemoteLogSegmentMetadataUpdate rlsmUpdate) Creates a new RemoteLogSegmentMetadata applying the givenrlsmUpdate
on this instance.long
boolean
int
hashCode()
long
int
long
state()
Returns the current state of this remote log segment.toString()
Methods inherited from class org.apache.kafka.server.log.remote.storage.RemoteLogMetadata
brokerId, eventTimestampMs
-
Constructor Details
-
RemoteLogSegmentMetadata
public RemoteLogSegmentMetadata(RemoteLogSegmentId remoteLogSegmentId, long startOffset, long endOffset, long maxTimestampMs, int brokerId, long eventTimestampMs, int segmentSizeInBytes, Optional<RemoteLogSegmentMetadata.CustomMetadata> customMetadata, RemoteLogSegmentState state, Map<Integer, Long> segmentLeaderEpochs) Creates an instance with the given metadata of remote log segment.segmentLeaderEpochs
can not be empty. If all the records in this segment belong to the same leader epoch then it should have an entry with epoch mapping to start-offset of this segment.- Parameters:
remoteLogSegmentId
- Universally unique remote log segment id.startOffset
- Start offset of this segment (inclusive).endOffset
- End offset of this segment (inclusive).maxTimestampMs
- Maximum timestamp in milli seconds in this segment.brokerId
- Broker id from which this event is generated.eventTimestampMs
- Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.segmentSizeInBytes
- Size of this segment in bytes.customMetadata
- Custom metadata.state
- State of the respective segment of remoteLogSegmentId.segmentLeaderEpochs
- leader epochs occurred within this segment.
-
RemoteLogSegmentMetadata
public RemoteLogSegmentMetadata(RemoteLogSegmentId remoteLogSegmentId, long startOffset, long endOffset, long maxTimestampMs, int brokerId, long eventTimestampMs, int segmentSizeInBytes, Map<Integer, Long> segmentLeaderEpochs) Creates an instance with the given metadata of remote log segment and its state asRemoteLogSegmentState.COPY_SEGMENT_STARTED
.segmentLeaderEpochs
can not be empty. If all the records in this segment belong to the same leader epoch then it should have an entry with epoch mapping to start-offset of this segment.- Parameters:
remoteLogSegmentId
- Universally unique remote log segment id.startOffset
- Start offset of this segment (inclusive).endOffset
- End offset of this segment (inclusive).maxTimestampMs
- Maximum timestamp in this segmentbrokerId
- Broker id from which this event is generated.eventTimestampMs
- Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.segmentSizeInBytes
- Size of this segment in bytes.segmentLeaderEpochs
- leader epochs occurred within this segment
-
-
Method Details
-
remoteLogSegmentId
- Returns:
- unique id of this segment.
-
startOffset
public long startOffset()- Returns:
- Start offset of this segment (inclusive).
-
endOffset
public long endOffset()- Returns:
- End offset of this segment (inclusive).
-
segmentSizeInBytes
public int segmentSizeInBytes()- Returns:
- Total size of this segment in bytes.
-
maxTimestampMs
public long maxTimestampMs()- Returns:
- Maximum timestamp in milli seconds of a record within this segment.
-
segmentLeaderEpochs
- Returns:
- Map of leader epoch vs offset for the records available in this segment.
-
customMetadata
- Returns:
- Custom metadata.
-
state
Returns the current state of this remote log segment. It can be any of the below -
createWithUpdates
Creates a new RemoteLogSegmentMetadata applying the givenrlsmUpdate
on this instance. This method will not update this instance.- Parameters:
rlsmUpdate
- update to be applied.- Returns:
- a new instance created by applying the given update on this instance.
-
topicIdPartition
- Specified by:
topicIdPartition
in classRemoteLogMetadata
- Returns:
- TopicIdPartition for which this event is generated.
-
equals
-
hashCode
public int hashCode() -
toString
-