Skip to content

HOTFIX: skip listOffsets request for newly created changelog topics#8662

Merged
vvcephei merged 6 commits into
apache:trunkfrom
ableegoldman:HOTFIX-dont-fetch-offsets-for-new-changelogs
May 14, 2020
Merged

HOTFIX: skip listOffsets request for newly created changelog topics#8662
vvcephei merged 6 commits into
apache:trunkfrom
ableegoldman:HOTFIX-dont-fetch-offsets-for-new-changelogs

Conversation

@ableegoldman

Copy link
Copy Markdown
Member

This seems to be the final piece in the EosBetaUpgradeTest flakiness puzzle. From time to time the listOffsets request would fail during the initial startup rebalance, causing a probing rebalance to be scheduled for 10 min later (rather than immediately after). The assignor was newly creating the changelogs and then almost immediately calling listOffsets which then failed as the internal topics were not yet ready.

To avoid this race condition, we keep track of which changelogs we just created and skip fetching the end offsets for them. If a changelog did not exist before this moment, we can safely assume that its end offset is zero.

@ableegoldman

Copy link
Copy Markdown
Member Author

call for review any of @guozhangwang @vvcephei @cadonna @mjsax

Comment on lines 1531 to 1551

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.

Am I crazy or is this entire block not actually doing anything?

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.

It should do some sanity checks -- but I agree it's not easy to grok... Maybe we also incrementally refactored the code and this method become useless? All tests passed?

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.

I guess to be fair it was still validating that every topic had the numberOfPartitions set, but I thought it might make more sense to do this inside the InternalTopicManager since that checks the partitions anyways

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.

The logic indeed seem redundant to me.

@mjsax

mjsax commented May 12, 2020

Copy link
Copy Markdown
Member

Retest this please

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 like immutability. Should we call this allExpetcedChangelogPartitions and introduce allExistingChangelogPartitions = allExpetcedChangelogPartitions - newlyCreatedChangelogs

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.

Fair enough

@mjsax mjsax 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.

Overall LGTM.

Can we extend unit test accordingly to verify that we set offset=0L for newly created topcis?

@ableegoldman

Copy link
Copy Markdown
Member Author

@mjsax addressed your comments and added a unit test to verify that we don't ask the admin client to request offsets for newly created topics

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.

Don't we need to reply adminClient, too?

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.

It gets replayed during configuration (at the end of configureDefault below)

@mjsax

mjsax commented May 13, 2020

Copy link
Copy Markdown
Member

Retest this please

@mjsax

mjsax commented May 13, 2020

Copy link
Copy Markdown
Member

Retest this please

@ableegoldman
ableegoldman force-pushed the HOTFIX-dont-fetch-offsets-for-new-changelogs branch from 6b7d183 to fbc13b4 Compare May 13, 2020 22:06
@mjsax

mjsax commented May 13, 2020

Copy link
Copy Markdown
Member

Retest this please.

1 similar comment
@mjsax

mjsax commented May 13, 2020

Copy link
Copy Markdown
Member

Retest this please.

@ableegoldman

Copy link
Copy Markdown
Member Author

Nooooooo EosBetaUpgradeIntegrationTest.shouldUpgradeFromEosAlphaToEosBeta[true] still had one failure on the Java 8 build 😭

But it failed on a different line which seems more in line with real flakiness. FWIW I ran this locally 40 times without failures (technically 80 in total for both true/false variations) ... I think it's worth still merging this PR and we can continue investigating it from there.

java.lang.AssertionError: Did not receive all 20 records from topic multiPartitionOutputTopic within 60000 ms
Expected: is a value equal to or greater than <20>
     but: <5> was less than <20>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.apache.kafka.streams.integration.utils.IntegrationTestUtils.lambda$waitUntilMinKeyValueRecordsReceived$1(IntegrationTestUtils.java:563)
	at org.apache.kafka.test.TestUtils.retryOnExceptionWithTimeout(TestUtils.java:429)
	at org.apache.kafka.test.TestUtils.retryOnExceptionWithTimeout(TestUtils.java:397)
	at org.apache.kafka.streams.integration.utils.IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(IntegrationTestUtils.java:559)
	at org.apache.kafka.streams.integration.utils.IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(IntegrationTestUtils.java:530)
	at org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.readResult(EosBetaUpgradeIntegrationTest.java:973)
	at org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.verifyCommitted(EosBetaUpgradeIntegrationTest.java:961)
	at org.apache.kafka.streams.integration.EosBetaUpgradeIntegrationTest.shouldUpgradeFromEosAlphaToEosBeta(EosBetaUpgradeIntegrationTest.java:427)

@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.

Oops, never submitted my review. Feel free to ignore my minor suggestion.

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's not what you signed up for, but I'm wondering if we should at least submit a Jira to give some of these AdminClient methods a "full consistency" mode. In other words, since the command returns a future anyway, it would be nice to be able to tell it not to return until it can guarantee the topic will appear to be fully created on all brokers.

I'm mildly concerned that we're just kicking the can down the road a little ways with this PR. I.e., we let the assignment happen, but then some other metadata (or data) operation for that topic will just fail shortly thereafter.

More generally, we jump through a lot of hoops in our own tests to try and make sure that the topics are really, actually created (or deleted) before proceeding with the test, and I'm sure that our users also suffer from the same problem in their testing and production code.

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.

I think this race condition was particularly severe since we do the listOffsets request pretty much immediately after creating the topics, whereas whatever we're doing with that topic next will not be until the rebalance was completed.

AFAIK we've never had any users report subsequent operations failing after the first rebalance due to not-yet-fully-created topics, but it could have just slipped past us

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.

I do agree it would be useful though. Feel free to create a ticket :P

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! Will do. I just wanted to bounce the idea off you first, in case it was stupid.

Co-authored-by: John Roesler <vvcephei@users.noreply.github.com>
@mjsax

mjsax commented May 14, 2020

Copy link
Copy Markdown
Member

Retest this please.

1 similar comment
@mjsax

mjsax commented May 14, 2020

Copy link
Copy Markdown
Member

Retest this please.

@ableegoldman

Copy link
Copy Markdown
Member Author

Java 14 build passed, Java 8 din't build due to

11:29:13 # There is insufficient memory for the Java Runtime Environment to continue.
11:29:13 # Cannot create GC thread. Out of system resources.

@vvcephei
vvcephei merged commit 4e72202 into apache:trunk May 14, 2020
@vvcephei

Copy link
Copy Markdown
Contributor

Thanks, @ableegoldman !

@ableegoldman
ableegoldman deleted the HOTFIX-dont-fetch-offsets-for-new-changelogs branch May 15, 2020 01:01
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.

4 participants