This is an automated email from the ASF dual-hosted git repository.

schofielaj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 98c0f3024d3 MINOR: Added trace logs to help debug SharePartition 
(#19358)
98c0f3024d3 is described below

commit 98c0f3024d3e86397b06fb67c1f9d5c2febbc077
Author: Abhinav Dixit <[email protected]>
AuthorDate: Fri Apr 4 14:22:17 2025 +0530

    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]>
---
 core/src/main/java/kafka/server/share/SharePartition.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/src/main/java/kafka/server/share/SharePartition.java 
b/core/src/main/java/kafka/server/share/SharePartition.java
index 34966022d32..012a0c65043 100644
--- a/core/src/main/java/kafka/server/share/SharePartition.java
+++ b/core/src/main/java/kafka/server/share/SharePartition.java
@@ -581,8 +581,10 @@ public class SharePartition {
                     // offset removed from batch, which is the next offset to 
be fetched.
                     // 2. When startOffset has moved beyond the in-flight 
records, startOffset and
                     // endOffset point to the LSO, which is the next offset to 
be fetched.
+                    log.trace("The next fetch offset for the share partition 
{}-{} is {}", groupId, topicIdPartition, endOffset);
                     return endOffset;
                 } else {
+                    log.trace("The next fetch offset for the share partition 
{}-{} is {}", groupId, topicIdPartition, endOffset + 1);
                     return endOffset + 1;
                 }
             }
@@ -593,6 +595,7 @@ public class SharePartition {
                 // Same case when startOffset has moved beyond the in-flight 
records, startOffset and endOffset point to the LSO
                 // and the cached state is fresh.
                 findNextFetchOffset.set(false);
+                log.trace("The next fetch offset for the share partition {}-{} 
is {}", groupId, topicIdPartition, endOffset);
                 return endOffset;
             }
 
@@ -639,6 +642,7 @@ public class SharePartition {
                 findNextFetchOffset.set(false);
                 nextFetchOffset = endOffset + 1;
             }
+            log.trace("The next fetch offset for the share partition {}-{} is 
{}", groupId, topicIdPartition, nextFetchOffset);
             return nextFetchOffset;
         } finally {
             lock.writeLock().unlock();

Reply via email to