Github user hmcl commented on a diff in the pull request:
https://github.com/apache/storm/pull/1832#discussion_r99934350
--- 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 --
Perhaps we can split this into two log messages.
The first one `LOG.debug("Committed offsets [{}-{} = {}] for
topic-partition [{}]` goes into `OffsetManager`
The second `LOG.debug("[{}] uncommitted offsets across all topic
partitions` stays here.
---
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.
---