Skip to content

tests: isolate pending processed regions from patrol - #11257

Open
rleungx wants to merge 1 commit into
tikv:masterfrom
rleungx:fix-pending-processed-regions-race
Open

rleungx wants to merge 1 commit into
tikv:masterfrom
rleungx:fix-pending-processed-regions-race

Conversation

@rleungx

@rleungx rleungx commented Sep 15, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

TestRaftClusterTestSuite/TestPendingProcessedRegions races with region patrol: the source region can be removed from the pending list before the exact-set assertion.

Issue Number: ref #10409

The concrete failure was observed in #11251's NextGen job. This fixes the pending-list assertion race, not the different historical failure reported in #10409.

What is changed and how does it work?

Disable region patrol before starting an isolated test environment, preventing
in-flight patrol from consuming batch-split entries before the assertion.
Preserve the exact-set assertion and clean up the environment before restoring
the failpoint. No production code changes.

Check List

Tests

  • NextGen integration suite with failpoints and race detector: 5 repetitions passed (nextgen,without_dashboard).
  • Classic integration suite with failpoints and race detector: 3 repetitions passed (without_dashboard).
  • Configured golangci-lint: 0 issues in classic and NextGen modes (without_dashboard).
  • gofmt and git diff --check: passed.
  • Baseline NextGen/race run: 3 repetitions passed; the original CI failure was not reproduced in this sample.

Release note

None.

Summary by CodeRabbit

  • Tests
    • Updated scheduling coverage to reliably verify that pending region-processing entries remain pending during assertions.
    • Improved test isolation by creating and cleaning up a dedicated scheduling test environment.

Disable region patrol before starting a fresh test environment so no
in-flight patrol can consume the batch-split entries before the exact-set
assertion. Clean up the environment before restoring the failpoint.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 15, 2026
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 14fbc752-e24d-43bd-81e6-d47424646af5

📥 Commits

Reviewing files that changed from the base of the PR and between ef560c8 and 4a90f13.

📒 Files selected for processing (1)
  • tests/server/cluster/cluster_work_test.go

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

TestPendingProcessedRegions now controls region patrol and uses a fresh scheduling environment so pending batch-split entries remain available for the assertion.

Changes

Pending regions test

Layer / File(s) Summary
Test setup and pending-region assertion
tests/server/cluster/cluster_work_test.go
The test enables and defers disabling of skipPatrolRegions. It creates and cleans up a fresh scheduling test environment instead of reusing s.env.

Priority: ⬇️ Low

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

Change: Other

Merge Risk: ⚪ Minimal · up to 4a90f

This test-only change isolates scheduling state and restores the failpoint safely, with no established merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test change and its purpose: isolating pending processed regions from region patrol.
Description check ✅ Passed The description explains the race, references the issue, describes the implementation, lists validation results, and includes the required release note. The omitted optional checklist sections do not …
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@ti-chi-bot

ti-chi-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai[bot]: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

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.

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.75%. Comparing base (ef560c8) to head (4a90f13).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11257      +/-   ##
==========================================
+ Coverage   79.73%   79.75%   +0.01%     
==========================================
  Files         546      546              
  Lines       79262    79262              
==========================================
+ Hits        63203    63217      +14     
+ Misses      11686    11667      -19     
- Partials     4373     4378       +5     
Flag Coverage Δ
unittests 79.75% <ø> (+0.01%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rleungx

rleungx commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

/retest

@ti-chi-bot

ti-chi-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coderabbitai[bot], lhy1024

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

The pull request process is described 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 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-09-15 08:18:12.762698727 +0000 UTC m=+106738.700356322: ☑️ agreed by lhy1024.

@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. 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.

2 participants