Repository navigation
Description
Description
mo-dump -csv reports a successful backup for an existing, valid 12 MiB LONGTEXT row, but the generated LOAD DATA LOCAL INFILE script cannot restore it. The client receives ERROR 2013: Lost connection to MySQL server during query; the target table exists but contains zero rows. Raising the client's max_allowed_packet to 64 MiB does not help.
Environment
- MatrixOne
maintest commit:7c146f4adbf068dd0c06b377157cfb7d7698b1eb(2026-10-20) - mo-dump
main:324c33dbdc7075cd5d7beaafd1e15c76709dd442 - Isolated local LOG/TN/CN, SQL port 6001, synthetic rows only.
Steps to reproduce
CREATE DATABASE dump_csv_big_src;
CREATE TABLE dump_csv_big_src.t(id INT PRIMARY KEY, payload LONGTEXT);
INSERT INTO dump_csv_big_src.t VALUES (1, REPEAT('x', 12582912));
SELECT COUNT(*), LENGTH(MAX(payload)) FROM dump_csv_big_src.t;
-- 1, 12582912
CREATE DATABASE dump_csv_big_dst;mo-dump -u root -db dump_csv_big_src -tbl t -csv > dump.sql
mysql --binary-mode=1 --local-infile=1 --max-allowed-packet=67108864 \
-D dump_csv_big_dst < dump.sqlConnection parameters and test-only credentials should be adapted to the local instance. The generated script contains CREATE TABLE followed by LOAD DATA LOCAL INFILE for its CSV file.
Actual behavior
- Export exits 0, writes a 12 MiB CSV file and
MODUMP SUCCESS. - Import exits 1 with
ERROR 2013 (HY000) ... Lost connection to MySQL server during queryat the generatedLOAD DATA LOCAL INFILEline. - Destination table has zero rows. Source row remains one row/12,582,912 bytes with unchanged MD5, and a new
SELECT 1succeeds. - Replacing
LOCALwith server-sideLOAD DATA INFILEagainst the same CSV file gives a clearerERROR 20101: size of row cannot exceed the max value of txn-entry-size-limit; it still cannot restore the backup.
Expected behavior
A supported row that already exists in MatrixOne should not yield a successful CSV backup that cannot be restored. Either the generated CSV restore path must support the row, or export must reject this mode with a clear, nonzero error before reporting success. LOCAL must surface a normal error rather than abruptly disconnecting the client.
Stability and controls
- Three independent fresh CSV exports and target databases: 3/3 exports exited 0; 3/3 imports returned 2013; 3/3 targets remained empty while the source remained intact and new connections worked.
- Separate fresh 4 MiB, 8 MiB and 9 MiB
LONGTEXTCSV exports/imports all passed, with source and target compared column-by-column and no mismatches. - The same 12 MiB source row exported in SQL mode with
-net-buffer-length 16777216, then imported with a 64 MiB client packet setting, passed exact bidirectional column comparison. Thus the value is valid and the failure is specific to CSV/LOAD. MEDIUMTEXTaccepted 16,777,215 bytes; 16,777,216 bytes was rejected with 1406 without changing the original row. A 32 MiB row acrossMEDIUMTEXT/LONGTEXTlikewise exports as CSV but cannot be reloaded.
Evidence
Synthetic files and output logs are retained under /private/tmp/mo-dump-cont-20261020.o75VwQ/, including blob12_d_csv, blob12_e_csv, blob12_f_csv, their generated SQL/CSV files, and the passing 9 MiB CSV and 12 MiB SQL controls. The three 12 MiB target checks each showed count 0; source showed count 1, length 12,582,912, MD5 2ceb1d3adc7ff97c138acfa4d440d9c0, followed by SELECT 1.
Code analysis
pkg/config/configuration.go defines LargestEntryLimit = 10 * 1024 * 1024. pkg/sql/util/csvparser/csv_parser.go readUntil returns an internal error when its accumulated buffer exceeds that limit. That explains the server-side rejection and why a 9 MiB control passes. mo-dump cmd/mo-dump/main.go emits CSV and a LOAD DATA LOCAL INFILE script without checking whether any row can be reloaded under that limit. The abrupt LOCAL client disconnect requires separate frontend/protocol investigation; this is an observed symptom, not yet a proven root cause.
Regression coverage
After the product decision/fix, test CSV export→generated LOCAL restore just below and above the loader's row limit, plus a LONGTEXT value accepted by SQL INSERT. Assert a restorable dump or an explicit nonzero export error, exact bytes/count, normal error delivery without connection loss, and target/source state after failure. No repository test or PR was added during this exploratory run.
Related
- The current MySQL compatibility contract has no documented
mo-dumplarge-row exception. The current officialLOAD DATAdocumentation describes CSV/LOCAL but does not state a 10 MiB row limit: https://docs.matrixorigin.cn/mo/en/v26.4.2.5/MatrixOne/Reference/SQL-Reference/Data-Manipulation-Language/load-data-infile.html - No matching open/closed issue was found in
matrixorigin/matrixoneormatrixorigin/mo_dumpfor this export/restore mismatch. - [Bug]: mo-dump SQL repeats INSERT header for a row larger than net-buffer-length, making successful backup unrestorable #30638 is SQL output buffer rollover, a different code path; [Bug]: excessive non-cache off-heap residency during streaming mo-dump (4GiB export uses ~7.8GiB) #30575 is streaming memory residency, not CSV restore correctness.
Activity
fix: bound csv record weight and drain cancelled load-local upload (i…
fix(frontend): drain load-local upload on ordinary upload-side error (m…
fix(frontend): wire load-local drain through MysqlProtocolImpl and cl…
test(frontend): pin owner/watcher join and deadline-arm interrupt con…
style(frontend): gofmt struct alignment after loadLocalMu insertion (m…
fix: bound csv record weight and drain cancelled load-local upload (i…
fix(frontend): drain load-local upload on ordinary upload-side error (m…
22 remaining items
fix(frontend): drain load-local upload on ordinary upload-side error (m…
fix(frontend): wire load-local drain through MysqlProtocolImpl and cl…
test(frontend): pin owner/watcher join and deadline-arm interrupt con…
style(frontend): gofmt struct alignment after loadLocalMu insertion (m…
fix(frontend): never drain or reuse a LOCAL connection whose packet b…
fix(csvparser): charge both consumed bytes of a doubled quote against…
fix(load): restore large CSV rows and preserve LOCAL upload errors (#…
Ariznawlll commentedon Oct 28, 2026
测试版本
f847803802289b2b2d0df4f0a2f842c2804b823a,修复 #31300 的 merge commit533e95796177d9eacdc909059ccf72b7ddd3ba5f位于祖先链。9f0cc1173a9dc2def2656de3cb5c4b988c879442,真实 mysql 客户端开启 LOCAL 和 64 MiB packet。原问题验证
源表 LONGTEXT 12,582,912 字节,真实
mo-dump -csv生成 SQL 与 CSV,再用 mysql 执行生成的LOAD DATA LOCAL INFILE,3 个独立目标库 3/3 导出、恢复成功;每轮目标行数 1、长度 12,582,912,MD5069e5676af785a0c995cfd9671e8f823与源表一致。源表操作后未变化。Happy Path 覆盖
MOTR 独立 3 轮同时覆盖 12 MiB 原场景和 9 MiB 对照;每轮源、目标逐行比较 ID、长度、MD5,均一致,临时 CSV 和测试数据库清理成功。
Unhappy Path 覆盖
在默认 64 MiB record 限制下,65 MiB LOCAL CSV 3/3 返回 20301,包含
exceeds max record size 67108864,目标表行数保持 0,同一连接随后SELECT 1返回 1;不再表现为客户端 2013 断连。每轮均确认清理测试库。白盒验证
本轮是实际导出程序、mysql 客户端与服务端的黑盒往返,未新增 Go UT/race。未单独模拟网络中断和其它非默认大小限制。
回归测试
MOTR #284 issue_30640_mo_dump_large_csv.py 覆盖原 12 MiB、9 MiB 对照、65 MiB 拒绝及连接复用,定向 3/3。此场景需显式提供 mo-dump 和 mysql 二进制;未配置时跳过,不把跳过当通过。完整 MOTR suite 未运行。
测试证据
修复 PR CI 的 UT、SCA、PROXY、PESSIMISTIC BVT、Coverage 通过;MOTR 新 head CI 在发布时尚未报告,不能声明完整 CI 通过。上述导出、恢复、文件/数据库清理及结果均为实际本地执行。
测试结论
测试通过。