Repository navigation
Description
Description
mo-service -max-processor N silently leaves the runtime and planner worker limit unchanged. The flag is inspected before command-line parsing, while its value is still the registered default 0.
Environment
mainatdd2499cdcdf2722848851d4debca6cd6c66b4751,perf: bound regular-index backfill work (#32039).- Fresh native build, macOS/arm64, Go
1.27.1,12logical CPUs. Binary metadata and SQLgit_version()agree. - Owned native
2 CN / 1 TN / 1 Log service / Proxylauncher. Both CNs share the launcher process. - Found while preparing the high-concurrency boundary for [Bug]: excessive non-cache off-heap residency during streaming mo-dump (4GiB export uses ~7.8GiB) #30575. No source changes or unrelated workloads were involved.
Reproduction
Start a fresh owned cluster with a normal launcher manifest and conflicting explicit limits.
GOMAXPROCS=4 mo-service -launch <test-launch.toml> -with-proxy -max-processor 24Observe the runtime through the existing QueryService GOMAXPROCS command with request value 0. On a sufficiently large persisted table, also inspect EXPLAIN PHYPLAN SELECT * FROM wide with max_dop=0.
Actual Result
- The process command line includes
-max-processor 24. - Startup reports
runtime.GOMAXPROCS(4)and keeps4. - A QueryService read returns
4. - The physical scan uses
mcpu: 4and four normal scan scopes. - As a control, sending the existing QueryService
GOMAXPROCScommand with24to the same process changes the next read to24. This confirms that the runtime can accept the requested value and that the CLI path is the missing transition.
The control response sequence was read=4, set(24) previous=4, read=24. A second CN read also returned 24, as expected for the shared launcher process.
Expected Result
An explicit supported -max-processor value should be applied after parsing, or rejected with a clear error. It must not silently retain a conflicting inherited limit. Runtime/planner worker evidence must agree with the accepted startup configuration.
Code Evidence
cmd/mo-service/main.go registers maxProcessor with default 0, then executes the following order.
func main() {
if *maxProcessor > 0 {
system.SetGoMaxProcs(*maxProcessor)
}
flag.Parse()
// ...
}The only read of this flag is before flag.Parse(). The positive branch is unreachable for normal CLI input because the registered pointer still contains 0. Compile obtains its worker budget from system.GoMaxProcs(), so the ignored setting also affects query planning. The dynamic-cluster launcher passes this flag for its configured CPU count as well.
Scope And Suggested Regression
This is a separate startup-configuration bug. #30575 remains responsible for streaming payload residency.
Use conflicting environment/CLI limits and assert the runtime value after real startup. Cover a lower explicit value, a higher explicit value, omitted/zero options and the dynamic launcher. A command-line-string assertion alone would miss this defect.
Searched open and closed issues for max-processor, maxProcessor and GOMAXPROCS with flag. No matching report was found.
Activity
fix(mo-service): apply max-processor after flag parsing (#32337)
XuPeng-SH commentedon Nov 6, 2026
QA 交接:PR #32337 已于 2026-11-06 14:40:17 UTC 合入 main,merge SHA
bfdf875816929653ad2ff3e3c403943c7afc4645,最终 PR headc4a0dde1645e34a41fb2bc4d39422ad0cb841d5a。修复范围:在
flag.Parse()之后应用正数-max-processor,通过现有 setter 同时更新 Go runtime 和system.GoMaxProcs()缓存,供编译器读取 worker capacity。省略、0 和负数继续保留初始化策略。动态 CN 子进程命令仅提取为函数,生成参数保持等价。本项不包含 #30575 的流式载荷驻留修复,也不承诺物理 DOP 或性能线性提升。证据与限制:
dd2499cdcdf2722848851d4debca6cd6c66b4751,没有发现适用于本次修复的当前反例或未完成开发 follow-up。dfc3ab0e382d7c21ca66aa1a03744b0c48c9d7ac加五文件补丁上完成 pre-fix 失败/post-fix 通过、cmd/mo-service 169 项无失败/跳过,以及限定范围 err-check/SCA。私有服务两阶段 startup runtime/cache 为 4/4 与 8/8,20,000 行查询 COUNT/SUM 与独立公式一致,QueryService 为 read 8 / set previous 8 / read 6;服务退出和 TCP/UDP 清理报告通过。两阶段物理扫描预算均为 1,不能据此声称 DOP 扩展或性能收益。6a37add27989f83c9e60d8ed61d71115e8745555报告 Linux Go 1.27.1 的 169 项测试、单 CPU affinity、四项旧代码失败对照及 vet/格式检查通过;其初次依赖准备超时发生在测试前,后续恢复后成功。非 Linux 和作者整服务 SQL/RPC 未由评审独立复跑。Mergify 另记录最终合并门禁 CI Required 成功,旧 head 逐项结果不能冒充最终 head 重跑。本轮未运行本地/集群测试,转测不代表验收通过。建议 QA 在上述 merge 或包含它的官方构建上用冲突的环境值和 CLI 参数核验:更低/更高正值覆盖 runtime 与缓存,省略/0/负值保留真实初始化对照,动态 launcher 的实际子进程收到并应用 CpuCount,Linux 单 CPU affinity/cpuset 与原报告 macOS/arm64 场景均覆盖。尽量在 QueryService 调用前记录 runtime/cache,避免 read(0) 经 setter 重同步缓存而掩盖启动状态。提交的动态参数回归运行真实 main 入口但停在缺失配置处、排除了 debug listener,完整动态服务启动/重启仍可补测。查询结果正确性、可用 worker budget 和实际物理 DOP 应分别记录,不把“配置上限为 N”写成“每条查询使用 N 路并行”。
按已合并修复范围交由 @Ariznawlll 转测,保留 issue 开放,等待 QA 结论。
slyunnn commentedon Nov 9, 2026
Regression and extended verification for #32078 (2026-11-09)
Verification Environment
origin/mainat test start,6a2b29954749d5a47820ed429cfa8a6c4793682f—fix(parser): allow native PREPARE of DESC/DESCRIBE (#32399). A fresh native build, binary metadata and SQLgit_version()agreed.1.27.1, original macOSarm64platform with12logical CPUs, plus Linuxamd64with an actual single-CPU affinity subprocess. Linux targeted execution used an isolated environment because the available Actions entries had no matching native-startup selection.2 CN / 1 TN / 1 Log service / Proxyfirst in one native launcher process, then with two independently launched CN child processes. Proxy127.0.0.1:6001, CN1127.0.0.1:16001and CN2127.0.0.1:16002were connectable and each executed actual SQL. Clients used PyMySQL TCPCOM_QUERYand native Go QueryService RPC.What Was Covered
0and negative options preserved the observed initialization baseline. Runtime andsystem.GoMaxProcs()were witnessed before any QueryService read could resynchronize the cache.8focused Linux test/subtest results passed. The Linux-only case was skipped on macOS and executed successfully on Linux.165and62test/subtest passes. A pre-fix ordering overlay failed lower/higher and dynamic-child assertions with stale runtime/cache values of4.GOMAXPROCS=4and CLI values24and2produced the requested startup transitions and double-CN RPC readings. Checked RPC set/previous/read/restore behavior.196,608-row wide-tableCOUNT/SUMandEXPLAIN PHYPLAN SELECT *ran through all three endpoints under both limits. Physical scans selectedmcpu: 1in this fixture. No DOP expansion or linear speedup is claimed.cpu-count=24. Changing one child's runtime left the other at24. Each CN was stopped and restarted through the launcher, replacement PIDs were verified, and both new children again applied24. Query results remained correct through all three endpoints after each restart.Findings
Fix
bfdf875816929653ad2ff3e3c403943c7afc4645,fix(mo-service): apply max-processor after flag parsing, applies the positive CLI option after parsing through the existing runtime/cache setter. Fix PR #32337Dynamic restart testing found an independent control-listener defect. The configured control address was ignored, so restart verification used the actual listener owned by the test launcher. That defect has its own report and does not change the verified CPU-option result. Control-listener issue #32421
The independent build-guard failure was also recorded and worked around through the environment without changing service source. Build issue #32420
MOTR / BVT Coverage
Reused
cmd/mo-service/max_processor_test.goand the platform-specific affinity helpers, supplemented by real service/RPC/SQL and dynamic-child restart checks. These are process-startup invariants covered by existing regressions, so no duplicate SQL-only MOTR case was added. Startup and restart variants ran serially because they share process-global settings and listener ports. The BVT runner's cleanup removed the first temporary wide-table database, so the low-limit fixture was recreated after BVT completed. Owned services and child processes were stopped.Final Conclusion
Fixed for CLI CPU-option application on the tested main build, including real dynamic CN launch and restart.
Large-data regression is unnecessary for the flag-parsing defect. The persisted wide-table fixture supplies supplemental query correctness and observed-plan evidence. Increasing data solely to force a particular DOP is unnecessary.