Repository navigation
fix: make SQL/CSV dump scripts restore-safe (#30596 #30598 #30587 #30590 #30628 #30481) - #58
Conversation
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
Heads-up on overlap: matrixone-side sessions opened #60/#61 covering the same six issues with a different approach (sql_mode-independent CHAR(92)/doubled-quote literals for #30587 instead of the script-level sql_mode pin used here; quoted literals instead of CAST for #30598). Both are now closed as superseded by this PR, which is live-validated for all six. Two follow-up notes: (1) this PR has no unit tests — worth adding the regression matrix (float boundary, literal safety, infile path, final-flush error) in a follow-up; (2) the sql_mode pin approach mutates the restore session mode and must restore it afterwards — the body says it does; reviewers should double check the pinned/unpinned pairing. |
|
Rebased on main and hardened the #30587 sql_mode pin. New head 35e473c. Merge resolution (fixes the DIRTY state vs. main):
Two functional changes to the pin itself:
Unit-test regression matrix (float boundary, literal safety, infile path, final-flush error) still planned as a follow-up PR, per the earlier comment. |
|
合并了最新 main(#63 #65 已入库后出现冲突),现已解好:
|
|
@XuPeng-SH 您好,方便时帮忙 review 一下这个 PR? 它汇总了 mo_dump 侧六个 dump/restore 安全问题的修复(对应 matrixone 侧 #30596 #30598 #30587 #30590 #30628 #30481),#60/#61 已作为重复关闭:
现在只差一个 approve 就能进 Mergify 队列,有任何要改的我马上跟进。谢谢! |
ade575d to
1b1a4dd
Compare
- quote DOUBLE NaN/+Inf/-Inf like FLOAT; emit cast('<v>' as float) for
finite float outside the float32 range and cast('-0' as <typ>) for
negative zero, so restore keeps source values (matrixorigin/matrixone#30596 #30598)
- pin the restore session sql_mode to backslash-escapes mode and restore
it afterwards (matrixorigin/matrixone#30587)
- emit LOAD DATA with an escaped relative CSV path and escaped delimiter
instead of an unescaped absolute path (matrixorigin/matrixone#30590 #30481)
- propagate csv writer/close errors so a truncated dump exits nonzero
instead of declaring MODUMP SUCCESS (matrixorigin/matrixone#30628)
1b1a4dd to
0ccca91
Compare
|
Self-review completed for The full diff and its restore consumers were reviewed, covering numeric roundtrip fidelity, script/view SQL-mode save and restore, CSV framing and SQL quoting, LOCAL/non-LOCAL path semantics, and CSV resource/error handling. The latest main's catalog account scope and table classification behavior are preserved. Validation completed locally on Linux/amd64 (mo_dump: Go 1.26.4 with CGO; live MatrixOne consumer:
The reviewed head is pushed and ready for maintainer review. |
Fix successful-looking SQL/CSV dumps that could not be restored or changed values/session state during restore.
Regression coverage includes CLI rejection of the backslash delimiter with empty stdout, separate script/view SQL-mode save and restore variables (compared case-insensitively), and LOCAL/non-LOCAL paths including quote/backslash identifiers. Delimiter validation checks both errors and the returned rune.
Rebased onto main
828bbfeafter #66 merged; the catalog account scope, hidden-table filtering, empty relation kinds and SHOW CREATE guards are preserved. Independent subagent review of final head0ccca91found no unresolved blockers. The review caught an upstream external-table test with stale catalog mocks; its scoped queries/args are now updated without weakening the original assertions. Independent focused tests, the corrected external-table case and the final fullmake testpass. The rebased production code also passes the same 14 live scenarios.Validation (local, Linux/amd64, Go 1.26.4):
make build,make test(go test -mod=readonly -count=1 ./...),go vet -mod=readonly ./cmd/mo-dump, and incremental lint pass. The local golangci-lint v2 used a temporary migrated copy of the existing configuration; repository lint/CI configuration is unchanged.MatrixOne #30640 (large-field CSV loading) remains outside this PR's scope.
Fixes matrixorigin/matrixone#30596
Fixes matrixorigin/matrixone#30598
Fixes matrixorigin/matrixone#30587
Fixes matrixorigin/matrixone#30590
Fixes matrixorigin/matrixone#30628
Fixes matrixorigin/matrixone#30481