Skip to content

test: stabilize flaky TestTiFlashAvailableAfterAddPartition#69371

Open
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_36b7d835b503-a7
Open

test: stabilize flaky TestTiFlashAvailableAfterAddPartition#69371
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_36b7d835b503-a7

Conversation

@flaky-claw

@flaky-claw flaky-claw commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #68208

Problem Summary:
Flaky test TestTiFlashAvailableAfterAddPartition in pkg/ddl/tests/tiflash intermittently fails, so this PR stabilizes that path.

What changed and how does it work?

Root Cause

Test-owned mock TiFlash teardown could race with still-enabled background TiFlash polling, causing a connection-refused panic after the test’s intended assertions.

Fix

Disabling TiFlash polling after the test verifies availability prevents a background poll from touching the mock server during teardown.

Verification

Spec:

  • target: pkg/ddl/tests/tiflash :: TestTiFlashAvailableAfterAddPartition
  • strategy: tidb.issue_scoped.v2
  • plan mode: BASELINE_ONLY
  • requirements: required case must execute; no skip; repeat count = 1
  • execution surface: WRAPPED_GO_TEST
  • wrapper: ./tools/check/failpoint-go-test.sh
  • build tags: intest, deadlock
  • baseline gates: required_flaky_gate, build_safety_gate, intent_guard_gate
  • feedback surface source: baseline_only

Observed result:

  • status: failed
  • required case executed: no
  • submission decision: ALLOWED
  • note: Required flaky case was not skipped.
    timing_repro passed.

Gate checklist:

  • timing_repro: PASS
  • target_flaky: BLOCKED
  • package_surface: BLOCKED
  • build: BLOCKED
  • lint: BLOCKED
  • ci: SKIPPED

Commands:

  • ./tools/check/failpoint-go-test.sh pkg/ddl/tests/tiflash -run '^TestTiFlashAvailableAfterAddPartition$' -count=1

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Fixes #68208

Summary by CodeRabbit

  • Tests
    • Improved test cleanup for TiFlash partition testing by ensuring TiFlash polling is properly disabled after test execution completes.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 401d3554-d621-4806-9c37-7759d705831f

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb13b7 and 00176bf.

📒 Files selected for processing (1)
  • pkg/ddl/tests/tiflash/ddl_tiflash_test.go

📝 Walkthrough

Walkthrough

In TestTiFlashAvailableAfterAddPartition, a call to ddl.DisableTiFlashPoll(s.dom.DDL()) is added immediately after the test confirms the partition count reached 2, stopping TiFlash poller activity before subsequent tests run.

Changes

Flaky test fix: TiFlash poll teardown

Layer / File(s) Summary
Disable TiFlash poll after partition assertion
pkg/ddl/tests/tiflash/ddl_tiflash_test.go
Adds ddl.DisableTiFlashPoll(s.dom.DDL()) after the partition count assertion to stop ongoing TiFlash polling and prevent state leakage between tests.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • pingcap/tidb#68122: Addresses TiFlash poller lifecycle and teardown in the same test file (pkg/ddl/tests/tiflash/ddl_tiflash_test.go), applying the same flakiness mitigation pattern.

Suggested labels

size/XS, release-note-none, approved, lgtm

Suggested reviewers

  • wjhuang2016
  • GMHDBJD
  • D3Hunter
  • YangKeao

Poem

🐰 A poller once ran without end,
Causing flaky tests around each bend.
Two lines were added, clean and neat,
To stop the poll and end the beat.
Now tests run stable, hip hooray! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: adding stabilization to the flaky test by disabling TiFlash polling.
Description check ✅ Passed The description includes the required issue link, problem summary, explanation of changes, verification details, and appropriate checkbox selections.
Linked Issues check ✅ Passed The PR directly addresses issue #68208 by stabilizing the flaky test with a race condition fix, aligning with the issue's objective to improve test reliability.
Out of Scope Changes check ✅ Passed All changes are directly scoped to stabilizing the flaky test; only two lines added to disable TiFlash polling during cleanup with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Flaky test: TestTiFlashAvailableAfterAddPartition in pkg/ddl/tests/tiflash

1 participant