Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2380#discussion_r146328865 --- Diff: external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpout.java --- @@ -438,55 +440,53 @@ private void commitOffsetsForAckedTuples() { // ======== Ack ======= @Override public void ack(Object messageId) { - if (!isAtLeastOnce()) { - // Only need to keep track of acked tuples if commits are done based on acks - return; - } - + // Only need to keep track of acked tuples if commits to Kafka are done after a tuple ack is received final KafkaSpoutMessageId msgId = (KafkaSpoutMessageId) messageId; - if (!emitted.contains(msgId)) { - if (msgId.isEmitted()) { - LOG.debug("Received ack for message [{}], associated with tuple emitted for a ConsumerRecord that " - + "came from a topic-partition that this consumer group instance is no longer tracking " - + "due to rebalance/partition reassignment. No action taken.", msgId); + if (isAtLeastOnceProcessing()) { --- End diff -- I think this is worse. Putting a guard clause at the top decreases indentation for the whole function and is more readable IMO.
---