Skip to content

Conversation

@terry1purcell
Copy link
Contributor

@terry1purcell terry1purcell commented Dec 12, 2025

What problem does this PR solve?

Issue Number: ref #63501

Problem Summary:

What changed and how does it work?

Reduced flakyness of this test in 2 ways:

  1. Claude code's recommendation for resolving the race condition (see below) to "set" the variables using SQL rather than directly assign the variable in the code.
  2. Changed the plan comparison to only look for the existence of IndexHashJoin rather than comparing the entire plan.

Claude code's summary of this change:

Why This Fixes (or Reduces) the Race Condition

The race occurs because:

  • Test goroutine directly writes to InitChunkSize/MaxChunkSize fields
  • Join worker goroutines from ANALYZE or query execution concurrently read these same fields
  • No synchronization protects these accesses

Using SET statements helps because:

  • MustExec("SET ...") is a blocking call that completes before returning
  • Creates a synchronization barrier between variable modification and next query
  • Goes through TiDB's proper variable setting infrastructure
  • Consistent with rest of test (lines 38-39 already use SET)

Important caveat: This may reduce but not completely eliminate the race if background
goroutines from earlier operations persist and continue reading SessionVars.

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

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 12, 2025
@ti-chi-bot ti-chi-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 12, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 12, 2025

[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 andylokandy 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.

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

@tiprow
Copy link

tiprow bot commented Dec 12, 2025

Hi @terry1purcell. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a flaky test TestIndexNestedLoopHashJoin by replacing direct manipulation of session variables with proper SQL SET statements. This ensures thread-safe test execution and prevents race conditions that could cause test instability.

  • Replaced direct session variable assignments with SQL SET statements for clustered index and chunk size configurations
  • Removed the now-unused vardef package import
  • Applied consistent fixes across two test functions: TestIndexNestedLoopHashJoin and TestIssue31129

@ti-chi-bot ti-chi-bot bot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 12, 2025
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.8149%. Comparing base (8aefecd) to head (3e12779).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65012        +/-   ##
================================================
- Coverage   70.9290%   68.8149%   -2.1141%     
================================================
  Files          1888       1866        -22     
  Lines        515954     511005      -4949     
================================================
- Hits         365961     351648     -14313     
- Misses       125582     137029     +11447     
+ Partials      24411      22328      -2083     
Flag Coverage Δ
integration 41.6473% <ø> (-6.5072%) ⬇️
unit 65.9769% <ø> (+0.3128%) ⬆️

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

Components Coverage Δ
dumpling 52.8700% <ø> (ø)
parser ∅ <ø> (∅)
br 39.1496% <ø> (-20.2754%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 12, 2025
@purelind
Copy link
Contributor

/retest

@tiprow
Copy link

tiprow bot commented Dec 12, 2025

@purelind: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@terry1purcell
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Dec 12, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 12, 2025

@terry1purcell: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/mysql-test 3e12779 link true /test mysql-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants