Skip to content

KAFKA-9739: Fix for 2.5 branch#8492

Merged
bbejeck merged 2 commits intoapache:2.5from
bbejeck:KAFKA_9739_2_5_null_child_fix
Apr 15, 2020
Merged

KAFKA-9739: Fix for 2.5 branch#8492
bbejeck merged 2 commits intoapache:2.5from
bbejeck:KAFKA_9739_2_5_null_child_fix

Conversation

@bbejeck
Copy link
Copy Markdown
Member

@bbejeck bbejeck commented Apr 15, 2020

This is a port of #8400 for the 2.5 branch

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

bbejeck added 2 commits April 15, 2020 10:19
For some context, when building a streams application, the optimizer keeps track of the key-changing operations and any repartition nodes that are descendants of the key-changer. During the optimization phase (if enabled), any repartition nodes are logically collapsed into one. The optimizer updates the graph by inserting the single repartition node between the key-changing node and its first child node. This graph update process is done by searching for a node that has the key-changing node as one of its direct parents, and the search starts from the repartition node, going up in the parent hierarchy.

The one exception to this rule is if there is a merge node that is a descendant of the key-changing node, then during the optimization phase, the map tracking key-changers to repartition nodes is updated to have the merge node as the key. Then the optimization process updates the graph to place the single repartition node between the merge node and its first child node.

The error in KAFKA-9739 occurred because there was an assumption that the repartition nodes are children of the merge node. But in the topology from KAFKA-9739, the repartition node was a parent of the merge node. So when attempting to find the first child of the merge node, nothing was found (obviously) resulting in StreamException(Found a null keyChangingChild node for..)

This PR fixes this bug by first checking that all repartition nodes for optimization are children of the merge node.

This PR includes a test with the topology from KAFKA-9739.

Reviewers: John Roesler <john@confluent.io>
@bbejeck bbejeck requested a review from vvcephei April 15, 2020 14:54
Copy link
Copy Markdown
Contributor

@vvcephei vvcephei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks as always, @bbejeck !

@bbejeck bbejeck merged commit f80912a into apache:2.5 Apr 15, 2020
@bbejeck bbejeck deleted the KAFKA_9739_2_5_null_child_fix branch April 15, 2020 19:41
@bbejeck bbejeck changed the title Kafka 9739: Fix for 2.5 branch KAFKA-9739: Fix for 2.5 branch Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants