Github user hmcl commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1832#discussion_r99643242
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpout.java
 ---
    @@ -347,9 +345,15 @@ private void commitOffsetsForAckedTuples() {
                 LOG.debug("Offsets successfully committed to Kafka [{}]", 
nextCommitOffsets);
                 // Instead of iterating again, it would be possible to commit 
and update the state for each TopicPartition
                 // in the prior loop, but the multiple network calls should be 
more expensive than iterating twice over a small loop
    -            for (Map.Entry<TopicPartition, OffsetEntry> tpOffset : 
acked.entrySet()) {
    -                final OffsetEntry offsetEntry = tpOffset.getValue();
    -                
offsetEntry.commit(nextCommitOffsets.get(tpOffset.getKey()));
    +            for (Map.Entry<TopicPartition, OffsetAndMetadata> tpOffset : 
nextCommitOffsets.entrySet()) {
    +                //Update the OffsetManager for each committed partition, 
and update numUncommittedOffsets
    +                final TopicPartition tp = tpOffset.getKey();
    +                final OffsetManager offsetManager = acked.get(tp);
    +                long oldCommittedOffset = 
offsetManager.getCommittedOffset();
    +                long numCommittedOffsets = 
offsetManager.commit(tpOffset.getValue());
    +                numUncommittedOffsets -= numCommittedOffsets;
    +                LOG.debug("Committed offsets [{}-{} = {}] for 
topic-partition [{}]. [{}] uncommitted offsets across all topic partitions",
    --- End diff --
    
    For cohesiveness, I believe that this log message should be present in the 
`OffsetManager` class. If another (client) class creates an instance of 
`OffsetManager`,  that class will be required to implement this same log 
message. Furthermore, this log message dives deep in the internal details of 
`OffsetManager`, which will make it very hard for client classes to print such 
message without know the internal details.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to