You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/03/04 18:58:31 UTC
[GitHub] [kafka] guozhangwang commented on a change in pull request #11847: KAFKA-12648: fix NPE due to race condtion between resetting offsets and removing a topology
guozhangwang commented on a change in pull request #11847:
URL: https://github.com/apache/kafka/pull/11847#discussion_r819825757
##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
##########
@@ -978,24 +979,30 @@ private void resetOffsets(final Set<TopicPartition> partitions, final Exception
final Set<TopicPartition> notReset = new HashSet<>();
for (final TopicPartition partition : partitions) {
- switch (topologyMetadata.offsetResetStrategy(partition.topic())) {
- case EARLIEST:
- addToResetList(partition, seekToBeginning, "Setting topic '{}' to consume from {} offset", "earliest", loggedTopics);
- break;
- case LATEST:
- addToResetList(partition, seekToEnd, "Setting topic '{}' to consume from {} offset", "latest", loggedTopics);
- break;
- case NONE:
- if ("earliest".equals(originalReset)) {
- addToResetList(partition, seekToBeginning, "No custom setting defined for topic '{}' using original config '{}' for offset reset", "earliest", loggedTopics);
- } else if ("latest".equals(originalReset)) {
- addToResetList(partition, seekToEnd, "No custom setting defined for topic '{}' using original config '{}' for offset reset", "latest", loggedTopics);
- } else {
- notReset.add(partition);
- }
- break;
- default:
- throw new IllegalStateException("Unable to locate topic " + partition.topic() + " in the topology");
+ final OffsetResetStrategy offsetResetStrategy = topologyMetadata.offsetResetStrategy(partition.topic());
+
+ // This may be null if the task we are currently processing was apart of a named topology that was just emoved.
+ // TODO: keep the StreamThreads and TopologyMetadtaa view of named topologies in sync until final thread has acked
Review comment:
Could we create a separate JIRA ticket for bookkeeping?
--
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.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org