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]: Prepared multi-assignment SET panics and partially updates session variables #26685
A text-protocol prepared statement containing more than one user-variable
assignment panics while evaluating the second assignment. The failure is also
non-atomic: the first assignment has already changed session state before the
server returns the error.
测试版本
分支:main
commit:c726a6199094184a2e6ebc7504c3e011982b8976
部署方式:本地隔离单节点 LOG / TN / CN 集群,以 mysql text protocol 执行 SQL PREPARE/EXECUTE
测试日期:2026-08-04
原问题验证
以下最小 SQL 在三个独立新连接中均复现:
SET @a =99, @b ='before';
PREPARE multi FROM'SET @a = ?, @b = ?';
SET @x =41, @y ='first';
EXECUTE multi USING @x, @y;
SELECT @a, @b;
Required: yes. This is user-visible prepared SQL behavior with a recovered panic and session-state failure-atomicity risk.
Automated evidence: exact-head focused text PREPARE/EXECUTE and binary COM_STMT_PREPARE/EXECUTE regressions passed, including rebinding/NULL, left-to-right visibility, repeated/self-referential targets, late RHS rollback, reserved user-variable names, mixed system-variable rejection, connection reuse, and parameter ownership cleanup. The canonical prepare BVT passed locally, and the merged PR required checks passed for standalone BVT, UT, SCA, Compose/Proxy, coverage, MongoDB, and Iceberg. The post-merge TKE BVT check is still pending at handoff.
Remaining validation: on a deployed post-merge build, verify text and binary drivers across repeated rebinding, NULL and heterogeneous values, repeated/self-referential targets, later-RHS failure, invalid arity, mixed system-variable rejection, unchanged final session state, and connection reuse.
Expected result: PASS means no panic, left-to-right visibility is preserved, and every rejected/failing statement leaves all session variables unchanged. A FAIL must include the tested version, environment, and terminal result and keep this issue open.
Tester selection: the issue author is Ariznawlll; under the automation rule, non-heni02 issue authors are assigned to Ariznawlll.
Activity
Ariznawlll commentedon Aug 4, 2026
回归基线处理补充
本 issue 的 multi-assignment
SETpanic / partial mutation 在main@c726a6199094184a2e6ebc7504c3e011982b8976上仍是 3/3 复现。正常控制为单项文本SET可完成;失败输入是多项 marker 赋值,异常前已能观察到部分 session 状态变更,故不满足失败原子性。因此未把该失败写入 motr#74 的
.result。修复后请补 protocol/text 两条回归:单项、多项、NULL和异构类型重绑;每个拒绝路径后读取所有变量并复用同一连接,断言零部分修改、无 panic。测试不通过。
fix(frontend): allow binary prepare for single SET assignment (#26694)
VioletQwQ-0 commentedon Aug 6, 2026
QA handoff for merged PR #26705
PR and merge:
QA decision:
Tester selection: the issue author is Ariznawlll; under the automation rule, non-heni02 issue authors are assigned to Ariznawlll.
Ariznawlll commentedon Aug 7, 2026
测试版本
maind0057b3503611022cdf9a6e24c98065d209eb8e4原问题验证
在 CN1 → CN2 → CN1 的 3 个新连接中重复执行原始多赋值 prepared SET:
每轮
EXECUTE都成功,结果均为41, first;未再出现原问题中的内部空指针错误,也没有部分变量更新。Happy Path 覆盖
? + 1和字符串concat均正确;首次执行得到42, first-text。9, NULL后得到10, NULL,确认参数重用与 NULL 值正确。set @visibility_a=?, @visibility_b=@visibility_a+1得到41,42;同一目标变量重复赋值set @self_ref=?, @self_ref=@self_ref+1得到42。PrepareContext/ExecContext的两项赋值及NULL重绑与 text protocol 结果一致。select 1,均返回1。Unhappy Path 覆盖
execute p using @x正确返回Incorrect arguments to EXECUTE;预置变量77, stable保持不变。(select v from multi_set_values)正确返回Subquery returns more than 1 row;两个目标变量均保持执行前值88, unchanged。set @a=?, transaction_isolation=?正确拒绝,并保持@a和@@transaction_isolation不变。select 1,均成功;未观察到连接状态损坏。白盒验证
text_protocol与binary_protocol子路径连续 3 次通过。该用例覆盖重复/self-reference 赋值、后段表达式失败回滚、保留变量名、NULL/异构重绑和 mixed system variable 拒绝。回归测试
当前 main 已包含
pkg/tests/issues/issue_26685_test.go,并在test/distributed/cases/prepare/prepare_all.sql中保留 text BVT 覆盖。本轮为修复后的验证,未额外修改回归文件。测试证据
live 双 CN 验证命令:
另发现一条不同的 multi-statement 包顺序缺陷,已独立记录为 #26766;它不影响本 issue 所覆盖的单条 prepared EXECUTE 路径。
测试结论
测试通过。
Ariznawlll commentedon Aug 7, 2026
回归测试补充
已新建 motr#83,新增
issue_26685_prepared_multi_set协议回归。NULL、前项赋值对后项可见;NULL、参数不足后的状态不变及 statement 复用;SELECT 1复用校验。本地 motr runner 在 CN1、CN2 各连续 3 次通过。#26602 的 SQL/binary 回归已经在 motr
main,本 PR 未重复提交其文件。fix(frontend): allow binary prepare for single SET assignment (matrix…
fix(frontend): allow binary prepare for single SET assignment (matrix…
fix(frontend): allow binary prepare for single SET assignment (matrix…