Skip to content

dxf: add DXF resource limit config - #68251

Merged
ti-chi-bot[bot] merged 11 commits into
pingcap:masterfrom
D3Hunter:codex/dxf-resource-limit
May 13, 2026
Merged

ti-chi-bot[bot] merged 11 commits into
pingcap:masterfrom
D3Hunter:codex/dxf-resource-limit

Conversation

@D3Hunter

@D3Hunter D3Hunter commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #68181

Problem Summary:

Premium Reserved deployments need a TiDB-level way to limit the amount of local TiDB resources that DXF tasks may consume. The value stored in mysql.dist_framework_meta.cpu_count should represent usable DXF CPU rather than total local node CPU.

What changed and how does it work?

  • Add dxf-resource-limit as a TiDB config item with default 100 and valid range [10, 100].
  • Forbid explicit dxf-resource-limit configuration unless deploy-mode = "premium_reserved".
  • Calculate usable DXF CPU as the full CPU count when the limit is 100, otherwise ceil(total_cpu * limit / 100) with a minimum of 1.
  • Scale DXF memory from the same CPU ratio so per-core memory is preserved.
  • Pass the limited NodeResource to the DXF task executor manager.
  • Store the precomputed usable DXF CPU in mysql.dist_framework_meta.cpu_count during InitMetaSession and RecoverMeta.

Check List

Tests

  • Unit test
    • go test -run 'TestDeployModeConfig|TestConfig$|TestConfigExample|TestGetJSONConfig' -count=1 -tags=intest,deadlock ./pkg/config
    • go test -run TestTaskBaseGetRuntimeSlots -count=1 -tags=intest,deadlock ./pkg/dxf/framework/proto
    • ./tools/check/failpoint-go-test.sh pkg/dxf/framework/storage -run TestDistFrameworkMeta -count=1
    • ./tools/check/failpoint-go-test.sh pkg/domain -run '^$' -count=1
    • make lint
  • Integration test
  • Manual test (add detailed scripts or steps below)
tested with below diff applied to make the data size large enough for auto calculation

