singhvishalkr opened a new pull request, #1126:
URL: https://github.com/apache/pulsar-site/pull/1126

   ### Summary
   
   `messagesConsumedCounter` in the topic internal stats is documented as "the 
number of **messages** this cursor has acknowledged since this broker loads 
this topic", but that's not what the counter tracks.
   
   Looking at the source, the counter is driven by `getNumberOfEntries(...)`:
   
   - 
`managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java`
 -- `messagesConsumedCounter = -getNumberOfEntries(Range.openClosed(position, 
ledger.getLastPosition()));`
   - 
`managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/NonDurableCursorImpl.java`
 -- `messagesConsumedCounter = lastEntryAndCounter.getRight() - initialBacklog;`
   - 
`managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ReadOnlyCursorImpl.java`
 -- `messagesConsumedCounter = -getNumberOfEntries(Range.closed(readPosition, 
ledger.getLastPosition()));`
   
   So it counts **managed-ledger entries**. Because an entry can carry a batch 
of user-visible messages, the counter differs from message count by whatever 
batching factor the producer used. This matches the inline comment in 
`NonDurableSubscriptionTest`:
   > Note: "topic_internal_stat.cursor.messagesConsumedCounter" means how many 
messages were acked on this...
   
   (the test file is a bit loose with the wording too, but the assertions all 
compare against entry counts).
   
   ### Change
   
   Rewords the one row in `administration-stats.md` and its three versioned 
copies:
   
   Before:
   > The number of messages this cursor has acknowledged since this broker 
loads this topic.
   
   After:
   > The number of entries (not messages -- an entry can contain a batch of 
messages) this cursor has acknowledged since this broker loaded this topic.
   
   Closes apache/pulsar#23702.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to