Conversation
|
Bug fix discovered by ZK removal (test was not correctly added in KAFKA-4476). Some additional minor cleanup. |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
| metadataWithInternalTopics = metadata; | ||
| if (internalTopicManager != null) | ||
| metadataWithInternalTopics = metadata.withPartitions(allRepartitionTopicPartitions); | ||
| metadataWithInternalTopics = metadata.withPartitions(allRepartitionTopicPartitions); |
There was a problem hiding this comment.
Is line 372 still needed?
There was a problem hiding this comment.
Good point. Will remove it.
| throw new TopologyBuilderException(String.format("stream-thread [%s] Topics not co-partitioned: [%s]", streamThread.getName(), Utils.mkString(Arrays.asList(topics), ","))); | ||
| } | ||
| } else { | ||
| if (allRepartitionTopicsNumPartitions.get(topic).numPartitions == NOT_AVAILABLE) { |
There was a problem hiding this comment.
It this possible to happen? Could you elaborate this a bit?
There was a problem hiding this comment.
Yes. If we have an unknown topic (c.f. the test "unknownTopic") that needs repartitioning, we don't know the number of partitions for the (to be created) internal repartitioning topic. And than this case hits.
There was a problem hiding this comment.
Do we then just ignore it if it is NOT_AVAILABLE?
There was a problem hiding this comment.
Yes. If metadata is missing, we skip over this and hope to get the metadata on the next refresh. But this strategy is not working properly yet. See #2404 (comment)
We might want to add a check for user-topics if they exist though -- currently, the app would just idle if a user topic does not exits.
| final Map<String, PartitionAssignor.Assignment> assignment = partitionAssignor.assign(metadata, subscriptions); | ||
|
|
||
| final Map<String, Integer> expectedCreatedInternalTopics = new HashMap<>(); | ||
| expectedCreatedInternalTopics.put(applicationId + "-KSTREAM-JOINOTHER-0000000012-store-changelog", 3); |
There was a problem hiding this comment.
Thinking about this once more, I think, there is still an issue. As we do not know the number the input topic partitions for one join input, we cannot know the number of task for the join, and thus, can actually not create this two changelog topics either.
\cc @guozhangwang WDYT?
There was a problem hiding this comment.
If that was the case wouldn't we get an exception due to the topics not being co-partitioned? We should have a test for this case.
There was a problem hiding this comment.
When some expected external topics do not exist or do not have metadata updatable, current strategy is that Streams will not create any tasks of its "affected" sub-topologies, including the changelog topic and repartition topic as well, and will expect another rebalance to trigger once these topics shows up. If the source topics are input ones for the "head sub-topologies" then no tasks will be created and no internal topics will be created.
There was a problem hiding this comment.
As I expected. But this strategy does not work correctly...The tasks for join-subtopology should not get created (an neither this two changelog topics). Will investigate an update this PR.
There was a problem hiding this comment.
@dguy After metadata refresh, we might end up with a problem. With the latest changes, we should throw an exception as number of partitions would not match the expected number. I am not sure if we can have an extra test for this -- from my understanding, this test should cover the case (and maybe other). I am not sure, if we cover all cases...
| public final static int UNKNOWN = -1; | ||
| public final static int NOT_AVAILABLE = -2; | ||
| final static int UNKNOWN = -1; | ||
| final static int NOT_AVAILABLE = -2; |
There was a problem hiding this comment.
seeing as you are restricting visibility (thanks!) this one could be private
|
|
||
| internalTopicManager.makeReady(topic, numPartitions); | ||
| for (Map.Entry<String, InternalTopicMetadata> entry : topicPartitions.entrySet()) { | ||
| InternalTopicConfig topic = entry.getValue().config; |
There was a problem hiding this comment.
maybe you could make these locals final while you are at it?
| throw new TopologyBuilderException(String.format("stream-thread [%s] Topics not co-partitioned: [%s]", streamThread.getName(), Utils.mkString(Arrays.asList(topics), ","))); | ||
| } | ||
| } else { | ||
| if (allRepartitionTopicsNumPartitions.get(topic).numPartitions == NOT_AVAILABLE) { |
There was a problem hiding this comment.
Do we then just ignore it if it is NOT_AVAILABLE?
| final Map<String, PartitionAssignor.Assignment> assignment = partitionAssignor.assign(metadata, subscriptions); | ||
|
|
||
| final Map<String, Integer> expectedCreatedInternalTopics = new HashMap<>(); | ||
| expectedCreatedInternalTopics.put(applicationId + "-KSTREAM-JOINOTHER-0000000012-store-changelog", 3); |
There was a problem hiding this comment.
If that was the case wouldn't we get an exception due to the topics not being co-partitioned? We should have a test for this case.
|
@guozhangwang @dguy @enothereska Updated this. |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
do not create tasks with unkonw input partitions
a6b6194 to
2b489a5
Compare
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
…Manager branch and fixed one copartitioning bug ZK removed reveal a bug in `StreamPartitionAssigner` but did not fix it properly. This is a follow up bug fix. Issue: - If topic metadata is missing, `StreamPartitionAssigner` should not create any affected tasks that consume topics with missing metadata. - Depending downstream tasks should not be create either. - For tasks that are not created, no store changelog topics (if any) should get created - For tasks that write output to not-yet existing internal repartitioning topics, those repartitioning topics should not get created Author: Matthias J. Sax <matthias@confluent.io> Reviewers: Damian Guy, Guozhang Wang Closes #2404 from mjsax/kafka-4060-zk-test-follow-up (cherry picked from commit 0b99bea) Signed-off-by: Guozhang Wang <wangguoz@gmail.com>
|
LGTM and merged to trunk, 0.10.2 |
|
|
||
| if (partitions == null) { | ||
| log.info("Skipping assigning topic {} to tasks since its metadata is not available yet", topic); | ||
| maxNumPartitions = StreamPartitionAssignor.NOT_AVAILABLE; |
There was a problem hiding this comment.
@guozhangwang I think, I missed to insert an break; here. Otherwise this only works if the "last" topic is not known. Or actually, we can replace this statement with return StreamPartitionAssignor.NOT_AVAILABLE;
…Manager branch and fixed one copartitioning bug ZK removed reveal a bug in `StreamPartitionAssigner` but did not fix it properly. This is a follow up bug fix. Issue: - If topic metadata is missing, `StreamPartitionAssigner` should not create any affected tasks that consume topics with missing metadata. - Depending downstream tasks should not be create either. - For tasks that are not created, no store changelog topics (if any) should get created - For tasks that write output to not-yet existing internal repartitioning topics, those repartitioning topics should not get created Author: Matthias J. Sax <matthias@confluent.io> Reviewers: Damian Guy, Guozhang Wang Closes apache#2404 from mjsax/kafka-4060-zk-test-follow-up
ZK removed reveal a bug in
StreamPartitionAssignerbut did not fix it properly. This is a follow up bug fix.Issue:
StreamPartitionAssignershould not create any affected tasks that consume topics with missing metadata.