Repository navigation
fix(inkless:test): eliminate KRaft topic metadata propagation races in integration tests - #921
Merged
Merged
Conversation
…pic in InklessTopicTypeSwitcherClusterTest `testAlterDisklessSwitchRejectsReArmAndNonLowerSealOnCommittedSwitch()` created a 3-replica classic topic, called `TopicMetadataProbe.awaitVisible(admin, topic)`, and immediately flipped `diskless.enable=true` without producing records first. Because `TopicMetadataProbe.awaitVisible` probes only one broker, it can return as soon as a follower applies the `CreateTopics` delta while the partition leader has not yet applied it. When that happens, the leader receives topic creation and `CLASSIC_TO_DISKLESS_SWITCH_PENDING` (`-2`) in a single coalesced metadata delta with `existingPartition = None` and no local log on disk. `ReplicaManager.applyLocalLeadersDelta()` then hits its missing-log guard (which prevents a leader with a lost local disk from sealing at offset 0), skips `makeLeader` and `registerPartition`, and leaves the seal stuck at `-2` until `waitForSealOffset` times out. Wait until every broker hosts the partition as an online partition before calling `incrementalAlterConfigs(diskless.enable=true)`. Assisted-by: Gemini 4 Neon
…rolPlaneMigrationLockClusterTest `InklessControlPlaneMigrationLockClusterTest.createTopics()` called `admin.describeTopics(List.of(TOPIC_NAME))` immediately after `admin.createTopics(...)` returned. Because `createTopics` completes as soon as the controller commits the topics, the broker serving the follow-up `describeTopics` request may not have applied the metadata delta yet, causing flaky `UnknownTopicOrPartitionException` failures in CI. Read the topic ID directly from `CreateTopicsResult.topicId(TOPIC_NAME)` instead of calling `describeTopics`, and wait until both created topics appear in every broker's metadata cache before returning. Assisted-by: Gemini 4 Neon
…n InklessUntieredDisklessMigrationTest `testUntieredTopicKeepsWorkingWhenConsolidationIsEnabled()` called `admin.describeConfigs` for `born-consolidating` immediately after `admin.createTopics(...).all().get()` returned. Because broker metadata updates asynchronously after the controller commits a topic, a broker serving `describeConfigs` may not yet see the new topic and fail with `UnknownTopicOrPartitionException`. Replace the unguarded `describeConfigs` call with `TopicMetadataProbe.awaitValue`, matching the rest of the Inkless integration suite. Assisted-by: Gemini 4 Neon
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-only changes that wait for broker metadata and configuration visibility.
No open issues 🎉
What changed in this PR
This PR reduces metadata-propagation flakes in three Inkless integration tests by waiting for broker readiness before issuing follow-up requests. It changes test synchronization only, not production behavior.
Changes:
- Wait for online replicas on every broker before switching an empty classic topic to diskless.
- Read the topic ID from the creation result and wait for both topics in every broker’s metadata cache.
- Poll for remote-storage configuration visibility after creating a diskless topic.
| File | Description |
|---|---|
core/src/test/java/kafka/server/InklessUntieredDisklessMigrationTest.java |
Uses TopicMetadataProbe.awaitValue() to wait for remote-storage configuration visibility. |
core/src/test/java/kafka/server/InklessTopicTypeSwitcherClusterTest.java |
Waits for every replica’s online partition before starting the diskless switch. |
core/src/test/java/kafka/server/InklessControlPlaneMigrationLockClusterTest.java |
Gets the topic ID from CreateTopicsResult and waits for metadata on every broker. |
Review effort: Balanced
jeqo
marked this pull request as ready for review
December 1, 2026 13:22
gqmelo
approved these changes
Dec 2, 2026
This was referenced Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three Inkless cluster integration tests issued follow-up requests right after
admin.createTopics(...).all().get()returned without waiting for every broker to apply the new topic metadata delta. Waiting for metadata propagation across all brokers (or polling viaTopicMetadataProbe) removes these intermittentUnknownTopicOrPartitionExceptionand pending-seal timeout flakes in CI.Commits
fix(inkless:test): wait for online replicas before switching empty topic in InklessTopicTypeSwitcherClusterTestfix(inkless:test): wait for topic metadata propagation in InklessControlPlaneMigrationLockClusterTestfix(inkless:test): await topic config visibility after createTopics in InklessUntieredDisklessMigrationTestSee the commit messages for the root cause and fix details behind each test.
Test plan
InklessTopicTypeSwitcherClusterTest.testAlterDisklessSwitchRejectsReArmAndNonLowerSealOnCommittedSwitch: waits foronlinePartition(tp).isDefined()on all three brokers before flippingdiskless.enable=true, preventing a coalesced create+switch delta from hittingReplicaManager's missing-log guard.InklessControlPlaneMigrationLockClusterTest: reads the topic ID directly fromCreateTopicsResult.topicId()and waits for both topics in every broker'sMetadataCachebefore shutting down a broker or running follow-up requests.InklessUntieredDisklessMigrationTest.testUntieredTopicKeepsWorkingWhenConsolidationIsEnabled: replaces the unguardedadmin.describeConfigs()call onborn-consolidatingwithTopicMetadataProbe.awaitValue().