Class RemoteLogSegmentMetadata
java.lang.Object
org.apache.kafka.server.log.remote.storage.RemoteLogMetadata
org.apache.kafka.server.log.remote.storage.RemoteLogSegmentMetadata
@Evolving public class RemoteLogSegmentMetadata extends RemoteLogMetadata
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.
-
Constructor Summary
Constructors Constructor Description 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. -
Method Summary
Modifier and Type Method Description RemoteLogSegmentMetadatacreateWithUpdates(RemoteLogSegmentMetadataUpdate rlsmUpdate)Creates a new RemoteLogSegmentMetadata applying the givenrlsmUpdateon this instance.longendOffset()booleanequals(Object o)inthashCode()longmaxTimestampMs()RemoteLogSegmentIdremoteLogSegmentId()NavigableMap<Integer,Long>segmentLeaderEpochs()intsegmentSizeInBytes()longstartOffset()RemoteLogSegmentStatestate()Returns the current state of this remote log segment.StringtoString()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, Map<Integer,Long> segmentLeaderEpochs)Creates an instance with the given metadata of remote log segment and its state asRemoteLogSegmentState.COPY_SEGMENT_STARTED.segmentLeaderEpochscan 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.
-
state
Returns the current state of this remote log segment. It can be any of the below -
createWithUpdates
Creates a new RemoteLogSegmentMetadata applying the givenrlsmUpdateon 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.
-
equals
-
hashCode
public int hashCode() -
toString
-