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]: multi-CN KILL QUERY returns 1105/HY000 instead of 1317/70100 #29693
dce60631f8c857ae730a4d2f328df5962e4f2a8d (current main used for this exploration)
Problem
KILL QUERY cancels an executing multi-CN query, but the client receives the generic error 1105/HY000: context canceled instead of the query-interrupted error 1317/70100.
MatrixOne already defines context cancellation as ErrContextCanceled -> ER_QUERY_INTERRUPTED (1317), SQLSTATE 70100 in pkg/common/moerr/error.go. MySQL also defines ER_QUERY_INTERRUPTED as error 1317 with SQLSTATE 70100 and message Query execution was interrupted.
Reproduction
Create and flush a table with 150,000 rows so that the scan runs on multiple CNs. From session A, record connection_id() and execute a deliberately long aggregate:
selectsum(length(payload) + sleep(0.001)) from src;
While the remote pipeline is active, execute this from session B:
kill query <session-A-connection-id>;
The same behavior occurs through both protocol paths:
text COM_QUERY;
binary COM_STMT_PREPARE + COM_STMT_EXECUTE, with the sleep duration bound as a parameter.
Actual behavior
Error 1105 (HY000): context canceled
The query is canceled and remote stream owners are cleaned up. The connection remains usable, and the same prepared statement can be executed again successfully. Therefore the defect is specifically the public error identity returned for the killed query.
Observed on three consecutive prepared executions and one text execution.
Expected behavior
Error 1317 (70100): Query execution was interrupted
The text and binary protocol paths should expose the same MySQL-compatible query-interrupted identity.
Additional evidence
After every kill, PipelineMessageSenderGauge and PipelineStreamLifecycleGauge returned to zero.
Re-executing the same prepared statement on the same physical connection returned the exact aggregate result.
Existing pipeline terminal-failure tests already assert ER_QUERY_INTERRUPTED / SQLSTATE 70100, so 1105/HY000 is inconsistent with MatrixOne's own error contract as well as MySQL.
Activity
fix(frontend): preserve KILL QUERY interruption identity (#29794)
Ariznawlll commentedon Oct 16, 2026
测试版本
main48dbe277b6d20216c1c513d03c5cbd681380a8a2(执行前后核对origin/main;修复 PR #29794 的合入提交f5268b10ad967941fe72d245eedc0b248e372172是其祖先)原问题验证
count(*)=150000,sum(length(payload))=4800000。会话 A 执行原始select sum(length(payload) + sleep(0.001)) from src,会话 B 在SHOW PROCESSLIST确认执行中后发送KILL QUERY <A 的 connection_id()>。COM_QUERY和二进制COM_STMT_PREPARE/COM_STMT_EXECUTE(sleep(?)绑定0.001)。完整重复 3 轮,两条路径每轮均返回 MySQL error 1317 / SQLSTATE 70100,不再返回 1105/HY000。0,两条路径均返回精确聚合值4800000;连接 ID 未变化。测试库已按精确名称删除。20505/HY000 ... 127.0.0.1:18047 connect: connection refused;监听端口恢复后重跑通过。该次归类为本机环境瞬断,不计作产品修复通过次数,也不掩盖该异常。Happy Path 覆盖
4800000,同一连接及同一预处理语句可继续使用,3/3。percentile_cont/disc分别精确返回12288.5/12288,三 CN 查询均一致。Unhappy Path 覆盖
1317/70100;本机原始 SQL 各 3/3,3 CN 强制远程管道集成测试各 10/10。PipelineMessageSenderGauge与PipelineStreamLifecycleGauge均回到 0;同连接/statement 再执行正确,未见远程 stream owner 残留。白盒验证
TestIssue29492MultiCNCancellationCleanup,-count=3和-count=7均通过,合计 10/10。该测试明确强制 3 CN 扫描、等待远程 sender 活跃后取消,覆盖文本及预处理协议和上述资源释放断言;未执行-race,本 issue 的公开错误身份不依赖 race 检测。回归测试
1317/70100与同连接恢复;场景还支持对原始 15 万行 SQL 的本地复测。./motr 14_issue_regression.issue_29693_kill_query_wire --repeat 3 -j 1:3/3 通过,3/3 场景语句通过;go vet通过。PR (AOE) incompatible bug fix #237 尚未合入,完整 suite/集成 CI 尚未验证,后续继续跟踪,不能把这些未执行项称为通过。测试证据
测试结论
测试通过。