Skip to content

ttl: introduce starter ttl worker#69672

Open
ystaticy wants to merge 2 commits into
pingcap:masterfrom
ystaticy:ttl_tidb_worker
Open

ttl: introduce starter ttl worker#69672
ystaticy wants to merge 2 commits into
pingcap:masterfrom
ystaticy:ttl_tidb_worker

Conversation

@ystaticy

@ystaticy ystaticy commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What changed and how does it work?

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

Summary by CodeRabbit

  • New Features
    • Added integration to coordinate TTL table registration/removal and TTL job recycling with an external workload manager.
    • Nodes now conditionally run TTL job processing based on their external workload role.
    • TTL job enable/disable changes now propagate via a dedicated update hook.
  • Bug Fixes
    • TTL table registration/cleanup now occurs consistently only on the appropriate workload master role, avoiding mismatched state.
    • Improved TTL job completion handling so completed work can be recycled correctly when the node is the TTL task worker.

Signed-off-by: ystaticy <y_static_y@sina.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

[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 terry1purcell, wjhuang2016 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.

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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 5, 2026
@coderabbitai

coderabbitai Bot commented Jul 5, 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

Run ID: 916c1643-dbaa-45ea-acc1-d7bb2865495e

📥 Commits

Reviewing files that changed from the base of the PR and between 7773282 and af54562.

📒 Files selected for processing (1)
  • pkg/ttl/ttlworker/job_manager.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/ttl/ttlworker/job_manager.go

📝 Walkthrough

Walkthrough

This PR threads an extworkload.Manager through startup, session bootstrap, DDL/domain initialization, TTL sysvars, and the TTL job manager. It adds role-based TTL table registration/deletion, TTL job enable propagation, and TTL task recycling.

Changes

External workload manager wiring

Layer / File(s) Summary
Server startup and session bootstrap
cmd/tidb-server/main.go, pkg/session/session.go, pkg/session/tidb.go, pkg/session/session_test.go, pkg/session/bootstrap_test.go, pkg/session/BUILD.bazel
createStoreDDLOwnerMgrAndDomain returns an external workload manager, session bootstrap can accept it, and domain creation applies it through domainCreateOptions.
DDL options and TTL table hooks
pkg/ddl/options.go, pkg/ddl/ddl.go, pkg/ddl/create_table.go, pkg/ddl/ttl.go, pkg/ddl/ttl_test.go, pkg/ddl/BUILD.bazel
DDL carries the manager in Options/ddlCtx, and TTL table create/change/remove flows register or delete external workload entries with role checks and tests.
Domain manager and TTL job gating
pkg/domain/domain.go, pkg/domain/domain_sysvars.go, pkg/domain/domain_test.go, pkg/domain/BUILD.bazel, pkg/sessionctx/variable/sysvar.go, pkg/sessionctx/variable/tidb_vars.go
Domain stores the manager, wires it into DDL init, gates TTL job manager startup by role, and propagates TiDBTTLJobEnable changes through a new hook.
TTL JobManager owner election and recycling
pkg/ttl/ttlworker/job_manager.go, pkg/ttl/ttlworker/job_manager_test.go, pkg/ttl/ttlworker/BUILD.bazel
TTL job manager campaigns for ownership when needed and recycles finished TTL tasks via the external workload manager.
Build and test dependencies
pkg/ddl/BUILD.bazel, pkg/domain/BUILD.bazel, pkg/session/BUILD.bazel, pkg/ttl/ttlworker/BUILD.bazel
Bazel targets add the new external workload and supporting dependencies used by the updated code and tests.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • pingcap/tidb#68510: Adds the external workload controller framework and manager APIs that this PR threads into DDL, domain, session, and TTL job handling.

Suggested reviewers: yudongusa, YuJuncen, ChangRui-Ryan

Poem

A bunny hops through startup light,
With TTL tasks set just right.
The master nods, the workers spin,
And workload chores now flow within.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is mostly template text with placeholders and no substantive issue, problem, change, test, or release-note details. Fill in the issue number, problem summary, implementation details, test checklist, side effects, documentation, and a meaningful release note.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly summarizes the main change: introducing a starter TTL worker.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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"
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"


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.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.62385% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.9537%. Comparing base (b2c55fb) to head (af54562).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #69672        +/-   ##
================================================
- Coverage   76.3268%   75.9537%   -0.3732%     
================================================
  Files          2041       2077        +36     
  Lines        560581     578846     +18265     
================================================
+ Hits         427874     439655     +11781     
- Misses       131806     137179      +5373     
- Partials        901       2012      +1111     
Flag Coverage Δ
integration 45.7867% <48.6238%> (+6.0814%) ⬆️

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

Components Coverage Δ
dumpling 60.4471% <ø> (ø)
parser ∅ <ø> (∅)
br 63.9699% <ø> (+1.2485%) ⬆️
🚀 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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
pkg/session/session.go (1)

4360-4361: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Attach the external workload manager before bootstrap creates the domain
pkg/session/session.go:4360-4396
runInBootstrapSession(store, ver) creates and caches the domain first; the later domap.getWithEtcdClient(..., domainCreateOptions{extWorkloadMgr: extWorkloadMgr}) call then returns the cached domain without applying SetExternalWorkloadManager. That leaves bootstrap/upgrade runs (ver < currentBootstrapVersion) without the external workload manager attached. Move the wiring ahead of bootstrap, or pass the manager through the bootstrap session path.

🤖 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/session/session.go` around lines 4360 - 4361, Attach the external
workload manager before bootstrap initializes the domain, because
runInBootstrapSession(store, ver) caches the domain too early and the later
domap.getWithEtcdClient(..., domainCreateOptions{extWorkloadMgr:
extWorkloadMgr}) path won’t reapply SetExternalWorkloadManager. Update the ver <
currentBootstrapVersion flow in session/session.go so extWorkloadMgr is wired
into the bootstrap session path itself, or ensure it is passed into the domain
creation path before the domain is cached.
pkg/sessionctx/variable/sysvar.go (1)

3218-3227: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Local flag is mutated before the external propagation can fail, causing inconsistent state on error.

vardef.EnableTTLJob.Store(enable) happens unconditionally, then UpdateExternalWorkloadTTLJobEnable is called and its error is returned. If the external call fails, SET GLOBAL tidb_ttl_job_enable=... reports an error to the user, but vardef.EnableTTLJob (consulted elsewhere, e.g. TTL table registration in pkg/ddl/ttl.go) has already changed — the client sees a failure while the internal state actually flipped.

🛠️ Suggested fix: only commit local state after the external call succeeds
 {Scope: vardef.ScopeGlobal, Name: vardef.TiDBTTLJobEnable, Value: BoolToOnOff(vardef.DefTiDBTTLJobEnable), Type: vardef.TypeBool, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
 	enable := TiDBOptOn(s)
-	vardef.EnableTTLJob.Store(enable)
-	if UpdateExternalWorkloadTTLJobEnable != nil {
-		return UpdateExternalWorkloadTTLJobEnable(ctx, enable)
-	}
+	if UpdateExternalWorkloadTTLJobEnable != nil {
+		if err := UpdateExternalWorkloadTTLJobEnable(ctx, enable); err != nil {
+			return err
+		}
+	}
+	vardef.EnableTTLJob.Store(enable)
 	return nil
 }, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
🤖 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/sessionctx/variable/sysvar.go` around lines 3218 - 3227, The
TiDBTTLJobEnable SetGlobal handler mutates vardef.EnableTTLJob before
UpdateExternalWorkloadTTLJobEnable can fail, leaving local state inconsistent
with the returned error. In the SetGlobal closure for TiDBTTLJobEnable, move the
vardef.EnableTTLJob.Store(enable) update so it only happens after
UpdateExternalWorkloadTTLJobEnable(ctx, enable) succeeds, and preserve the
current error return path if the external propagation fails. Keep the change
localized to the TiDBTTLJobEnable sysvar registration and use the existing
vardef.EnableTTLJob and UpdateExternalWorkloadTTLJobEnable symbols to ensure the
in-memory flag only reflects a successful global update.
pkg/ddl/ttl.go (1)

79-104: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Propagate table-level TTL disable to the external controller ALTER TABLE ... TTL_ENABLE='OFF' clears the local TTL flag, but this path only calls registerTTLTableToExternalWorkload, which returns immediately for disabled TTL. The previous external record is never removed, so the controller can keep treating the table as enabled.

🤖 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/ddl/ttl.go` around lines 79 - 104, The TTL update path in ttl.go only
re-registers the table with the external workload controller, so disabling TTL
via ALTER TABLE ... TTL_ENABLE='OFF' leaves stale state behind. In the TTL
update flow around updateVersionAndTableInfo and
jobCtx.oldDDLCtx.registerTTLTableToExternalWorkload, add an explicit branch for
tblInfo.TTLInfo.Enable == false that removes/unregisters the table from the
external controller before returning, while keeping the existing register path
for enabled TTL.
🧹 Nitpick comments (2)
pkg/domain/domain.go (1)

2891-2907: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a comment explaining the role-gating semantics.

shouldStartTTLJobManager encodes non-obvious behavior: when external workload is enabled, the TTL job manager only starts for the TTLTaskWorker role and is skipped for Master/other roles, whereas it always starts when external workload is disabled. This inversion (master normally runs it, but not under Starter mode) is easy to misread; a short comment would help future maintainers.

📝 Suggested comment
+// shouldStartTTLJobManager reports whether this instance should run the local
+// TTL job manager. When external workload coordination is disabled, every
+// instance runs it as before. When enabled, only the TTL task worker role
+// runs it locally; other roles (e.g. master) delegate TTL job execution to
+// the dedicated TTL task worker instances.
 func (do *Domain) shouldStartTTLJobManager() bool {

As per coding guidelines, "Comments SHOULD explain non-obvious intent, constraints, invariants... SHOULD NOT restate what the code already makes clear."

🤖 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/domain/domain.go` around lines 2891 - 2907, Add a brief comment near
shouldStartTTLJobManager that explains the role-gating intent: TTL job manager
starts unconditionally when external workload is disabled, but when extworkload
is enabled it only starts for the TTLTaskWorker role and is skipped for
Master/other roles. Keep the comment focused on this non-obvious Starter mode
inversion so future readers understand why StartTTLJobManager delegates to
shouldStartTTLJobManager.

Source: Coding guidelines

pkg/ddl/ttl.go (1)

109-135: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider a bounded timeout for the external controller calls.

registerTTLTableToExternalWorkload/deleteTTLTableFromExternalWorkload forward jobCtx.ctx directly to RegisterTTLTask/DeleteTTLTableInfo with no deadline. If the external controller is slow/unresponsive, these calls can stall the DDL job worker for an unbounded time (this matters even more given onCreateTable treats a failure as fatal — see companion comment in create_table.go).

🤖 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/ddl/ttl.go` around lines 109 - 135, Both
registerTTLTableToExternalWorkload and deleteTTLTableFromExternalWorkload pass
the caller context straight into external controller calls with no deadline,
which can block DDL work indefinitely. Wrap the manager.RegisterTTLTask and
manager.DeleteTTLTableInfo calls with a bounded timeout context inside these
helpers, and ensure the timeout is canceled promptly after the call. Keep the
change localized to externalWorkloadMaster usage so the behavior is applied
consistently for both TTL registration and deletion.
🤖 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/ddl/create_table.go`:
- Around line 252-255: The CREATE TABLE flow currently treats
registerTTLTableToExternalWorkload as fatal, which can abort the DDL job after
the table has already been created and versioned. Update the create table path
in create_table.go so the external workload registration failure is handled
non-fatally, matching the behavior in onTTLInfoChange in ttl.go: log a warning
with the error and continue so job.FinishTableJob can still run. Keep the fix
localized around registerTTLTableToExternalWorkload and preserve the existing
DDL transaction flow.

In `@pkg/domain/domain.go`:
- Around line 235-238: The `// only used for nextgen` comment is now misleading
because it also appears to describe `extWorkloadMgr`, which belongs to a
different feature path. Update the comment near
`crossKSSessMgr`/`crossKSSessFactoryGetter` in `domain.go` so it applies only to
those nextgen-specific fields, and move or add a separate comment for
`extWorkloadMgr` that reflects its Starter deploy/external-workload purpose.

---

Outside diff comments:
In `@pkg/ddl/ttl.go`:
- Around line 79-104: The TTL update path in ttl.go only re-registers the table
with the external workload controller, so disabling TTL via ALTER TABLE ...
TTL_ENABLE='OFF' leaves stale state behind. In the TTL update flow around
updateVersionAndTableInfo and
jobCtx.oldDDLCtx.registerTTLTableToExternalWorkload, add an explicit branch for
tblInfo.TTLInfo.Enable == false that removes/unregisters the table from the
external controller before returning, while keeping the existing register path
for enabled TTL.

In `@pkg/session/session.go`:
- Around line 4360-4361: Attach the external workload manager before bootstrap
initializes the domain, because runInBootstrapSession(store, ver) caches the
domain too early and the later domap.getWithEtcdClient(...,
domainCreateOptions{extWorkloadMgr: extWorkloadMgr}) path won’t reapply
SetExternalWorkloadManager. Update the ver < currentBootstrapVersion flow in
session/session.go so extWorkloadMgr is wired into the bootstrap session path
itself, or ensure it is passed into the domain creation path before the domain
is cached.

In `@pkg/sessionctx/variable/sysvar.go`:
- Around line 3218-3227: The TiDBTTLJobEnable SetGlobal handler mutates
vardef.EnableTTLJob before UpdateExternalWorkloadTTLJobEnable can fail, leaving
local state inconsistent with the returned error. In the SetGlobal closure for
TiDBTTLJobEnable, move the vardef.EnableTTLJob.Store(enable) update so it only
happens after UpdateExternalWorkloadTTLJobEnable(ctx, enable) succeeds, and
preserve the current error return path if the external propagation fails. Keep
the change localized to the TiDBTTLJobEnable sysvar registration and use the
existing vardef.EnableTTLJob and UpdateExternalWorkloadTTLJobEnable symbols to
ensure the in-memory flag only reflects a successful global update.

---

Nitpick comments:
In `@pkg/ddl/ttl.go`:
- Around line 109-135: Both registerTTLTableToExternalWorkload and
deleteTTLTableFromExternalWorkload pass the caller context straight into
external controller calls with no deadline, which can block DDL work
indefinitely. Wrap the manager.RegisterTTLTask and manager.DeleteTTLTableInfo
calls with a bounded timeout context inside these helpers, and ensure the
timeout is canceled promptly after the call. Keep the change localized to
externalWorkloadMaster usage so the behavior is applied consistently for both
TTL registration and deletion.

In `@pkg/domain/domain.go`:
- Around line 2891-2907: Add a brief comment near shouldStartTTLJobManager that
explains the role-gating intent: TTL job manager starts unconditionally when
external workload is disabled, but when extworkload is enabled it only starts
for the TTLTaskWorker role and is skipped for Master/other roles. Keep the
comment focused on this non-obvious Starter mode inversion so future readers
understand why StartTTLJobManager delegates to shouldStartTTLJobManager.
🪄 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: 054f938c-9624-4889-9304-62705ac19645

📥 Commits

Reviewing files that changed from the base of the PR and between b2c55fb and 7773282.

📒 Files selected for processing (21)
  • cmd/tidb-server/main.go
  • pkg/ddl/BUILD.bazel
  • pkg/ddl/create_table.go
  • pkg/ddl/ddl.go
  • pkg/ddl/options.go
  • pkg/ddl/ttl.go
  • pkg/ddl/ttl_test.go
  • pkg/domain/BUILD.bazel
  • pkg/domain/domain.go
  • pkg/domain/domain_sysvars.go
  • pkg/domain/domain_test.go
  • pkg/session/BUILD.bazel
  • pkg/session/bootstrap_test.go
  • pkg/session/session.go
  • pkg/session/session_test.go
  • pkg/session/tidb.go
  • pkg/sessionctx/variable/sysvar.go
  • pkg/sessionctx/variable/tidb_vars.go
  • pkg/ttl/ttlworker/BUILD.bazel
  • pkg/ttl/ttlworker/job_manager.go
  • pkg/ttl/ttlworker/job_manager_test.go

Comment thread pkg/ddl/create_table.go
Comment on lines +252 to +255
if err := w.registerTTLTableToExternalWorkload(jobCtx.ctx, tbInfo); err != nil {
return ver, errors.Trace(err)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

External workload registration failure aborts CREATE TABLE — inconsistent with ttl.go and risks cascading DDL outages.

Unlike onTTLInfoChange in pkg/ddl/ttl.go (which logs a warning and continues on registration failure), this path returns the error and prevents job.FinishTableJob from being called, effectively failing/retrying the whole CREATE TABLE DDL job whenever the external workload controller is unavailable or slow. Since table creation, schema version bump, and event notification have already happened in this transaction, an external RPC failure here couples DDL availability for TTL tables to an external dependency (with no external-call hazard mitigation such as short timeout/circuit breaker visible).

🐛 Suggested fix: make external registration failure non-fatal, consistent with ttl.go
-	if err := w.registerTTLTableToExternalWorkload(jobCtx.ctx, tbInfo); err != nil {
-		return ver, errors.Trace(err)
-	}
+	if err := w.registerTTLTableToExternalWorkload(jobCtx.ctx, tbInfo); err != nil {
+		logutil.DDLLogger().Warn("failed to register TTL table to external workload controller",
+			zap.Int64("tableID", tbInfo.ID),
+			zap.Error(err))
+	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if err := w.registerTTLTableToExternalWorkload(jobCtx.ctx, tbInfo); err != nil {
return ver, errors.Trace(err)
}
if err := w.registerTTLTableToExternalWorkload(jobCtx.ctx, tbInfo); err != nil {
logutil.DDLLogger().Warn("failed to register TTL table to external workload controller",
zap.Int64("tableID", tbInfo.ID),
zap.Error(err))
}
🤖 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/ddl/create_table.go` around lines 252 - 255, The CREATE TABLE flow
currently treats registerTTLTableToExternalWorkload as fatal, which can abort
the DDL job after the table has already been created and versioned. Update the
create table path in create_table.go so the external workload registration
failure is handled non-fatally, matching the behavior in onTTLInfoChange in
ttl.go: log a warning with the error and continue so job.FinishTableJob can
still run. Keep the fix localized around registerTTLTableToExternalWorkload and
preserve the existing DDL transaction flow.

Comment thread pkg/domain/domain.go
Comment on lines 235 to +238
// only used for nextgen
crossKSSessMgr *crossks.Manager
crossKSSessFactoryGetter func(string, validatorapi.Validator) pools.Factory
extWorkloadMgr extworkload.Manager

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Misleading comment scope for new field.

extWorkloadMgr is appended directly under the // only used for nextgen comment, which was written to describe crossKSSessMgr/crossKSSessFactoryGetter. Per the extworkload package doc, the manager is created "in Starter deploy mode when [external-workload] is enabled" — a different concept from "nextgen" kernel type. Leaving it grouped under this comment will mislead future readers into thinking extWorkloadMgr is nextgen-only.

✏️ Proposed fix
 	// only used for nextgen
 	crossKSSessMgr           *crossks.Manager
 	crossKSSessFactoryGetter func(string, validatorapi.Validator) pools.Factory
-	extWorkloadMgr           extworkload.Manager
+
+	// extWorkloadMgr coordinates background workloads (TTL, GC, auto-analyze) with
+	// an external workload controller when running in Starter deploy mode.
+	extWorkloadMgr extworkload.Manager
 }

As per coding guidelines, "Comments SHOULD explain non-obvious intent... SHOULD NOT restate what the code already makes clear" — here the existing comment inaccurately extends to unrelated code.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// only used for nextgen
crossKSSessMgr *crossks.Manager
crossKSSessFactoryGetter func(string, validatorapi.Validator) pools.Factory
extWorkloadMgr extworkload.Manager
// only used for nextgen
crossKSSessMgr *crossks.Manager
crossKSSessFactoryGetter func(string, validatorapi.Validator) pools.Factory
// extWorkloadMgr coordinates background workloads (TTL, GC, auto-analyze) with
// an external workload controller when running in Starter deploy mode.
extWorkloadMgr extworkload.Manager
🤖 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/domain/domain.go` around lines 235 - 238, The `// only used for nextgen`
comment is now misleading because it also appears to describe `extWorkloadMgr`,
which belongs to a different feature path. Update the comment near
`crossKSSessMgr`/`crossKSSessFactoryGetter` in `domain.go` so it applies only to
those nextgen-specific fields, and move or add a separate comment for
`extWorkloadMgr` that reflects its Starter deploy/external-workload purpose.

Source: Coding guidelines

Signed-off-by: ystaticy <y_static_y@sina.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.


Notice: To remove the do-not-merge/needs-tests-checked label, please finished the tests then check the finished items in description.

For example:

Tests <!-- At least one of them must be included. -->

- [x] Unit test
- [ ] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No code

‼️ Must keep the HTML comments <!-- At least one of them must be included. -->

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ystaticy

ystaticy commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

@ti-chi-bot

ti-chi-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

@ystaticy: 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
pull-integration-realcluster-test-next-gen af54562 link true /test pull-integration-realcluster-test-next-gen

Full PR test history. Your PR dashboard.

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

do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. 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.

1 participant