Skip to content

test: stabilize flaky TestIssue29282#69881

Open
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_9eef8fe9bdf5-a1
Open

test: stabilize flaky TestIssue29282#69881
flaky-claw wants to merge 1 commit into
pingcap:masterfrom
flaky-claw:flakyfixer/case_9eef8fe9bdf5-a1

Conversation

@flaky-claw

@flaky-claw flaky-claw commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #69824

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

What changed and how does it work?

Root Cause

Fixed sleeps let cleanup or cancellation race a still-running background SELECT FOR UPDATE in TestIssue29282.

Fix

NOWAIT verifies the same row-lock behavior before and after rollback without depending on goroutine scheduling.

Verification

Spec:

  • target: pkg/ddl :: TestIssue29282
  • strategy: tidb.go_flaky.default
  • plan mode: BASELINE_ONLY
  • requirements: required case must execute; no skip; repeat count = 1
  • execution surface: GO_TEST_WITH_TAGS
  • build tags: intest, deadlock
  • baseline gates: required_flaky_gate, build_safety_gate, intent_guard_gate
  • feedback surface source: baseline_only

Observed result:

  • status: passed
  • required case executed: yes
  • submission decision: ALLOWED
  • note: Required flaky case executed during validation.
    Required flaky case was not skipped.
    target_flaky passed.
    build passed.
    lint passed.

Gate checklist:

  • timing_repro_prefix: SKIPPED
  • target_flaky: PASS
  • package_scope_raw: SKIPPED
  • raw_harness_clarifier: SKIPPED
  • build: PASS
  • lint: PASS
  • external_ci: SKIPPED

Commands:

  • go test -json -tags=intest,deadlock ./pkg/ddl -run '^TestIssue29282$' -count=1
  • make build
  • make lint

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 #69824

Summary by CodeRabbit

  • Tests
    • Updated transaction-locking coverage to verify immediate failure when a row is locked.
    • Added validation that the row becomes accessible after the original transaction rolls back.

@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jul 16, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wjhuang2016 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 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: 3565bec1-f9fa-4006-abb5-0247939fd1bd

📥 Commits

Reviewing files that changed from the base of the PR and between 531e40c and cf9c4c1.

📒 Files selected for processing (1)
  • pkg/ddl/db_integration_test.go

📝 Walkthrough

Walkthrough

TestIssue29282 replaces goroutine and timeout-based lock blocking validation with explicit FOR UPDATE NOWAIT assertions before and after transaction rollback.

Changes

Lock test validation

Layer / File(s) Summary
NOWAIT lock checks
pkg/ddl/db_integration_test.go
The test asserts that a competing FOR UPDATE NOWAIT fails while the lock is held, then succeeds after rollback and verifies the expected row.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: ok-to-test, approved, lgtm

Suggested reviewers: gmhdbjd, wjhuang2016

Poem

I’m a bunny who watches the lock,
No more waiting around the clock.
NOWAIT says “no,” then rollback says “go,”
The row hops free in a tidy flow.
Test flakes flee—hip-hop, 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 clearly summarizes the main change: stabilizing flaky TestIssue29282.
Description check ✅ Passed The description covers the problem, fix, verification, checklist, and links the required issue.
Linked Issues check ✅ Passed The PR addresses #69824 by removing timing-dependent behavior from TestIssue29282 and stabilizing the flaky test.
Out of Scope Changes check ✅ Passed The changes stay within the test stabilization scope and do not introduce unrelated code changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: context deadline exceeded"
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"


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.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.5704%. Comparing base (531e40c) to head (cf9c4c1).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #69881        +/-   ##
================================================
- Coverage   76.3207%   75.5704%   -0.7503%     
================================================
  Files          2041       2084        +43     
  Lines        559975     582360     +22385     
================================================
+ Hits         427377     440092     +12715     
- Misses       131697     140155      +8458     
- Partials        901       2113      +1212     
Flag Coverage Δ
integration 45.5194% <ø> (+5.8142%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 60.4471% <ø> (ø)
parser ∅ <ø> (∅)
br 63.4209% <ø> (+0.6996%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: TestIssue29282 in pkg/ddl

1 participant