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

    https://github.com/apache/storm/pull/1832#discussion_r99652257
  
    --- 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 --
    
    I agree. I only moved it here because the log makes use of the 
numUncommittedOffsets spout field, which we can't pass into 
offsetManager.commit because it changes based on the return value of commit. I 
can split the log message into a part that logs how much was committed for 
which topic partition (inside OffsetManager), and then another log message that 
logs numUncommittedOffsets (inside KafkaSpout). What do you think?


---
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