Skip to content

Commit e21c46a

Browse files
authored
MINOR: Move FileRecord JavaDoc to comment (apache#19257)
See: apache#19214 (comment) Move explaination from Javadoc to comment. Reviewers: Chia-Ping Tsai <[email protected]>
1 parent 0548f1b commit e21c46a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

clients/src/main/java/org/apache/kafka/common/record/FileRecords.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,16 @@ public int writeTo(TransferableChannel destChannel, int offset, int length) thro
292292
/**
293293
* Search forward for the file position of the message batch whose last offset that is greater
294294
* than or equal to the target offset. If no such batch is found, return null.
295-
* <p>
296-
* The following logic is intentionally designed to minimize memory usage
297-
* by avoiding unnecessary calls to {@link FileChannelRecordBatch#lastOffset()} for every batch.
298-
* Instead, we use {@link FileChannelRecordBatch#baseOffset()} comparisons when possible, and only
299-
* check {@link FileChannelRecordBatch#lastOffset()} when absolutely necessary.
300295
*
301296
* @param targetOffset The offset to search for.
302297
* @param startingPosition The starting position in the file to begin searching from.
303298
* @return the batch's base offset, its physical position, and its size (including log overhead)
304299
*/
305300
public LogOffsetPosition searchForOffsetFromPosition(long targetOffset, int startingPosition) {
306301
FileChannelRecordBatch prevBatch = null;
307-
302+
// The following logic is intentionally designed to minimize memory usage by avoiding
303+
// unnecessary calls to lastOffset() for every batch.
304+
// Instead, we use baseOffset() comparisons when possible, and only check lastOffset() when absolutely necessary.
308305
for (FileChannelRecordBatch batch : batchesFrom(startingPosition)) {
309306
// If baseOffset exactly equals targetOffset, return immediately
310307
if (batch.baseOffset() == targetOffset) {

0 commit comments

Comments
 (0)