8000 fix(inkless:test): eliminate KRaft topic metadata propagation races in integration tests by jeqo · Pull Request #921 · aiven/inkless · GitHub
[go: up one dir, main page]

Skip to content

fix(inkless:test): eliminate KRaft topic metadata propagation races in integration tests - #921

Merged
gqmelo merged 3 commits into
mainfrom
jeqo/fix-metadata-propagation-test-flakes
Dec 2, 2026
Merged

gqmelo merged 3 commits into
mainfrom
jeqo/fix-metadata-propagation-test-flakes

Conversation

@jeqo
@jeqo jeqo commented Dec 1, 2026
Copy link
Copy Markdown
Contributor

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 via TopicMetadataProbe) removes these intermittent UnknownTopicOrPartitionException and pending-seal timeout flakes in CI.

Commits

  • fix(inkless:test): wait for online replicas before switching empty topic in InklessTopicTypeSwitcherClusterTest
  • fix(inkless:test): wait for topic metadata propagation in InklessControlPlaneMigrationLockClusterTest
  • fix(inkless:test): await topic config visibility after createTopics in InklessUntieredDisklessMigrationTest

See the commit messages for the root cause and fix details behind each test.

Test plan

  • InklessTopicTypeSwitcherClusterTest.testAlterDisklessSwitchRejectsReArmAndNonLowerSealOnCommittedSwitch: waits for onlinePartition(tp).isDefined() on all three brokers before flipping diskless.enable=true, preventing a coalesced create+switch delta from hitting ReplicaManager's missing-log guard.
  • InklessControlPlaneMigrationLockClusterTest: reads the topic ID directly from CreateTopicsResult.topicId() and waits for both topics in every broker's MetadataCache before shutting down a broker or running follow-up requests.
  • InklessUntieredDisklessMigrationTest.testUntieredTopicKeepsWorkingWhenConsolidationIsEnabled: replaces the unguarded admin.describeConfigs() call on born-consolidating with TopicMetadataProbe.awaitValue().

jeqo added 3 commits December 1, 2026 14:36
…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
@jeqo
jeqo requested a balanced review from Copilot December 1, 2026 13:18
Copilot AI 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.

🟢 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
jeqo marked this pull request as ready for review December 1, 2026 13:22
@jeqo
jeqo requested a review from gqmelo December 2, 2026 11:31
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

0