ddl: prevent partial ADD INDEX plans after transient TSO errors#69834
ddl: prevent partial ADD INDEX plans after transient TSO errors#69834D3Hunter wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe physical-table backfill planner now propagates retry errors, rebuilds subtask metadata per attempt, and supports failpoint-driven testing for region discontinuity and timestamp allocation failures. Scheduler tests use the test failpoint helper and validate generated subtask metadata. ChangesDistributed backfill retry correctness
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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" 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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #69834 +/- ##
================================================
- Coverage 76.3196% 75.8566% -0.4630%
================================================
Files 2041 2082 +41
Lines 560096 580871 +20775
================================================
+ Hits 427463 440629 +13166
- Misses 131732 138085 +6353
- Partials 901 2157 +1256
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
🔍 Starting code review for this PR... |
|
/retest |
ingress-bot
left a comment
There was a problem hiding this comment.
This review was generated by AI and should be verified by a human reviewer.
Manual follow-up is recommended before merge.
Summary
- Total findings: 3
- Inline comments: 2
- Summary-only findings (no inline anchor): 0
Findings (highest risk first)
⚠️ [Major] (1)
- Fix duplicates region-continuity retry logic instead of consolidating with genMergeTempPlanForOneIndex, leaving the twin with the same bug this PR fixes (pkg/ddl/backfilling_dist_scheduler.go:331, pkg/ddl/backfilling_dist_scheduler.go:892)
ℹ️ [Info] (2)
- New retryable error lacks the root-cause note that motivates retrying at all (pkg/ddl/backfilling_dist_scheduler.go:382)
- No invariant comment guards the per-attempt
attemptMetasbuffer this PR's fix depends on (pkg/ddl/backfilling_dist_scheduler.go:420)
| subTaskMetas = append(subTaskMetas, metaBytes) | ||
| attemptMetas = append(attemptMetas, metaBytes) | ||
| } | ||
| subTaskMetas = attemptMetas |
There was a problem hiding this comment.
ℹ️ [Info] No invariant comment guards the per-attempt attemptMetas buffer this PR's fix depends on
The whole point of this diff (per the commit title, prevent partial add-index plans after transient retries) is that subTaskMetas must only be replaced atomically from a fresh attemptMetas slice on a fully successful attempt, never appended to directly across retries.
That invariant is encoded purely by variable naming/placement (attemptMetas local to the retry closure, subTaskMetas in the outer scope) with no comment marking it, so a future edit that reintroduces direct appends to subTaskMetas inside the retry closure (the exact shape of the bug this PR fixes) would compile cleanly and pass review without an obvious signal.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wjhuang2016 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #69789
Problem Summary:
generatePlanForPhysicalTablereturned(retryable=true, err=nil)when itdetected discontinuous regions or failed to allocate a timestamp for a subtask.
RunWithRetrytreats a nil error as success, so a timestamp failure after anearlier region batch had been planned could publish only the retained prefix of
the physical-table plan. Propagating the timestamp error alone was insufficient
because metadata from failed attempts remained in the shared result slice and
would be duplicated by the next attempt.
What changed and how does it work?
pkg/testkit/testfailpointfor checked failpoint setup and automatic cleanup in the affected tests.Check List
Tests
Commands run:
make bazel_prepare ./tools/check/failpoint-go-test.sh pkg/ddl -run '^TestBackfillingScheduler(LocalMode|GlobalSortMode)$' -count=1 make lint git diff --checkSide effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit