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 snapshot registration fails for quoted source identifiers #26194
DATA BRANCH CREATE cannot finish branch-protection snapshot bookkeeping when
the source database or table identifier contains an apostrophe.
The source identifier is legal when quoted by the SQL parser. After cloning, createBranchProtectSnapshot writes the parent database and table names to mo_catalog.mo_snapshots, but interpolates those names into SQL string
literals without escaping apostrophes.
Data Branch CREATE should complete for legal quoted identifiers. The
branch-protection snapshot row should preserve the source database and table
names exactly.
Code context
pkg/frontend/data_branch_snapshot.go, createBranchProtectSnapshot, uses fmt.Sprintf to place parentAccountName, receipt.srcDb, and receipt.srcTbl between literal
quote characters. This path should use the shared SQL-string-literal quoting
helper before building the insert.
Duplicate check
The same behavior was previously reported in closed issue #24925. The current main implementation retains the direct interpolation, so this is filed as a
new issue rather than reopening the historical report.
PR #26218 merged as f2807845d90be1e683cb7e5fd5e735c86665bc8b (reviewed head 47577212df67146a86a8b6ba2bdcecddd37cc725). Required product CI passed; the remaining merge-update-moc result was a post-merge synchronization workflow, not a product-test failure.
QA handoff on main f6dab28046d70412cec132f0068840896852101c:
Create source database/table identifiers containing legal quote and backslash characters.
Exercise Data Branch snapshot registration and the affected FK/master lookup paths.
Verify the intended snapshot/metadata rows are created exactly once and cleanup succeeds.
Pass: the operation succeeds without malformed internal SQL and produces only the intended metadata. Fail: syntax/internal error, missing or duplicated metadata, or unintended additional SQL effects.
QA retest correction and renewed handoff on current main.
The previous QA run used 52ea9f874f492c368a20efef16b46ab8ced2de37. After that run, PR #25471 merged as f74a8d89109bc389cf5752cebb8a3ae3b552c7cc; it added the missing quoted-identifier formatting path and BVT coverage for a Data Branch target table whose legal quoted name contains an apostrophe.
The reported cleanup statements were shown without identifier quoting (DROP TABLE quote'srcN). An apostrophe-containing identifier must remain backtick-quoted in every SQL statement; the syntax error from an unquoted statement is not evidence that Data Branch cleanup failed.
Fresh local falsification on exact current main41332062a6740978f269088a92ee362a888c7bd7 passed. An embedded cluster test exercised:
quoted apostrophe source and target table names;
Data Branch creation and exactly one matching branch-protect snapshot;
correctly quoted ordinary DROP TABLE of the target;
terminal mo_branch_metadata.table_deleted = true;
removal of the corresponding kind='branch'__mo_branch_* snapshot;
correctly quoted source-table and database cleanup.
The same production path was also checked for DATA BRANCH DELETE TABLE and DATA BRANCH DELETE DATABASE on 0e6dfa93e1c7a2907ae6d8bad3a7ed1b943e9c81; both completed and reached the same metadata/snapshot terminal state. No production change is required from this QA return.
Please retest on main >= f74a8d89109bc389cf5752cebb8a3ae3b552c7cc (prefer current main), keeping apostrophe-containing table identifiers backtick-quoted for CREATE, DATA BRANCH, query, and DROP. Pass requires successful create/query/cleanup, one exact protect-snapshot row before deletion, table_deleted=true after deletion, and no matching branch snapshot afterward.
Scope note: an apostrophe-containing database name is rejected by the existing database-name/runtime contract at CREATE DATABASE, before Data Branch runs; it is not a valid cleanup oracle for this table-identifier issue. The issue's executable reproduction and the merged fix concern quoted table identifiers and SQL literal preservation.
Activity
VioletQwQ-0 commentedon Jul 29, 2026
PR #26218 merged as
f2807845d90be1e683cb7e5fd5e735c86665bc8b(reviewed head47577212df67146a86a8b6ba2bdcecddd37cc725). Required product CI passed; the remainingmerge-update-mocresult was a post-merge synchronization workflow, not a product-test failure.QA handoff on main
f6dab28046d70412cec132f0068840896852101c:Pass: the operation succeeds without malformed internal SQL and produces only the intended metadata. Fail: syntax/internal error, missing or duplicated metadata, or unintended additional SQL effects.
Ariznawlll commentedon Jul 29, 2026
已在最新
main分支进行黑盒复测。测试版本:
52ea9f874f492c368a20efef16b46ab8ced2de37测试拓扑:Proxy + 2 CN
重复次数:3 轮
测试过程:
测试结果:
从带单引号源表向普通目标表创建 Data Branch:3/3 成功。
snapshot 元数据:3/3 只生成一条目标记录,对象 ID 正确,标识符字节未被改变。
但清理阶段仍稳定失败:
均返回单引号附近的 SQL 语法错误。
使用同类带单引号目标标识符的完整场景也仍无法正常完成。
结论:snapshot registration 子问题已经修复,但 issue 的 QA 验收条件还包含“cleanup succeeds”,当前最新 main 仍不满足。本轮验证未通过,暂不建议关闭该 issue。
VioletQwQ-0 commentedon Jul 30, 2026
QA retest correction and renewed handoff on current
main.The previous QA run used
52ea9f874f492c368a20efef16b46ab8ced2de37. After that run, PR #25471 merged asf74a8d89109bc389cf5752cebb8a3ae3b552c7cc; it added the missing quoted-identifier formatting path and BVT coverage for a Data Branch target table whose legal quoted name contains an apostrophe.The reported cleanup statements were shown without identifier quoting (
DROP TABLE quote'srcN). An apostrophe-containing identifier must remain backtick-quoted in every SQL statement; the syntax error from an unquoted statement is not evidence that Data Branch cleanup failed.Fresh local falsification on exact current
main41332062a6740978f269088a92ee362a888c7bd7passed. An embedded cluster test exercised:DROP TABLEof the target;mo_branch_metadata.table_deleted = true;kind='branch'__mo_branch_*snapshot;The same production path was also checked for
DATA BRANCH DELETE TABLEandDATA BRANCH DELETE DATABASEon0e6dfa93e1c7a2907ae6d8bad3a7ed1b943e9c81; both completed and reached the same metadata/snapshot terminal state. No production change is required from this QA return.Please retest on
main >= f74a8d89109bc389cf5752cebb8a3ae3b552c7cc(prefer current main), keeping apostrophe-containing table identifiers backtick-quoted for CREATE, DATA BRANCH, query, and DROP. Pass requires successful create/query/cleanup, one exact protect-snapshot row before deletion,table_deleted=trueafter deletion, and no matching branch snapshot afterward.Scope note: an apostrophe-containing database name is rejected by the existing database-name/runtime contract at
CREATE DATABASE, before Data Branch runs; it is not a valid cleanup oracle for this table-identifier issue. The issue's executable reproduction and the merged fix concern quoted table identifiers and SQL literal preservation.Ariznawlll commentedon Aug 1, 2026
测试版本
main15a2d07c687a62a0984cf62846b092912a28c0f1原问题验证
源库中创建带单引号的表名和带反斜杠的表名,写入不同数据后执行
DATA BRANCH CREATE DATABASE。连续 3 轮均成功注册并复制两个对象,目标库分别读回(11,'quoted-source')与(22,'quoted-source')。Happy Path 覆盖
Unhappy Path 覆盖
DATA BRANCH DELETE DATABASE。mo_catalog.mo_database不再可见该目标库,未出现清理失败或残留元数据。白盒验证
回归测试
测试证据
PASS 26194_quoted_source_table_snapshot_lifecycle。测试结论
测试通过。
Ariznawlll commentedon Aug 1, 2026
测试版本
main15a2d07c687a62a0984cf62846b092912a28c0f1原问题验证
使用合法的带单引号表名
`src'name`创建源表并写入一行,再执行DATA BRANCH CREATE TABLE。分支表能够创建并返回原始行(1, apostrophe-source);该路径连续 3 轮结果一致。Happy Path 覆盖
CLONE与DATA BRANCH CREATE TABLE,用于防止标识符转义路径相互回归。Unhappy Path 覆盖
1,确认失败写入没有污染已复制的数据。白盒验证
不适用。本轮回归只通过公开 SQL 接口验证快照登记和表复制结果。
回归测试
已加入 motr#74:
issue_26194_26127_quoted_identifiers.test。测试证据
./motr --repeat 3 --do-test 'issue_(26194|26144|26113|24924|26095|26280|25625)':21/21 成功;12_git4datasuite:69/69 成功。详细变更和可复跑基线见 motr#74。测试结论
测试通过。