Skip to content

ETLMerge: strconv.ParseUint parsing "admin" as uint 导致 statement_info CSV 合并持续失败 #28379

Closed

Description

@matrix-meow

现象

prod 环境 freetier-01 集群,ETLMerge 任务在合并 system.statement_info 历史 CSV 文件时持续报错:

ERROR  export/merge.go:456  "failed to upload file to MO"
       table: system.statement_info
       error: "strconv.ParseUint: parsing \"admin\": invalid syntax"

ERROR  export/merge.go:381  "error checking if the first record exists"
       table: system.statement_info
       path: sys/logs/2026/07/24/statement_info/...CN_903727176.csv
       error: "strconv.ParseUint: parsing \"admin\": invalid syntax"

WARN   export/merge.go:275  "merge task meet error: strconv.ParseUint: parsing \"admin\": invalid syntax"

错误每 ~10 秒重试一次,total: 1, success: 0,所有旧文件均无法合并。

影响

  • 涉及的 CSV 文件日期:2026/07/22、2026/07/24
  • 来源 CN UUID:12cbc-e6-26-5a-d707d438(已下线),当前 CN 继承旧文件后持续触发
  • 错误风暴:每分钟 ~6 条 ERROR 日志

根因分析

statement_info 的 CSV 中,某个预期为 uint 类型的列(如 account_id / role_id)包含文本 "admin"。可能原因:

  1. Schema 变更:表结构变更导致旧 CSV 列位置与新 schema 不匹配
  2. 列对齐偏移:CSV 列偏移导致 "admin"(可能是 role_name)被当作 uint 列解析
  3. 旧 CN 生成的文件不兼容:当前 CN 版本无法解析旧版本 CN 写入的 CSV 格式

修复建议

  1. 容错处理:export/merge.go:381 解析前做类型校验,遇到不兼容格式跳过而非反复重试
  2. 旧文件清理:配置 statement_info CSV 的 ILM 过期规则,避免长期积压
  3. 版本兼容性检查:merge 任务启动时检查 CSV 文件版本,不兼容则跳过

环境

  • 集群:prod freetier-01
  • 镜像版本:v3.0.17-0b27fd4d1-2026-07-09
  • 报错 Pod:freetier-01-s16c64g-6f594c8f6-cn-p28gn

相关日志

完整日志样本(17:58:45~17:59:55 CST,连续 10+ 条相同错误)已在 prod Loki 中可查。

Activity

  1. added theissue type on Sep 8, 2026
  2. added
    severity/s0
    on Sep 8, 2026
  3. jiangxinmeng1 commented on Sep 14, 2026

    @jiangxinmeng1
    Contributor

    fixed by #28503

  4. slyunnn commented on Sep 14, 2026

    @slyunnn

    Regression and extended verification for #28379 (2026-09-14)

    Verification Environment

    • MatrixOne source/runtime: local origin/main at 61efcf43a145c53435933e14d98ff2ba61afabd5 — fix(spatial): support collection property functions (#28201) (#28834); mo-service was rebuilt from this commit and restarted before verification.
    • Topology: 2 CN / 1 TN / 1 Log service / Proxy.
    • Endpoints: Proxy 127.0.0.1:6001, CN1 127.0.0.1:16001, and CN2 127.0.0.1:16002; SELECT 1 and the system.statement_info service surface succeeded on all three.
    • ETL storage: isolated local DISK-ETL file service at mo-data/etl; real local ETLMergeTask cron schedule was enabled with a 5-minute interval.
    • Client protocol: MySQL CLI over the MySQL protocol for service and scheduler checks; current-main Go test execution for internal ETL file-service and merge behavior.
    • Related fix: PR #28503, merge commit 2cecab5e1ca9de26d17f7728021526ae5f50951b (fix(export): discard incompatible statement info CSV).

    What Was Covered

    • OK — Original incompatible statement_info record where the expected unsigned account_id position contains admin is identified before opening a database connection.
    • OK — The merge path classifies that condition as permanent, deletes the incompatible ETL CSV, and returns successfully rather than retrying it.
    • OK — Real local DISK-ETL and cron validation: injected a 17-column legacy CSV at sys/logs/2026/09/14/statement_info/ with admin at the account_id position; the real ETLMergeTask scheduler deleted it after its next run and advanced its next scheduled time.
    • OK — Current-schema column-name mapping accepts a valid numeric account_id even when column order is explicit; schema-length mismatch is rejected as incompatible.
    • OK — The complete pkg/util/export/etl/db and pkg/util/export test suites passed on current main.
    • OK — Proxy 6001, CN1 16001, and CN2 16002 remained able to query system.statement_info after validation.
    • Not covered — Production object-store data and production cluster cron jobs; those systems were intentionally not modified. Equivalent legacy-file and scheduler behavior was validated in the isolated local topology.

    Findings

    The former strconv.ParseUint("admin") transient failure path is no longer used for incompatible legacy statement_info CSV records. Direct merge tests and a real local scheduler run confirm that the incompatible file is discarded, preventing the same permanent input from creating retry and log storms. Temporary connection failures remain on the normal error/retry path.

    MOTR / BVT Coverage

    • No new MOTR SQL or protocol case was added: ETLMerge input discovery, file deletion, and retry classification are internal file-service behavior with no safe public SQL/protocol interface. A MOTR case that only queried system.statement_info would not cover the fix.
    • MatrixOne product regression coverage from PR #28503 was executed directly: complete ./pkg/util/export/etl/db and ./pkg/util/export test suites passed.
    • The fix adds coverage for incompatible-record detection, column-name mapping, schema-length mismatch, incompatible-file deletion, and doMergeFiles discard behavior.

    Final Conclusion

    Fixed. Large-data regression is not required: classification depends on the first CSV record and schema compatibility, not row count, block/batch boundaries, memory/spill, concurrency, data skew, network transfer, or resource scale. The issue remains open for maintainer disposition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

severity/s0source/moc-prod

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions