diff --git a/clients/src/main/java/org/apache/kafka/server/log/remote/storage/LogSegmentData.java b/clients/src/main/java/org/apache/kafka/server/log/remote/storage/LogSegmentData.java index 662e396352142..b1a4d89b65934 100644 --- a/clients/src/main/java/org/apache/kafka/server/log/remote/storage/LogSegmentData.java +++ b/clients/src/main/java/org/apache/kafka/server/log/remote/storage/LogSegmentData.java @@ -18,8 +18,8 @@ import org.apache.kafka.common.annotation.InterfaceStability; -import java.io.File; import java.nio.ByteBuffer; +import java.nio.file.Path; import java.util.Objects; /** @@ -30,28 +30,27 @@ @InterfaceStability.Evolving public class LogSegmentData { - private final File logSegment; - private final File offsetIndex; - private final File timeIndex; - private final File txnIndex; - private final File producerSnapshotIndex; + private final Path logSegment; + private final Path offsetIndex; + private final Path timeIndex; + private final Path txnIndex; + private final Path producerSnapshotIndex; private final ByteBuffer leaderEpochIndex; /** * Creates a LogSegmentData instance with data and indexes. - * - * @param logSegment actual log segment file + * @param logSegment actual log segment file * @param offsetIndex offset index file * @param timeIndex time index file * @param txnIndex transaction index file * @param producerSnapshotIndex producer snapshot until this segment * @param leaderEpochIndex leader-epoch-index until this segment */ - public LogSegmentData(File logSegment, - File offsetIndex, - File timeIndex, - File txnIndex, - File producerSnapshotIndex, + public LogSegmentData(Path logSegment, + Path offsetIndex, + Path timeIndex, + Path txnIndex, + Path producerSnapshotIndex, ByteBuffer leaderEpochIndex) { this.logSegment = Objects.requireNonNull(logSegment, "logSegment can not be null"); this.offsetIndex = Objects.requireNonNull(offsetIndex, "offsetIndex can not be null"); @@ -64,35 +63,35 @@ public LogSegmentData(File logSegment, /** * @return Log segment file of this segment. */ - public File logSegment() { + public Path logSegment() { return logSegment; } /** * @return Offset index file. */ - public File offsetIndex() { + public Path offsetIndex() { return offsetIndex; } /** * @return Time index file of this segment. */ - public File timeIndex() { + public Path timeIndex() { return timeIndex; } /** * @return Transaction index file of this segment. */ - public File txnIndex() { + public Path txnIndex() { return txnIndex; } /** * @return Producer snapshot file until this segment. */ - public File producerSnapshotIndex() { + public Path producerSnapshotIndex() { return producerSnapshotIndex; } @@ -112,12 +111,12 @@ public boolean equals(Object o) { return false; } LogSegmentData that = (LogSegmentData) o; - return Objects.equals(logSegment, that.logSegment) && Objects - .equals(offsetIndex, that.offsetIndex) && Objects - .equals(timeIndex, that.timeIndex) && Objects - .equals(txnIndex, that.txnIndex) && Objects - .equals(producerSnapshotIndex, that.producerSnapshotIndex) && Objects - .equals(leaderEpochIndex, that.leaderEpochIndex); + return Objects.equals(logSegment, that.logSegment) && + Objects.equals(offsetIndex, that.offsetIndex) && + Objects.equals(timeIndex, that.timeIndex) && + Objects.equals(txnIndex, that.txnIndex) && + Objects.equals(producerSnapshotIndex, that.producerSnapshotIndex) && + Objects.equals(leaderEpochIndex, that.leaderEpochIndex); } @Override diff --git a/clients/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentMetadata.java b/clients/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentMetadata.java index 9f0dd817be849..4a59e3093ca6b 100644 --- a/clients/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentMetadata.java +++ b/clients/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentMetadata.java @@ -56,14 +56,14 @@ public class RemoteLogSegmentMetadata { private final int brokerId; /** - * Maximum timestamp in the segment + * Maximum timestamp in milli seconds in the segment */ - private final long maxTimestamp; + private final long maxTimestampMs; /** - * Epoch time at which the respective {@link #state} is set. + * Epoch time in milli seconds at which the respective {@link #state} is set. */ - private final long eventTimestamp; + private final long eventTimestampMs; /** * LeaderEpoch vs offset for messages within this segment. @@ -82,16 +82,16 @@ public class RemoteLogSegmentMetadata { /** * Creates an instance with the given metadata of remote log segment. - * + *
* {@code 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.
*
* @param remoteLogSegmentId Universally unique remote log segment id.
* @param startOffset Start offset of this segment (inclusive).
* @param endOffset End offset of this segment (inclusive).
- * @param maxTimestamp Maximum timestamp in this segment.
+ * @param maxTimestampMs Maximum timestamp in milli seconds in this segment.
* @param brokerId Broker id from which this event is generated.
- * @param eventTimestamp Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.
+ * @param eventTimestampMs Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.
* @param segmentSizeInBytes Size of this segment in bytes.
* @param state State of the respective segment of remoteLogSegmentId.
* @param segmentLeaderEpochs leader epochs occurred within this segment.
@@ -99,9 +99,9 @@ public class RemoteLogSegmentMetadata {
private RemoteLogSegmentMetadata(RemoteLogSegmentId remoteLogSegmentId,
long startOffset,
long endOffset,
- long maxTimestamp,
+ long maxTimestampMs,
int brokerId,
- long eventTimestamp,
+ long eventTimestampMs,
int segmentSizeInBytes,
RemoteLogSegmentState state,
Map
* {@code 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.
*
* @param remoteLogSegmentId Universally unique remote log segment id.
* @param startOffset Start offset of this segment (inclusive).
* @param endOffset End offset of this segment (inclusive).
- * @param maxTimestamp Maximum timestamp in this segment
+ * @param maxTimestampMs Maximum timestamp in this segment
* @param brokerId Broker id from which this event is generated.
- * @param eventTimestamp Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.
+ * @param eventTimestampMs Epoch time in milli seconds at which the remote log segment is copied to the remote tier storage.
* @param segmentSizeInBytes Size of this segment in bytes.
* @param segmentLeaderEpochs leader epochs occurred within this segment
*/
public RemoteLogSegmentMetadata(RemoteLogSegmentId remoteLogSegmentId,
long startOffset,
long endOffset,
- long maxTimestamp,
+ long maxTimestampMs,
int brokerId,
- long eventTimestamp,
+ long eventTimestampMs,
int segmentSizeInBytes,
Map