Skip to content

MINOR: Include all hosts in metadata for topology#12594

Merged
ableegoldman merged 5 commits into
apache:trunkfrom
wcarlson5:Fix_hosts_returned
Oct 7, 2022
Merged

MINOR: Include all hosts in metadata for topology#12594
ableegoldman merged 5 commits into
apache:trunkfrom
wcarlson5:Fix_hosts_returned

Conversation

@wcarlson5

@wcarlson5 wcarlson5 commented Sep 6, 2022

Copy link
Copy Markdown
Contributor

When building streams metadata we want to build even if the host is empty as it is a common way to find the other host addresses

update existing tests to find all hosts

Committer Checklist (excluded from commit message)

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

…st is empty as it is a common way to find the other host addresses
@wcarlson5 wcarlson5 marked this pull request as ready for review September 6, 2022 22:13
@vvcephei vvcephei changed the title Minor: When building streams metadata we want to build even if the ho… MINOR: Include all hosts in metadata for topology Sep 7, 2022

@vvcephei vvcephei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, @wcarlson5 !

This fix looks good to me. I'm +1 when the tests pass.

I did have a few suggestions for improving the test coverage.

Comment on lines +929 to +932
// then verify that only this topology's one store appears if the host has partitions assigned
if (!metadata.topicPartitions().isEmpty()) {
assertThat(metadata.stateStoreNames(), equalTo(singleton("store-" + topologyName)));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like this test is generally missing the converse:

In addition to checking if all the assigned topics are in the named topology sources, should we also check that all named topology sources are assigned?

Likewise, in this new block, should we assert that the store is not present if the partition is not assigned?

@wcarlson5 wcarlson5 Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, not all named topology topics are going to be in all the source metadata, we can check the stores are limited to the relevant topics. This might just be useful for is the topic partitions are empty.

Comment on lines +425 to +426
assertThat(streams.allStreamsClientsMetadataForTopology(TOPOLOGY_2).size(), equalTo(2));
assertThat(streams2.allStreamsClientsMetadataForTopology(TOPOLOGY_2).size(), equalTo(2));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we also verify that topology1 metadata includes the full set of hosts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure why not

@vvcephei

Copy link
Copy Markdown
Contributor
[2022-09-07T15:38:17.417Z] [ant:checkstyle] [ERROR] /home/jenkins/jenkins-agent/workspace/Kafka_kafka-pr_PR-12594/streams/src/test/java/org/apache/kafka/streams/integration/NamedTopologyIntegrationTest.java:64:8: Unused import - java.util.Collections. [UnusedImports]

@wcarlson5 wcarlson5 requested a review from vvcephei September 22, 2022 16:45
@wcarlson5

Copy link
Copy Markdown
Contributor Author

@vvcephei Wow every single test passed. Don't see that very often on a pr

@ableegoldman ableegoldman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the fix

standbyStoresOnHost.addAll(getStoresOnHost(storeToSourceTopics, standbyPartitionsOnHost));
}

if (!(activeStoresOnHost.isEmpty() && activePartitionsOnHost.isEmpty() && standbyStoresOnHost.isEmpty() && standbyPartitionsOnHost.isEmpty())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm trying to remember what the original intention behind this check was, I imagine it was to avoid rebuilding the metadata unnecessarily and that we did not have this check before named topologies because this only becomes nontrivial as the metadata rebuild cost scales with the number of topologies...?

That said, wouldn't we still want/need to update the metadata if it's become empty? It seems like we should actually only ever skip it when the delta is zero/empty, not when the current set is empty...but I guess that's the root of this fix to begin with. Anyways we should err on the side of correctness rather than performance issues, especially perf issues we haven't seen/confirmed to exist

@ableegoldman

Copy link
Copy Markdown
Member

Wow every single test passed. Don't see that very often on a pr

Yeah that is legitimately amazing. Love to see it! Maybe things are turning around...heh... 😭

@ableegoldman ableegoldman merged commit cbdcd20 into apache:trunk Oct 7, 2022
guozhangwang pushed a commit to guozhangwang/kafka that referenced this pull request Jan 25, 2023
When building streams metadata we want to build even if the host is empty as it is a common way to find the other host addresses

Reviewers: John Roesler <vvcephei@apache.org>, Anna Sophie Blee-Goldman <ableegoldman@apache.org>
rutvijmehta-harness pushed a commit to rutvijmehta-harness/kafka that referenced this pull request Feb 9, 2024
When building streams metadata we want to build even if the host is empty as it is a common way to find the other host addresses

Reviewers: John Roesler <vvcephei@apache.org>, Anna Sophie Blee-Goldman <ableegoldman@apache.org>
rutvijmehta-harness added a commit to rutvijmehta-harness/kafka that referenced this pull request Feb 9, 2024
When building streams metadata we want to build even if the host is empty as it is a common way to find the other host addresses

Reviewers: John Roesler <vvcephei@apache.org>, Anna Sophie Blee-Goldman <ableegoldman@apache.org>

Co-authored-by: Walker Carlson <18128741+wcarlson5@users.noreply.github.com>
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.

3 participants