You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DATA BRANCH CSV output ignores batch copy errors #26128
DATA BRANCH DIFF ... OUTPUT FILE does not propagate a batch-copy failure before it submits the CSV conversion task. The failed copy produces a nil batch, which the worker dereferences.
Revision
2eb7f523e5a10f352d3e258183ed8440510388de (main)
Reproduction
The failure is reproducible with a focused frontend white-box test:
Build an off-heap text batch larger than a 1 MiB MPool limit.
Call bat.Dup(limitedMP). It returns a non-nil error and a nil batch.
Follow the same unchecked flow used in writeCSV: submit the nil result to constructByte.
The test passed 3/3 and observed the nil-batch dereference each time.
Actual behavior
At pkg/frontend/data_branch_output.go, the CSV path uses:
copied, _:=bat.Dup(ses.proc.Mp())
The returned error is discarded. constructByte subsequently accesses bat.RowCount() and dereferences the nil value.
Expected behavior
The batch-copy error should be returned through the existing cancellation/error path. No CSV worker should be started with a nil batch, and the statement should return a regular error after cleaning up its temporary output.
Notes
The ordinary export path in pkg/frontend/export.go checks the same bat.Dup error before scheduling conversion work.
PR #26149 merged as 2d0adac64ea6c72028c5443813428f84fbcd1575 (reviewed head 066b8da40d33606395db1e5028aa1dbf45bbd7b8). Focused error-path coverage and required product CI passed; merge-update-moc was post-merge synchronization only.
QA handoff on main f6dab28046d70412cec132f0068840896852101c:
Exercise a successful DATA BRANCH CSV output path.
Induce a batch-copy/write failure after output has started.
Verify the statement reports the original failure and leaves no apparently successful or silently truncated result.
Pass: success remains unchanged, and injected copy failure reaches the user with safe cleanup. Fail: false success, swallowed error, or partial output presented as complete.
输出前后分别回读 source 和 branch,确认生成输出不会修改输入数据;同时确认 OUTPUT AS 结果是普通非 branch 表。
结果:场景通过;本轮 Data Branch 全集 13/13 case、280/280 条 SQL/断言通过。
白盒验证:
go test ./pkg/frontend \
-run '^TestSubmitCSVBatchForConversionReturnsCopyErrorBeforeSubmit$' \
-count=1
ok github.com/matrixorigin/matrixone/pkg/frontend
Activity
VioletQwQ-0 commentedon Jul 29, 2026
PR #26149 merged as
2d0adac64ea6c72028c5443813428f84fbcd1575(reviewed head066b8da40d33606395db1e5028aa1dbf45bbd7b8). Focused error-path coverage and required product CI passed;merge-update-mocwas post-merge synchronization only.QA handoff on main
f6dab28046d70412cec132f0068840896852101c:Pass: success remains unchanged, and injected copy failure reaches the user with safe cleanup. Fail: false success, swallowed error, or partial output presented as complete.
Ariznawlll commentedon Jul 29, 2026
已在最新
main分支完成验证。测试版本:
52ea9f874f492c368a20efef16b46ab8ced2de37测试过程:
-race模式各连续执行 3 轮,检查返回错误、batch submit 行为及 panic。EXCEPT对比恢复后的数据。测试结果:
EXCEPT均为 0 行。-race测试全部通过。说明:copy 失败点无法仅通过外部 SQL 稳定触发,因此失败分支使用确定性的白盒错误注入;正常输出和数据完整性使用黑盒 SQL 验证。
结论:该 issue 描述的 batch copy error 被忽略问题已修复,本轮验证通过。
Ariznawlll commentedon Jul 30, 2026
已在
main@0ebba1c0c96bbcf0ff4091236e10df7b97e24a0c补充完成黑盒和白盒验证。黑盒验证:
DATA BRANCH DIFF ... OUTPUT FILE,要求返回一个生成的.sql文件路径。OUTPUT AS,逐行检查 UPDATE、DELETE、INSERT 的精确内容。OUTPUT AS结果是普通非 branch 表。结果:场景通过;本轮 Data Branch 全集
13/13case、280/280条 SQL/断言通过。白盒验证:
白盒通过受限 MPool 注入
batch.Dup失败,验证错误会在提交 CSV worker 前返回,不再把 nil batch 交给 worker。黑盒只验证支持的成功输出路径,不伪造内部内存错误。Unhappy path / 错误传播:
batch.Dup返回 error 和 nil batch。结论:内部 copy-error 传播及公开 OUTPUT FILE/OUTPUT AS 路径均验证通过,黑盒回归已加入 motr#69。
Ariznawlll commentedon Jul 30, 2026
Unhappy Path / Copy Error 专项验证
测试版本:
main@0ebba1c0c96bbcf0ff4091236e10df7b97e24a0c白盒错误注入:
batch.Dup返回 error 和 nil batch。黑盒边界数据:
OUTPUT FILE和OUTPUT AS;结果:内部 copy error 正确传播;公开输出路径没有截断或错误转义困难字符串。黑盒回归见 motr#69。
补充覆盖 worker submit 失败路径:预先释放 worker pool 后提交已复制 batch,submit error 能够原样返回,临时 copy 被完整清理,目标 MPool 回到 0,没有 batch 泄漏或二次 panic。
测试结论
测试通过。