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
Transactions: SAVEPOINT semantics are missing or inconsistent across clients #23125
在事务中使用 SAVEPOINT 与 ROLLBACK TO SAVEPOINT 会触发内部错误:savepoint has not been implemented yet. please rollback the transaction. 表明 MatrixOne 尚未实现 MySQL 标准的保存点语义。
Error Message
ERROR 20101 (HY000) at line 8: internal error: savepoint has not been implemented yet. please rollback the transaction.
Related Table DDL
CREATETABLEtemp_txn_savepoint_2274ASSELECT id, company_name FROM company LIMIT5;
Reproduction SQL
START TRANSACTION;
UPDATE temp_txn_savepoint_2274 SET company_name = CONCAT(company_name, '_tx') WHERE id % 2=0;
SAVEPOINT before_revert;
UPDATE temp_txn_savepoint_2274 SET company_name = CONCAT(company_name, '_rollback') WHERE id % 2=1;
ROLLBACK TO SAVEPOINT before_revert;
COMMIT;
Impact
无法在长事务中做分段回滚,影响复杂 DML/调度流程。
MySQL 应用中依赖保存点的逻辑(如在线 DDL 工具、分批写入等)全部失效。
Expected Behavior
MySQL 允许创建多个保存点,并可回滚到任意保存点,同时保持事务继续。MatrixOne 应支持同等语义或提供清晰的功能缺失提示。
References
报告: report_test_batch_228_txn_boundary_20251124_154800.md Case 2274 等 10 个用例。
ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.
Expected: create savepoint s1, allowing a later ROLLBACK TO SAVEPOINT s1 while retaining earlier work. There is no equivalent transparent workaround for libraries that require nested transaction semantics; applications must avoid savepoints and restructure transactions.
Evidence is retained in server-scenarios-round2.json (R205), server-candidate-repros.sql, and direct-mysql-candidate-repros.log.
main@33af6ae3c0c23e4f277137460577ea64678f7ecf 上,通过 MySQL CLI 和 MatrixOne ODBC 9.7 均验证:
START TRANSACTION;
INSERT INTO repro_savepoint VALUES (1);
SAVEPOINT s1;
SAVEPOINT 仍返回 ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.。完整 ROLLBACK 可清理写入,但无法提供 ROLLBACK TO SAVEPOINT 语义。
changed the title [-]Transactions: SAVEPOINT not implemented[/-][+]Transactions: SAVEPOINT semantics are missing or inconsistent across clients[/+]on Oct 22, 2026
Consolidated reports #28248 and #30692 here as the same missing SAVEPOINT feature. Preserve the observed behavior discrepancy: #28248/#30692 report SAVEPOINT returning OK as a no-op followed by ROLLBACK TO failing; the newer reproduction already recorded on this issue reports SAVEPOINT itself returning the unimplemented error. Verify both paths on one exact commit/client matrix before treating the behavior as stable. Acceptance must cover SAVEPOINT, same-name replacement, ROLLBACK TO while keeping the transaction active, RELEASE, missing names, and cleanup at COMMIT/full ROLLBACK/implicit commit; no successful OK may represent a nonexistent savepoint.
ROLLBACK TO SAVEPOINT is rejected with 20101 internal error: savepoint has not been implemented yet. please rollback the transaction. — but the transaction stays open and later commits everything, including statements issued after the savepoint:
createtablesp(id intprimary key);
begin;
insert into sp values (1);
savepoint p1;
insert into sp values (2);
rollback to p1; -- ERROR 20101 (savepoint not implemented)commit; -- succeedsselectcount(*) from sp; -- 2 <-- the row that should have been rolled back is committed
So a client that uses the SQLAlchemy/SQL standard nested-transaction idiom (SAVEPOINT → work → ROLLBACK TO) gets an error it may catch, and then silently commits the nested work when the outer transaction commits. Either the statement should abort the transaction, or SAVEPOINT should be implemented; the current middle ground is the risky one.
Also verified as working, for contrast: full ROLLBACK reverts INSERT/UPDATE/DELETE including with secondary indexes; statement-level rollback on duplicate-key and foreign-key errors leaves the transaction usable and does not leave partial rows.
补充一条比"语句不可用"更严重的证据:ROLLBACK TO SAVEPOINT 报错之后,事务并没有被中止,仍然可以 COMMIT,于是本来要求丢弃的行被真实写入。
复现(main @ 3ad9adbb4c,macOS arm64,本地 mo-service)
createtablespx(id intprimary key, v varchar(5));
同一连接内依次执行(mysql --force,出错后继续后续语句):
begin;
insert into spx values(1,'w1');
savepoint sa;
insert into spx values(2,'w2');
rollback to sa; -- ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.commit; -- Query OKselect group_concat(v order by id) from spx;
实际输出:
ERROR 20101 (HY000) at line 5: internal error: savepoint has not been implemented yet. please rollback the transaction.
w1,w2
case*tree.SavePoint, *tree.ReleaseSavePoint:
returnnilcase*tree.RollbackToSavePoint:
returnmoerr.NewInternalError(execCtx.reqCtx, "savepoint has not been implemented yet. please rollback the transaction.")
SAVEPOINT / RELEASE SAVEPOINT 直接返回成功(no-op),ROLLBACK TO SAVEPOINT 在设置任何事务中止状态之前就 return,事务因此保持 active 且可提交。
Activity
iamlinjunhong commentedon Aug 20, 2026
Reconfirmed through MatrixOne ODBC and a direct MySQL 9.7.1 CLI on the latest
mainduring Python/pyodbc deep testing.592ad2190a90e063e3877059f4018427a10a49988f1ca365289a0f8ea0d22e6581cce1ea4ae67454Minimal sequence:
Actual result from both clients:
Expected: create savepoint
s1, allowing a laterROLLBACK TO SAVEPOINT s1while retaining earlier work. There is no equivalent transparent workaround for libraries that require nested transaction semantics; applications must avoid savepoints and restructure transactions.Evidence is retained in
server-scenarios-round2.json(R205),server-candidate-repros.sql, anddirect-mysql-candidate-repros.log.Ariznawlll commentedon Aug 25, 2026
测试版本
原问题验证
两个驱动各用 3 个新连接重复以下事务:
Happy Path 覆盖
Unhappy Path 覆盖
白盒验证
不适用。本次从 JDBC API 到服务端错误结果验证已有公开行为,没有引入故障注入。
回归测试
未新增回归用例。该产品路径尚未实现,不能把当前失败行为固化为成功基线。
测试证据
两代驱动各 3 次,共 6/6 次返回相同服务端错误;本 issue 现有 ODBC 与 MySQL CLI 复现可交叉印证。
测试结论
测试不通过。
iamlinjunhong commentedon Sep 1, 2026
最新 main 复测(2026-09-01)
main@33af6ae3c0c23e4f277137460577ea64678f7ecf上,通过 MySQL CLI 和 MatrixOne ODBC 9.7 均验证:SAVEPOINT仍返回ERROR 20101 (HY000): internal error: savepoint has not been implemented yet. please rollback the transaction.。完整ROLLBACK可清理写入,但无法提供ROLLBACK TO SAVEPOINT语义。[-]Transactions: SAVEPOINT not implemented[/-][+]Transactions: SAVEPOINT semantics are missing or inconsistent across clients[/+]XuPeng-SH commentedon Oct 22, 2026
Consolidated reports #28248 and #30692 here as the same missing SAVEPOINT feature. Preserve the observed behavior discrepancy: #28248/#30692 report SAVEPOINT returning OK as a no-op followed by ROLLBACK TO failing; the newer reproduction already recorded on this issue reports SAVEPOINT itself returning the unimplemented error. Verify both paths on one exact commit/client matrix before treating the behavior as stable. Acceptance must cover SAVEPOINT, same-name replacement, ROLLBACK TO while keeping the transaction active, RELEASE, missing names, and cleanup at COMMIT/full ROLLBACK/implicit commit; no successful OK may represent a nonexistent savepoint.
XuPeng-SH commentedon Oct 23, 2026
Fresh evidence on
main@3ad9adbb4cROLLBACK TO SAVEPOINTis rejected with20101 internal error: savepoint has not been implemented yet. please rollback the transaction.— but the transaction stays open and later commits everything, including statements issued after the savepoint:So a client that uses the SQLAlchemy/SQL standard nested-transaction idiom (SAVEPOINT → work → ROLLBACK TO) gets an error it may catch, and then silently commits the nested work when the outer transaction commits. Either the statement should abort the transaction, or SAVEPOINT should be implemented; the current middle ground is the risky one.
Also verified as working, for contrast: full
ROLLBACKreverts INSERT/UPDATE/DELETE including with secondary indexes; statement-level rollback on duplicate-key and foreign-key errors leaves the transaction usable and does not leave partial rows.XuPeng-SH commentedon Oct 23, 2026
补充一条比"语句不可用"更严重的证据:
ROLLBACK TO SAVEPOINT报错之后,事务并没有被中止,仍然可以 COMMIT,于是本来要求丢弃的行被真实写入。复现(main @
3ad9adbb4c,macOS arm64,本地 mo-service)同一连接内依次执行(
mysql --force,出错后继续后续语句):实际输出:
持久化结果:
1 w1/2 w2——w2是调用方明确要求回滚掉的那一行,却被提交了。对照组(同一连接、同样两条 INSERT、不使用 savepoint):结果为
c1,c2,符合预期。为什么这比"功能未实现"更值得处理
错误信息写的是 "please rollback the transaction",即由客户端负责收尾;但服务端既没有 abort 事务,也没有把它标记为不可提交。于是任何忽略 savepoint 错误继续执行的应用(ORM 的
begin_nested/transaction.atomic嵌套块、手写分批脚本的 error 分支)都会在COMMIT时把本想丢弃的 DML 一并提交 —— 静默的数据错误,而不是可观测的失败。白盒定位
pkg/frontend/mysql_cmd_executor.go:5758-5761:SAVEPOINT/RELEASE SAVEPOINT直接返回成功(no-op),ROLLBACK TO SAVEPOINT在设置任何事务中止状态之前就 return,事务因此保持 active 且可提交。建议
三个方向任选其一,但需要一致:
SAVEPOINT/RELEASE也立即报 not-supported(让驱动在第一条语句就失败,而不是走到无法收拾的中间态);ROLLBACK TO SAVEPOINT失败时必须把事务置为不可提交(后续COMMIT返回错误),避免"要求丢弃却被提交"。