ableegoldman commented on a change in pull request #11847:
URL: https://github.com/apache/kafka/pull/11847#discussion_r820431478
##########
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
+ if (offsetResetStrategy != null) {
Review comment:
Well we no longer return null within an individual topology's
InternalTopologyBuilder, however the `topologyMetadata.offsetResetStrategy` may
still return null due to the race condition (see comment above TODO) -- this is
unavoidable until we can address the tech debt mentioned in the TODO (however
we end up doing that)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]