diff --git a/pkg/ddl/reorg_util.go b/pkg/ddl/reorg_util.go
index 9d029a5302..6a725f8f8b 100644
--- a/pkg/ddl/reorg_util.go
+++ b/pkg/ddl/reorg_util.go
@@ -111,6 +111,7 @@ func initJobReorgMetaFromVariables(ctx context.Context, job *model.Job, tbl tabl
 		if err != nil {
 			return err
 		}
+		tableSizeInBytes = tableSizeInBytes * units.GiB
 		calc := scheduler.NewRCCalcForAddIndex(tableSizeInBytes, cpuNum, factors)
 		autoConc = calc.CalcRequiredSlots()
 		autoMaxNode = calc.CalcMaxNodeCountForAddIndex()
diff --git a/pkg/executor/importer/import.go b/pkg/executor/importer/import.go
index ab94b8b37f..541c44612e 100644
--- a/pkg/executor/importer/import.go
+++ b/pkg/executor/importer/import.go
@@ -1590,7 +1590,7 @@ func (e *LoadDataController) InitDataFiles(ctx context.Context) error {
 
 	e.dataFiles = dataFiles
 	e.TotalFileSize = totalSize
-	e.TotalRealSize = totalRealSize
+	e.TotalRealSize = totalRealSize * units.GiB
 
 	return nil
 }

run on local mac with 10c, and

deploy-mode = 'premium_reserved'
dxf-resource-limit = 30

we can see the auto calculated resource use max 3c

[2026/05/11 11:45:43.573 +08:00] [INFO] [import.go:1623] ["auto calculate resource related params"] [keyspaceName=SYSTEM] 
[table=t] [thread=3] [maxNode=2] [distsqlScanConcurrency=46] [targetNodeCPU=3] [totalFileSize=180B] [totalRealSize=180GiB] [fileCount=1] [numOfIndexGenKV=0] [indexSizeRatio=0] [amplifyFactor=1] [costTime=3.656917ms]


[2026/05/11 11:50:30.439 +08:00] [INFO] [reorg_util.go:166] ["initialize reorg meta"] [keyspaceName=SYSTEM] 
[category=ddl] [jobID=0] [jobSchema=test] [jobTable=t] [jobType="add index"] [enableDistTask=true] [enableFastReorg=true] [targetScope=dxf_service] [maxNodeCount=80] [tableSizeInBytes=3PiB] [concurrency=3] [batchSize=256] [amplifyFactor=1]

also tested with multiple tasks, they queue and wait too

  • 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.

Add the `dxf-resource-limit` TiDB configuration item to limit DXF local resource usage in Premium Reserved deployments.

Summary by CodeRabbit

  • New Features
    • Added dxf-resource-limit config to cap DXF-usable CPU and memory as a percentage (10–100, default 100); applied only when deploy-mode = "premium_reserved".
  • Bug Fixes / Behavior
    • Config loading/validation tightened: missing values defaulted, out-of-range or mode-mismatched values rejected. Distributed task CPU/memory calculations now respect the configured DXF limit.

Review Change Stack

@ti-chi-bot

ti-chi-bot Bot commented May 9, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 9, 2026
@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds dxf-resource-limit config (default/min/max), implements percentage-based NodeResource limiting, migrates NodeResource storage from handle → storage, applies limiting during domain init, updates callsites and tests, and adjusts Bazel deps.

Changes

DXF Resource Limiting and API Migration

Layer / File(s) Summary
Configuration Schema & Constants
pkg/config/config.go, pkg/config/config.toml.nextgen.example
New dxf-resource-limit config and exported constants: DefDXFResourceLimit=100, MinDXFResourceLimit=10, MaxDXFResourceLimit=100; Config.DXFResourceLimit field and example entry.
Config Load & Validation
pkg/config/config.go, pkg/config/config_test.go
Load defaults DXF limit when absent and rejects present dxf-resource-limit unless deploy-mode = "premium_reserved"; Valid enforces bounds [Min,Max] and requires premium_reserved for non-default values; tests updated for defaults and out-of-bounds cases.
Resource Limiting Logic
pkg/dxf/framework/proto/node.go, pkg/dxf/framework/proto/task_test.go
Add (*NodeResource).LimitDXFResource(limit int) and helper getLimitedDXFCPU to compute ceiling-based percentage CPU limits; memory scaled proportionally, disk preserved; proto tests validate behavior.
Storage-based NodeResource API
pkg/dxf/framework/storage/nodes.go
Add package-level atomic.Pointer[proto.NodeResource] with GetNodeResource/SetNodeResource/GetDXFCPUCount() and an init() seeding default resource; replace prior cpu.GetCPUCount() usages in Init/Recover with GetDXFCPUCount().
Handle Cleanup & Metering
pkg/dxf/framework/handle/handle.go, pkg/dxf/framework/handle/BUILD.bazel
Remove atomic NodeResource globals/accessors and their init from handle; add failpoint injection after metering write; update handle BUILD deps.
Domain Initialization with Resource Limiting
pkg/domain/domain.go
InitDistTaskLoop registers node resources via storage.SetNodeResource; calculateNodeResource applies LimitDXFResource(cfg.DXFResourceLimit), logs total vs DXF-usable CPU/memory, and returns the limited resource.
Callsite & Planner Updates
pkg/ddl/backfilling_dist_scheduler.go, pkg/dxf/importinto/planner.go, pkg/dxf/framework/handle/status.go
Update getRangeSplitter and status fallback to use storage.GetNodeResource() / GetDXFCPUCount() instead of removed handle accessors; add/update imports.
Tests & Verification
pkg/config/config_test.go, pkg/dxf/framework/proto/task_test.go, pkg/dxf/framework/storage/table_test.go, pkg/executor/importer/importer_testkit_test.go, pkg/dxf/framework/integrationtests/*, pkg/dxf/framework/testutil/*
Config tests check default and bounds; proto tests validate limiting math; storage/importer/integration tests replace CPU mock failpoints with storage.SetNodeResource/GetNodeResource and cleanup; MockNodeResource helper added and limited-node recovery scenarios included.
Build / Bazel
pkg/dxf/framework/handle/BUILD.bazel, pkg/dxf/framework/storage/BUILD.bazel, pkg/executor/importer/BUILD.bazel, cmd/tidb-server/BUILD.bazel, pkg/domain/BUILD.bazel
Adjust Bazel deps (remove atomic and //pkg/util/cpu), add storage to importer_test deps, remove handle dep from domain lib, bump tidb-server_test shard_count 6→7.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pingcap/tidb#67313: Both PRs modify pkg/ddl/backfilling_dist_scheduler.go (overlapping getRangeSplitter edits).
  • pingcap/tidb#67124: Related changes to range-splitting and getRangeSplitter usage.

Suggested labels

size/XXL, ok-to-test

Suggested reviewers

  • joechenrh
  • wjhuang2016
  • OliverS929

Poem

🐰 I counted cores with a nimble hop,

DXF trims the shares so tasks may run,
From handle to storage the resources flow,
Percent limits shape CPU and RAM just so,
Tests hop in line — then the tasks hum.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.11% 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 'dxf: add DXF resource limit config' clearly summarizes the main change: introducing a new DXF resource limit configuration option.
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.
Description check ✅ Passed The pull request description is comprehensive and well-structured, including issue reference, clear problem statement, detailed explanation of changes, test evidence, release note, and proper documentation impact checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 9, 2026
@tiprow

tiprow Bot commented May 9, 2026

Copy link
Copy Markdown

Hi @D3Hunter. 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.

Details

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.

@D3Hunter
D3Hunter marked this pull request as ready for review May 9, 2026 15:55
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 9, 2026
@pantheon-ai

pantheon-ai Bot commented May 9, 2026 •

Copy link
Copy Markdown

@D3Hunter I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details.

⏳ This process typically takes 10-30 minutes depending on the complexity of the changes.

ℹ️ Learn more details on Pantheon AI.

@D3Hunter D3Hunter changed the title config, dxf: add DXF resource limit config dxf: add DXF resource limit config May 9, 2026
@D3Hunter

D3Hunter commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 9, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
pkg/config/config_test.go (1)

1097-1108: ⚡ Quick win

Add explicit acceptance tests for boundary values 10 and 100.

Right now only 30 (valid) and 9/101 (invalid) are checked. Adding exact-boundary success cases better locks the [10,100] contract.

Proposed test additions
+	require.NoError(t, os.WriteFile(configFile, []byte(`deploy-mode = "premium_reserved"
+dxf-resource-limit = 10`), 0644))
+	conf = NewConfig()
+	require.NoError(t, conf.Load(configFile))
+	require.Equal(t, 10, conf.DXFResourceLimit)
+	require.NoError(t, conf.Valid())
+
+	require.NoError(t, os.WriteFile(configFile, []byte(`deploy-mode = "premium_reserved"
+dxf-resource-limit = 100`), 0644))
+	conf = NewConfig()
+	require.NoError(t, conf.Load(configFile))
+	require.Equal(t, 100, conf.DXFResourceLimit)
+	require.NoError(t, conf.Valid())
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/config/config_test.go` around lines 1097 - 1108, Add explicit unit tests
to assert boundary acceptance for dxf-resource-limit values 10 and 100: after
writing a config file with deploy-mode = "premium_reserved" and
dxf-resource-limit = 10 (and separately 100), call NewConfig(),
conf.Load(configFile) and assert conf.Valid() returns no error. Reference
NewConfig(), conf.Load(...) and conf.Valid() when adding these two success cases
adjacent to the existing invalid/valid checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/config/config.go`:
- Around line 1398-1404: The deploy-mode gating for dxf-resource-limit is being
enforced too early in Load(): metaData.IsDefined("dxf-resource-limit") and the
check using c.DeployMode can reject configs that are later corrected by CLI
flags in enforceCmdArgs; move or defer the validation so Load() only sets
default c.DXFResourceLimit (using DefDXFResourceLimit) when not defined, and
perform the deploy-mode check after enforceCmdArgs merges CLI overrides (or in a
separate validate/Finalize method called after enforceCmdArgs) so that
c.DeployMode reflects CLI overrides before enforcing that dxf-resource-limit is
allowed.

In `@pkg/ddl/backfilling_dist_scheduler.go`:
- Around line 777-778: diststorage.GetNodeResource() may return nil or a nodeRc
with TotalCPU == 0, and the call to
CalRangeSize(nodeRc.TotalMem/int64(nodeRc.TotalCPU), regionSplitSize,
regionSplitKeys) will panic; add a guard after calling
diststorage.GetNodeResource() to check nodeRc != nil and nodeRc.TotalCPU > 0,
and if the guard fails, handle gracefully (return an error, skip scheduling, or
use a safe default per-core memory value) before calling CalRangeSize; update
any callers that rely on the result of CalRangeSize to handle the new
error/early-return path.

In `@pkg/dxf/importinto/planner.go`:
- Around line 704-705: Validate the node resource before computing per-core
memory: check that storage.GetNodeResource() does not return nil and that
nodeRc.TotalCPU is non-zero before using nodeRc.TotalMem/int64(nodeRc.TotalCPU)
in the call to external.CalRangeSize; if nil or zero, return an error or take a
safe fallback (e.g., log via the planner's logger and abort the operation or use
a configured default CPU value) so that the calculations for rangeSize/rangeKeys
do not panic. Ensure checks are placed immediately after calling
GetNodeResource() and propagate/handle the error in the surrounding function
that calls external.CalRangeSize.

---

Nitpick comments:
In `@pkg/config/config_test.go`:
- Around line 1097-1108: Add explicit unit tests to assert boundary acceptance
for dxf-resource-limit values 10 and 100: after writing a config file with
deploy-mode = "premium_reserved" and dxf-resource-limit = 10 (and separately
100), call NewConfig(), conf.Load(configFile) and assert conf.Valid() returns no
error. Reference NewConfig(), conf.Load(...) and conf.Valid() when adding these
two success cases adjacent to the existing invalid/valid checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ac949f63-03b0-44c8-9353-36d3fe55347b

📥 Commits

Reviewing files that changed from the base of the PR and between faa0736 and 2ca3e6a.

📒 Files selected for processing (11)
  • pkg/config/config.go
  • pkg/config/config.toml.nextgen.example
  • pkg/config/config_test.go
  • pkg/ddl/backfilling_dist_scheduler.go
  • pkg/domain/domain.go
  • pkg/dxf/framework/handle/handle.go
  • pkg/dxf/framework/proto/node.go
  • pkg/dxf/framework/proto/task_test.go
  • pkg/dxf/framework/storage/nodes.go
  • pkg/dxf/framework/storage/table_test.go
  • pkg/dxf/importinto/planner.go
💤 Files with no reviewable changes (1)
  • pkg/dxf/framework/handle/handle.go

Comment thread pkg/config/config.go
Comment thread pkg/ddl/backfilling_dist_scheduler.go
Comment thread pkg/dxf/importinto/planner.go
@codecov

codecov Bot commented May 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.72414% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.7930%. Comparing base (86b0785) to head (71194f9).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #68251        +/-   ##
================================================
+ Coverage   77.7307%   78.7930%   +1.0623%     
================================================
  Files          1990       2003        +13     
  Lines        551899     562108     +10209     
================================================
+ Hits         428995     442902     +13907     
+ Misses       121984     116936      -5048     
- Partials        920       2270      +1350     
Flag Coverage Δ
integration 47.6774% <51.7241%> (+7.8756%) ⬆️

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

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/dxf/framework/handle/status.go`:
- Around line 117-118: The warning message is misleading: the code calls
storage.GetDXFCPUCount() but logs "use local node CPU count instead"; update the
log invocation (logutil.BgLogger().Warn) to mention that it's falling back to
the DXF-configured CPU count or dxf-resource-limit (referencing
storage.GetDXFCPUCount()) so the log accurately reflects the actual fallback
source.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f5dd7fab-65af-42a6-b4c1-60deaafec6b9

📥 Commits

Reviewing files that changed from the base of the PR and between aff718f and 7b96214.

📒 Files selected for processing (5)
  • pkg/dxf/framework/handle/BUILD.bazel
  • pkg/dxf/framework/handle/status.go
  • pkg/dxf/framework/handle/status_testkit_test.go
  • pkg/dxf/framework/storage/nodes.go
  • pkg/dxf/framework/testutil/table_util.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/dxf/framework/handle/BUILD.bazel
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/dxf/framework/storage/nodes.go

Comment thread pkg/dxf/framework/handle/status.go Outdated
@ingress-bot

Copy link
Copy Markdown

🔍 Starting code review for this PR...

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 10, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@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: 6
  • Summary-only findings (no inline anchor): 0
Findings (highest risk first)

⚠️ [Major] (3)

  1. dxf-resource-limit naming and docs overstate scope beyond CPU and memory (pkg/config/config.toml.nextgen.example:19, pkg/config/config.go:100, pkg/dxf/framework/proto/node.go:50, pkg/dxf/framework/proto/node.go:57)
  2. Per-node DXF CPU limit propagation breaks slot admission invariants on heterogeneous nodes (pkg/dxf/framework/storage/nodes.go:67, pkg/dxf/framework/storage/task_table.go:293, pkg/dxf/framework/scheduler/nodes.go:155, pkg/dxf/framework/scheduler/slots.go:206)
  3. Unversioned cpu_count contract change breaks mixed-version slot admission (pkg/dxf/framework/storage/nodes.go:67, pkg/dxf/framework/storage/task_table.go:293, pkg/dxf/framework/scheduler/nodes.go:155, pkg/dxf/framework/scheduler/slots.go:206)

🟡 [Minor] (3)

  1. dxf-resource-limit policy is split across Load and Valid with non-equivalent gates (pkg/config/config.go:1402, pkg/config/config.go:1479, pkg/config/config_test.go:1092)
  2. Fallback log message now contradicts the switched CPU source (pkg/dxf/framework/handle/status.go:117, pkg/dxf/framework/handle/status.go:118)
  3. New helper LimitDXFCPU expands exported API surface without external consumers (pkg/dxf/framework/proto/node.go:61)

🧹 [Nit] (1)

  1. TestTaskBaseGetRuntimeSlots now mixes two behaviors under one intent label (pkg/dxf/framework/proto/task_test.go:76, pkg/dxf/framework/proto/task_test.go:91)

Comment thread pkg/config/config.toml.nextgen.example
Comment thread pkg/dxf/framework/storage/nodes.go
Comment thread pkg/config/config.go
Comment thread pkg/dxf/framework/handle/status.go
Comment thread pkg/dxf/framework/proto/node.go Outdated
Comment thread pkg/dxf/framework/proto/task_test.go

@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: 8
  • Inline comments: 7
  • Summary-only findings (no inline anchor): 0
Findings (highest risk first)

⚠️ [Major] (5)

  1. Range-splitting now bypasses injected node-resource boundaries and depends on storage global state (pkg/ddl/backfilling_dist_scheduler.go:70, pkg/ddl/backfilling_dist_scheduler.go:777, pkg/dxf/importinto/planner.go:704, pkg/dxf/framework/storage/nodes.go:37)
  2. dxf-resource-limit naming/documentation implies all resources are limited, but disk stays unbounded (pkg/dxf/framework/proto/node.go:57, pkg/config/config.toml.nextgen.example:19, pkg/config/config.go:100)
  3. DXF CPU limit rounds up and exceeds configured percentage (pkg/dxf/framework/proto/node.go:61, pkg/domain/domain.go:1178, pkg/dxf/framework/storage/nodes.go:67)
  4. Unversioned cpu_count semantic switch makes mixed-version scheduling non-repeatable during rollout (pkg/dxf/framework/storage/nodes.go:67, pkg/dxf/framework/handle/status.go:120, pkg/dxf/framework/scheduler/nodes.go:157)
  5. Range-splitting reads node resource from storage singleton instead of local planner/scheduler contracts (pkg/dxf/importinto/planner.go:704, pkg/ddl/backfilling_dist_scheduler.go:777, pkg/dxf/framework/storage/nodes.go:34)

🟡 [Minor] (3)

  1. Fallback status log text no longer matches the returned CPU semantics (pkg/dxf/framework/handle/status.go:117, pkg/dxf/framework/handle/status.go:118)
  2. dxf-resource-limit wording overstates scope as all resources while disk remains unbounded (pkg/config/config.toml.nextgen.example:19, pkg/dxf/framework/proto/node.go:50, pkg/dxf/framework/proto/node.go:57)
  3. DXF resource limit does not constrain disk budget (pkg/dxf/framework/proto/node.go:51, pkg/dxf/framework/proto/node.go:86)

Comment thread pkg/ddl/backfilling_dist_scheduler.go
Comment thread pkg/dxf/framework/proto/node.go
Comment thread pkg/dxf/framework/proto/node.go
Comment thread pkg/dxf/framework/storage/nodes.go
Comment thread pkg/dxf/importinto/planner.go
Comment thread pkg/dxf/framework/handle/status.go
Comment thread pkg/dxf/framework/proto/node.go
@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 10, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 10, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 11, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented May 11, 2026

Copy link
Copy Markdown

@D3Hunter: 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.

Details

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.

@D3Hunter

Copy link
Copy Markdown
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 May 11, 2026
@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 11, 2026
@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

4 similar comments
@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 12, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 12, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-05-11 06:15:35.68941553 +0000 UTC m=+73504.222194859: ☑️ agreed by joechenrh.
  • 2026-05-12 05:30:01.059286201 +0000 UTC m=+157169.592065521: ☑️ agreed by GMHDBJD.

@ti-chi-bot

ti-chi-bot Bot commented May 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

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 May 13, 2026
@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@D3Hunter

Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot
ti-chi-bot Bot merged commit 5634bd6 into pingcap:master May 13, 2026
39 checks passed
@D3Hunter
D3Hunter deleted the codex/dxf-resource-limit branch May 13, 2026 07:10
yongman pushed a commit to yongman/tidb that referenced this pull request Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants