Skip to content

KAFKA-6145: Add unit tests to verify fix of bug KAFKA-9173#8689

Merged
vvcephei merged 2 commits intoapache:trunkfrom
cadonna:AK6145-AK9173
May 19, 2020
Merged

KAFKA-6145: Add unit tests to verify fix of bug KAFKA-9173#8689
vvcephei merged 2 commits intoapache:trunkfrom
cadonna:AK6145-AK9173

Conversation

@cadonna
Copy link
Copy Markdown
Member

@cadonna cadonna commented May 18, 2020

Unit tests

  • shouldAssignActiveStatefulTasksEvenlyOverClientsAndStreamThreadsWithMoreStreamThreadsThanTasks()
  • shouldAssignWarmUpTasksIfStatefulActiveTasksBalancedOverStreamThreadsButNotOverClients()
  • shouldEvenlyAssignActiveStatefulTasksIfClientsAreWarmedUpToBalanceTaskOverClients()
    verify that bug KAFKA-9173 is fixed with the new HighAvailabilityTaskAssignor.

shouldAssignActiveStatefulTasksEvenlyOverClientsAndStreamThreadsWithMoreStreamThreadsThanTasks()
ensures that tasks are evenly assigned over clients when all overprovisioned clients join
simultaneously.

shouldAssignWarmUpTasksIfStatefulActiveTasksBalancedOverStreamThreadsButNotOverClients()
ensures that warm-up tasks are assigned to two new clients that join the group
although the assignment is already balanced over stream threads.

shouldEvenlyAssignActiveStatefulTasksIfClientsAreWarmedUpToBalanceTaskOverClients()
ensures that stateful active tasks are balanced over previous and warmed-up client
although it the previous assignment is balanced over stream threads.

Committer Checklist (excluded from commit message)

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

Unit tests
- shouldAssignActiveStatefulTasksEvenlyOverClientsAndStreamThreadsWithMoreStreamThreadsThanTasks()
- shouldAssignWarmUpTasksIfStatefulActiveTasksBalancedOverStreamThreadsButNotOverClients()
- shouldEvenlyAssignActiveStatefulTasksIfClientsAreWarmedUpToBalanceTaskOverClients()
verify that bug KAFKA-9173 is fixed with the new HighAvailabilityTaskAssignor.

shouldAssignActiveStatefulTasksEvenlyOverClientsAndStreamThreadsWithMoreStreamThreadsThanTasks()
ensures that tasks are evenly assigned over clients when all overprovisioned clients join
simultaneously.

shouldAssignWarmUpTasksIfStatefulActiveTasksBalancedOverStreamThreadsButNotOverClients()
ensures that warm-up tasks are assigned to two new clients that join the group
although the assignment is already balanced over stream threads.

shouldEvenlyAssignActiveStatefulTasksIfClientsAreWarmedUpToBalanceTaskOverClients()
ensures that stateful active tasks are balanced over previous and warmed-up client
although it the previous assignment is balanced over stream threads.

@Test
public void shouldAssignActiveStatefulTasksEvenlyOverClientsWithLessClientsThanTasks() {
public void shouldAssignActiveStatefulTasksEvenlyOverClientsWithMoreClientsThanTasks() {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This name seemed not correct.

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.

Huh, good catch!

@cadonna
Copy link
Copy Markdown
Member Author

cadonna commented May 18, 2020

Call for review: @vvcephei @ableegoldman

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 @cadonna ! Just one minor suggestion.


@Test
public void shouldAssignActiveStatefulTasksEvenlyOverClientsWithLessClientsThanTasks() {
public void shouldAssignActiveStatefulTasksEvenlyOverClientsWithMoreClientsThanTasks() {
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.

Huh, good catch!

);

assertThat(unstable, is(false));
assertValidAssignment(0, allTaskIds.size() / 3 + 1, allTaskIds, emptySet(), clientStates, new StringBuilder());
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.

If we expect no warmups, we can assert it here with:

Suggested change
assertValidAssignment(0, allTaskIds.size() / 3 + 1, allTaskIds, emptySet(), clientStates, new StringBuilder());
assertValidAssignment(0, allTaskIds, emptySet(), clientStates, new StringBuilder());

@vvcephei
Copy link
Copy Markdown
Contributor

test this please

@vvcephei
Copy link
Copy Markdown
Contributor

test this please

2 similar comments
@vvcephei
Copy link
Copy Markdown
Contributor

test this please

@vvcephei
Copy link
Copy Markdown
Contributor

test this please

@vvcephei
Copy link
Copy Markdown
Contributor

retest this please

@vvcephei
Copy link
Copy Markdown
Contributor

Test failures were unrelated:
kafka.api.SaslPlaintextConsumerTest.testCoordinatorFailover

and 3x: org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.shouldUpgradeFromEosAlphaToEosBeta[true]

@vvcephei vvcephei merged commit af02f76 into apache:trunk May 19, 2020
@vvcephei
Copy link
Copy Markdown
Contributor

Thanks, @cadonna !

@cadonna cadonna deleted the AK6145-AK9173 branch May 20, 2020 08:07
Kvicii pushed a commit to Kvicii/kafka that referenced this pull request May 21, 2020
* 'trunk' of github.com:apache/kafka:
  MINOR: Increase gradle daemon’s heap size to 2g (apache#8700)
  KAFKA-9603: Do not turn on bulk loading for segmented stores on stand-by tasks (apache#8661)
  KAFKA-9859 / kafka-streams-application-reset tool doesn't take into account topics generated by KTable foreign key join operation (apache#8671)
  MINOR: Fix redundant typos in comments and javadocs (apache#8693)
  KAFKA-10010: Should make state store registration idempotent (apache#8681)
  KAFKA-10011: Remove task id from lockedTaskDirectories during handleLostAll (apache#8682)
  KAFKA-9992: Eliminate JavaConverters in EmbeddedKafkaCluster (apache#8673)
  KAFKA-6145: Add unit tests to verify fix of bug KAFKA-9173 (apache#8689)
  MINOR: Update stream documentation (apache#8622)
  MINOR: Small fixes in the documentation (apache#8623)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants