Skip to content

importinto, config: use synchronous prepare and add default max import size for Starter - #70511

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
D3Hunter:codex/starter-import-default-limit
Aug 19, 2026
Merged

ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
D3Hunter:codex/starter-import-default-limit

Conversation

@D3Hunter

@D3Hunter D3Hunter commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #67765

Problem Summary:

follow up of #68924
Starter imports are expected to be relatively small, and their maximum size is controlled by starter-params.max-import-data-size. Using DXF asynchronous prepare adds scheduling overhead and delays validation feedback for these imports. Starter also previously inherited the unlimited max-import-data-size default used by non-Starter deployment modes.

What changed and how does it work?

  • Make ShouldUseAsyncPrepare return false for every Starter deployment, so Starter prepares synchronously while other NextGen global-sort deployments continue to use asynchronous prepare.
  • Default starter-params.max-import-data-size to 25 * units.GiB when the deployment mode is Starter and the option is omitted.
  • Preserve explicit Starter values, including 0B for unlimited imports, and keep the default at 0B for non-Starter deployment modes.
  • Update the NextGen example configuration and add coverage for prepare policy, submitted task metadata, and deployment-mode-specific configuration defaults.

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.

The following targeted tests and Ready-profile lint check passed locally:

go test ./pkg/config -run '^(TestDeployModeConfig|TestConfig)$' -count=1 -tags=intest,deadlock,nextgen
./tools/check/failpoint-go-test.sh pkg/dxf/importinto -run '^TestShouldUseAsyncPrepare$' -count=1
./tools/check/failpoint-go-test.sh pkg/dxf/importinto -run '^(TestShouldUseAsyncPrepare|TestSubmitTaskNextgen)$' -count=1 -tags=intest,deadlock,nextgen
make lint

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.

Use synchronous preparation for `IMPORT INTO` in Starter deployments and set the default Starter import size limit to 25 GiB.

Summary by CodeRabbit

  • New Features

    • Starter deployments now default to a 25 GiB limit for IMPORT INTO source data.
    • The limit can be customized, or explicitly set to unlimited with 0B.
    • Updated Starter configuration examples document the new default and options.
  • Bug Fixes

    • Starter imports now use synchronous preparation, improving compatibility with Starter deployment behavior while preserving existing settings for other deployment modes.

@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 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 Plus

Run ID: d845922f-ccb3-46b2-a5c8-6825f40a53d3

📥 Commits

Reviewing files that changed from the base of the PR and between ebeea41 and 57e62fc.

📒 Files selected for processing (7)
  • pkg/config/BUILD.bazel
  • pkg/config/config.go
  • pkg/config/config.toml.nextgen.example
  • pkg/config/config_test.go
  • pkg/dxf/importinto/BUILD.bazel
  • pkg/dxf/importinto/job.go
  • pkg/dxf/importinto/job_testkit_test.go

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Starter import controls

Layer / File(s) Summary
Starter import-size configuration
pkg/config/config.go, pkg/config/config.toml.nextgen.example, pkg/config/config_test.go, pkg/config/BUILD.bazel
Starter deployments default StarterParams.MaxImportDataSize to 25 GiB when unset. Explicit 0B remains unlimited. Tests cover Starter and premium modes.
Prepare-mode eligibility
pkg/dxf/importinto/job.go, pkg/dxf/importinto/BUILD.bazel
ShouldUseAsyncPrepare now excludes Starter deployments.
Prepare-mode and submission tests
pkg/dxf/importinto/job_testkit_test.go, pkg/dxf/importinto/BUILD.bazel
Tests cover deployment modes and verify synchronous Starter preparation with preserved task settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 57e62

The PR changes Starter import preparation and applies a 25 GiB default size limit while preserving explicit settings; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant ConfigLoader
  participant DeployMode
  participant ShouldUseAsyncPrepare
  participant ImportTask
  ConfigLoader->>DeployMode: Load Starter or premium mode
  DeployMode->>ShouldUseAsyncPrepare: Provide deployment mode
  ShouldUseAsyncPrepare->>ImportTask: Select synchronous prepare for Starter
  ShouldUseAsyncPrepare->>ImportTask: Select asynchronous prepare only for eligible modes
Loading

Suggested reviewers: changrui-ryan, disksing

Poem

