Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- Observed during TKE Main Weekly run
37874777871, namespacemo-main-family-37874777871-1. - Topology: 1 TP CN + 2 AP CN; each CN has a 14-core CPU limit and 55 GiB memory limit.
- MO image revision and registry digest verified by the run's image receipt.
- Image digest:
sha256:e4f01e8f3596bd4fb2e82b417cb62d28e5c38d1b6282b8df9f1706dbf6651783. - Example ETL worker:
nightly-regression-dis-ap-cn-d7t5q. - This is MO's internal SQL-report ingestion into
system.statement_info, not GitHub Actions artifact upload.
Actual Behavior
MO-generated statement-report files fail internal ingestion with error 1406 because a TEXT value exceeds the ordinary TEXT capacity:
Error 1406 (22001): Can't cast column from TEXT type to TEXT type
because of one or more values in that column.
Src length 127255 is larger than Dest length 65535
Bounded Loki queries independently confirmed these examples on 2026-10-09:
| UTC time | Observed event |
|---|---|
| 08:50:11.314679 | Assignment cast rejects a 127,255-byte TEXT value. |
| 08:50:11.346203 | ETL merge logs failed do write for a statement_info/*.csv file, with the same 1406 error. |
| 08:50:21.347346 | failed to upload file to MO, explicitly table=system.statement_info, for that same file and error. |
| 08:50:32.451253 | A different report file fails with source length 172,077 bytes. |
| 08:50:43.641677 | A different report file fails with source length 286,369 bytes. |
| 08:51:17.155588 | A different report file fails with source length 307,317 bytes. |
| 09:51:47.653595 | Internal ingestion is still encountering a report exceeding the limit: 78,786 bytes. |
The corresponding first example is approximately 16:50:11-16:50:21 Asia/Shanghai. The final example is 17:51:47 Asia/Shanghai. These are bounded samples, not a count of all affected files or a claim that one file was retried continuously for an hour.
This prevents affected report batches from becoming available in system.statement_info. The failed file is not deleted by the ordinary upload path and remains eligible for subsequent merge attempts.
Expected Behavior
The internal statement-report producer, export format, and destination schema must agree on supported value sizes. Valid MO-generated diagnostic reports must not permanently fail ingestion under the default internal schema.
Enforcing SQL TEXT byte limits is correct for ordinary user tables; the internal telemetry integration must accommodate that contract rather than rely on oversized TEXT assignments being accepted.
Steps to Reproduce
Observed production-equivalent path:
- Use a main build containing [Compatibility]: enforce BLOB/TEXT family byte limits #29121 with the standard
system.statement_infoschema and internal report/ETL ingestion enabled. - Execute workload producing statement reports with at least one ordinary TEXT field above 65,535 bytes.
- Observe report CSV generation followed by ETL merge /
LOAD DATA INLINE ... INTO TABLE system.statement_info. - The assignment cast rejects the oversized value with 1406;
failed do writeandfailed to upload file to MOare logged.
The real workload above demonstrates the failure. The incident CSV has not been downloaded or parsed, so an exact minimal SQL reproducer and the offending field name are not yet established. It would be misleading to assert that the specific field is definitely exec_plan.
For a deterministic follow-up test, serialize a complete StatementInfo row containing a valid execution-plan JSON larger than 65,535 bytes through the actual exporter and bulkInsert path, then verify ingestion and file lifecycle. That test is suggested, not claimed to have been run here.
Additional information
Confirmed code-level capacity mismatch
- Internal schema:
statement,statement_tag,statement_fingerprint,error,exec_plan,stats, andsql_source_typeusetable.TextColumnortable.TextDefaultColumn. - Schema SQL generation: this column kind generates ordinary
TEXT, not MEDIUMTEXT/LONGTEXT. - Statement serialization:
FillRowforwards fields into the export row. In particular, ExecPlan2Json marshals and returns execution-plan JSON without a 65,535-byte bound;FillRowforwards it intoexec_planwithout a matching size guard. Error text is likewise forwarded without this cap. The regular statement text has its own size handling, so not every field is unbounded. - Internal SQL upload:
bulkInsertserializes records as CSV and executesLOAD DATA INLINEinto the destination table. - TEXT assignment enforcement:
strToStrapplies the declared TEXT byte capacity to assignments. Above-capacity values are rejected in strict mode. Legacy width-zero TEXT is also interpreted as ordinary TEXT capacity bystringFamilyByteWidth. - Failure/file lifecycle:
Flushfailure returns before source-file deletion. The outer loop waits 10 seconds, logs the failed upload, and continues to other files. Retained files can be selected again by a later merge run. This is not an immediate tight infinite retry of the same file.
The capacity-contract defect is established by the schema/producer/consumer code and the actual internal LOAD failures. Identifying the particular oversized field in each incident file remains a separate evidence gap.
Relationship to #29121 and current main
- [Compatibility]: enforce BLOB/TEXT family byte limits #29121, merge commit
f42330b618f05d117bcaadf9a3fa01f874bd3cc3, introduced family byte-capacity enforcement at assignment boundaries, including LOAD. Before that change the generic ordinary-TEXT cast path did not enforce this bound; the internal schema/producer contract was not aligned as part of that change. - This is an internal-observability integration defect exposed by stricter capacity enforcement, not evidence that the general TEXT compatibility fix should be reverted.
- The same schema, serialization, internal upload, and failure/file-lifecycle code remains in source-reviewed
main@d2a0055ebe1a0b2423368e046c1812c18f6face8. No matching statement-info widening/migration or producer-size fix was found in that source review. Latest main has not been runtime-retested here. - No claim is made here about 4.2: it needs its own exact-version/ancestry and runtime check.
Impact and boundaries
- Missing/delayed statement reports in SQL observability; a rejected batch can also delay other valid reports in that batch.
- Retained ETL files and repeated attempts are potential backlog/retry-work amplification; total backlog size and resource cost were not measured in this investigation.
- This is not evidence of user-table corruption, a broken Q15 plan, or failed GitHub artifact transport.
- Whether any particular routing probe was absent because of this defect has not been established.
- Avoid resolving this by silent blind truncation of JSON, globally weakening SQL-mode checks, or indiscriminately discarding report files. A fix should define a consistent bounded reporting/schema contract and consider existing-cluster upgrade compatibility.
Related issues and evidence
- Exact searches for
statement_infowith1406,65535, andDest length, plus broader TEXT/capacity and recent telemetry searches, found no accurately matching issue at filing time. - ETLMerge: strconv.ParseUint parsing "admin" as uint 导致 statement_info CSV 合并持续失败 #28379 concerns positional CSV/schema incompatibility (
ParseUintof a nonnumeric account field), not this successful-parse/oversized-TEXT assignment failure. - [Bug]: cn-dev system.statement_info marker/time-window diagnostics time out #28900 concerns slow diagnostic reads; [Bug]: statement_query_type_3.sql intermittently reports stale statement_info DDL accounting in multi-CN PROXY BVT #29071 concerns asynchronous statement accounting visibility. Neither tracks the internal 1406 ingestion failure.
- Source regression run.
- MOTR job in the same namespace.
- Resource/image receipts:
tke-family-weekly-shadow-1x2-resource-37874777871-1andtke-family-image-build-receipt-37874777871-1. - Investigation was read-only: bounded Loki queries and exact-commit source inspection. No cluster restart, data changes, or code changes were performed.
Activity
fix: bound statement_info diagnostics to TEXT capacity (#29812)
Ariznawlll commentedon Oct 12, 2026
测试版本
MatrixOne
main@02a2823c2007d5e4fb4ada148e93743df337551a(2026-10-12 取得的 main HEAD;已包含 #29812)。本次在 macOS arm64 本地真实 SQL 嵌入式集群和 Go 定向测试执行;原始 TKE 1 TP + 2 AP CN 周回归未重跑。原问题验证
原问题是内部
system.statement_info报告中的超长TEXT值导致LOAD DATA INLINE报 1406,进而影响整批报告入库。当前 main 对诊断文本作 UTF-8 安全、以字节为单位的 65,535 上限处理;超长exec_plan改为合法 JSON 摘要,保留截断标识和原始长度。历史遗留 CSV 在内部导入边界也作归一化。Happy Path 覆盖
system.statement_info插入当前格式与历史格式两行,均成功查询;逐行核对statement/error/exec_plan/stats/rows_read/bytes_scan,普通指标未丢失。TEXT控制行可以正常写入。error,均成功落库;文本不超过 65,535 字节且 UTF-8 合法,计划摘要为可解析 JSON,并带有truncated=true与original_bytes。Unhappy Path 覆盖
system.statement_info的历史超长字段可以归一化;其他数据库中同名表不被误处理。模糊/不匹配的表布局明确返回错误。TEXT仍拒绝 65,536 字节值并返回 1406,未通过削弱全局长度校验掩盖问题。白盒验证
TestStatementInfoDiagnosticCapacitySQL以及pkg/util/export/etl/db、pkg/util/trace/impl/motrace、pkg/util/export相关 8 个定向测试在该提交各运行 3 次,全部通过。检查到修复既约束新生成的报告,也在旧 CSV 导入边界兜底;不会把该内部策略扩散到用户表。回归测试
此问题属于内部遥测 ETL 契约,真正断言点在生产者、历史 CSV 归一化、
LOAD DATA和文件重试边界,已由合并到 main 的 Go UT/SQL 集成测试覆盖;不适合只加一个外部 SQL MOTR 用例。尚未重跑原 TKE 周回归,因此未宣称其 3-CN、长时大数据 ETL 链路已完成验收。测试证据
go test ./pkg/tests/dml -run '^TestStatementInfoDiagnosticCapacitySQL$' -count=3;go test ./pkg/util/export/etl/db ./pkg/util/trace/impl/motrace ./pkg/util/export -run 'Test(StatementInfoDiagnosticCapacity|BulkInsertStatementInfoHistoricalDiagnostics|BulkInsertStatementInfoRejectsAmbiguousLayout|StatementInfoCapacityAndPlanOwnership|StatementInfoMalformedErrorDiagnostics|StatementInfoAggregationCapacity|StatementInfoCachedMalformedPlanCapacity|MergeStatementInfoOversizedCSVRecovery)' -count=3;各包结果均为ok。当前 main 上原始“超长内部报告导致整批
statement_info导入 1406”路径在确定性 SQL 集成和内部边界测试中已修复。原 TKE 周回归的端到端观察仍未覆盖;我将该 issue 转回修复负责人,保留上述环境边界。测试结论
测试通过。