[GitHub] [kafka] mjsax commented on a change in pull request #10000: KAFKA-9274: handle TimeoutException on task reset
mjsax commented on a change in pull request #1: URL: https://github.com/apache/kafka/pull/1#discussion_r570691793 ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { Review comment: Good point! ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { +final Map committed = mainConsumer.committed(resetOffsetsForPartitions); +for (final Map.Entry committedEntry : committed.entrySet()) { +final OffsetAndMetadata offsetAndMetadata = committedEntry.getValue(); +if (offsetAndMetadata != null) { +mainConsumer.seek(committedEntry.getKey(), offsetAndMetadata); +resetOffsetsForPartitions.remove(committedEntry.getKey()); +} +} + +if (!resetOffsetsForPartitions.isEmpty()) { Review comment: Fair enough. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] mjsax commented on a change in pull request #10000: KAFKA-9274: handle TimeoutException on task reset
mjsax commented on a change in pull request #1: URL: https://github.com/apache/kafka/pull/1#discussion_r570695899 ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { +final Map committed = mainConsumer.committed(resetOffsetsForPartitions); +for (final Map.Entry committedEntry : committed.entrySet()) { +final OffsetAndMetadata offsetAndMetadata = committedEntry.getValue(); +if (offsetAndMetadata != null) { +mainConsumer.seek(committedEntry.getKey(), offsetAndMetadata); +resetOffsetsForPartitions.remove(committedEntry.getKey()); +} +} + +if (!resetOffsetsForPartitions.isEmpty()) { Review comment: Fair enough. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] mjsax commented on a change in pull request #10000: KAFKA-9274: handle TimeoutException on task reset
mjsax commented on a change in pull request #1: URL: https://github.com/apache/kafka/pull/1#discussion_r570691793 ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { Review comment: Good point! 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] mjsax commented on a change in pull request #10000: KAFKA-9274: handle TimeoutException on task reset
mjsax commented on a change in pull request #1: URL: https://github.com/apache/kafka/pull/1#discussion_r566621619 ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { +final Map committed = mainConsumer.committed(resetOffsetsForPartitions); +for (final Map.Entry committedEntry : committed.entrySet()) { +final OffsetAndMetadata offsetAndMetadata = committedEntry.getValue(); +if (offsetAndMetadata != null) { +mainConsumer.seek(committedEntry.getKey(), offsetAndMetadata); +resetOffsetsForPartitions.remove(committedEntry.getKey()); +} +} + +if (!resetOffsetsForPartitions.isEmpty()) { Review comment: this `if` is not strictly required, however, it allows us to just pass `null` as `offsetResetter` in tests, so might be worth it. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] mjsax commented on a change in pull request #10000: KAFKA-9274: handle TimeoutException on task reset
mjsax commented on a change in pull request #1: URL: https://github.com/apache/kafka/pull/1#discussion_r566621365 ## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java ## @@ -227,6 +230,27 @@ public void initializeIfNeeded() { } } +private void initOffsetsIfNeeded(final java.util.function.Consumer> offsetResetter) { Review comment: I was considering to maybe merge this method into `initMetadata()` but it might convolute different code path, and we should execute this method rarely anyway so I don't think we should have concerns about calling `mainConsumer.committed` twice for rare cases. Let me know what you think. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org