A rabbit checks the import gate,
“Twenty-five gigs shall set the rate.”
Starter hops through sync prepare,
Premium keeps its async air.
Zero still means limits none—
Config carrots for everyone!

🚥 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
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.
Title check ✅ Passed The title clearly summarizes the two main changes: synchronous prepare for Starter and a default maximum import size.
Description check ✅ Passed The description includes the required issue reference, problem, implementation details, tests, side effects, documentation impact, and release note.
✨ 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.

@D3Hunter D3Hunter changed the title importinto, config: use synchronous prepare for Starter importinto, config: use synchronous prepare and add default max import size for Starter Aug 17, 2026

@zeminzhou zeminzhou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot

ti-chi-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

@zeminzhou: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

LGTM

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 Aug 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.3161%. Comparing base (38c4193) to head (57e62fc).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #70511        +/-   ##
================================================
- Coverage   76.3256%   73.3161%   -3.0096%     
================================================
  Files          2041       2083        +42     
  Lines        558170     585473     +27303     
================================================
+ Hits         426027     429246      +3219     
- Misses       131243     155608     +24365     
+ Partials        900        619       -281     
Flag Coverage Δ
integration 40.9253% <0.0000%> (+1.2566%) ⬆️

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

Components Coverage Δ
dumpling 59.8974% <ø> (ø)
parser ∅ <ø> (∅)
br 46.6167% <ø> (-16.0923%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ingress-bot

Copy link
Copy Markdown

🔍 Starting code review for this PR...

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@ingress-bot ingress-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This review was generated by AI and should be verified by a human reviewer.
Manual follow-up is recommended before merge.

Summary

  • Total findings: 7
  • Inline comments: 7
  • Summary-only findings (no inline anchor): 0
Findings (highest risk first)

⚠️ [Major] (2)

  1. New 25GiB Starter default is inert for existing configs that carry the previously shipped max-import-data-size = "0B" (pkg/config/config.go:1637, pkg/config/config.toml.nextgen.example:523)
  2. Starter synchronous prepare is not actually bounded by max-import-data-size (pkg/dxf/importinto/job.go:78, pkg/executor/import_into.go:112, pkg/executor/importer/precheck.go:117, pkg/config/config_test.go:1454)

🟡 [Minor] (4)

  1. Starter import-size cap flips per-process during rolling restart with no operator-visible signal (pkg/config/config.go:1638, pkg/executor/importer/precheck.go:121)
  2. ShouldUseAsyncPrepare doc comment implies a size-dependent rationale the code doesn't apply (pkg/dxf/importinto/job.go:69, pkg/dxf/importinto/job_testkit_test.go:92)
  3. Starter sync path walks the data source twice per import (pkg/dxf/importinto/job.go:71, pkg/dxf/importinto/planner.go:391, pkg/dxf/importinto/scheduler.go:339)
  4. TestShouldUseAsyncPrepare table varies an input the function never reads (pkg/dxf/importinto/job_testkit_test.go:92, pkg/dxf/importinto/job.go:78)

ℹ️ [Info] (1)

  1. maxImportDataSize column in TestShouldUseAsyncPrepare never affects the result (pkg/dxf/importinto/job_testkit_test.go:97, pkg/dxf/importinto/job.go:78)

Comment thread pkg/config/config.go Resolved
Comment thread pkg/dxf/importinto/job.go Resolved
Comment thread pkg/config/config.go Resolved
Comment thread pkg/dxf/importinto/job.go Resolved
Comment thread pkg/dxf/importinto/job.go Resolved
Comment thread pkg/dxf/importinto/job_testkit_test.go Resolved
Comment thread pkg/dxf/importinto/job_testkit_test.go Resolved
@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 18, 2026
@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 19, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-08-18 05:02:23.750544337 +0000 UTC m=+3713929.786639433: ☑️ agreed by joechenrh.
  • 2026-08-19 05:14:00.087492903 +0000 UTC m=+46675.258587017: ☑️ agreed by GMHDBJD.

@yudongusa yudongusa left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This may need a document update PR

@ti-chi-bot

ti-chi-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, joechenrh, yudongusa, zeminzhou

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 added the approved label Aug 19, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 76eca21 into pingcap:master Aug 19, 2026
34 checks passed
@D3Hunter
D3Hunter deleted the codex/starter-import-default-limit branch August 19, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants