Skip to content

Commit 98c0f30

Browse files
MINOR: Added trace logs to help debug SharePartition (#19358)
Added `trace` logs to help debug `nextFetchOffset` functionality within SharePartition. We did not have a way to figure out the fetch offsets of a share partition through logs. Forward moving `fetchOffset` confirms that the consumption from a given share partition is happening correctly on the broker. Reviewers: Andrew Schofield <[email protected]>
1 parent d35ab4d commit 98c0f30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/java/kafka/server/share/SharePartition.java

+4
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,10 @@ public long nextFetchOffset() {
581581
// offset removed from batch, which is the next offset to be fetched.
582582
// 2. When startOffset has moved beyond the in-flight records, startOffset and
583583
// endOffset point to the LSO, which is the next offset to be fetched.
584+
log.trace("The next fetch offset for the share partition {}-{} is {}", groupId, topicIdPartition, endOffset);
584585
return endOffset;
585586
} else {
587+
log.trace("The next fetch offset for the share partition {}-{} is {}", groupId, topicIdPartition, endOffset + 1);
586588
return endOffset + 1;
587589
}
588590
}
@@ -593,6 +595,7 @@ public long nextFetchOffset() {
593595
// Same case when startOffset has moved beyond the in-flight records, startOffset and endOffset point to the LSO
594596
// and the cached state is fresh.
595597
findNextFetchOffset.set(false);
598+
log.trace("The next fetch offset for the share partition {}-{} is {}", groupId, topicIdPartition, endOffset);
596599
return endOffset;
597600
}
598601

@@ -639,6 +642,7 @@ public long nextFetchOffset() {
639642
findNextFetchOffset.set(false);
640643
nextFetchOffset = endOffset + 1;
641644
}
645+
log.trace("The next fetch offset for the share partition {}-{} is {}", groupId, topicIdPartition, nextFetchOffset);
642646
return nextFetchOffset;
643647
} finally {
644648
lock.writeLock().unlock();

0 commit comments

Comments
 (0)