Repository navigation
Description
Problem
MatrixOne makes CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE transactional. MySQL deliberately does not roll either operation back, although neither operation implicitly commits the surrounding transaction.
This creates two opposite compatibility differences:
- after
CREATE TEMPORARY TABLEfollowed byROLLBACK, MatrixOne removes the table while MySQL keeps an empty table; - after
DROP TEMPORARY TABLEfollowed byROLLBACK, MatrixOne restores the table and its rows while MySQL keeps it dropped.
DML against a temporary table that already existed before the transaction rolls back correctly in both systems.
Version
- MatrixOne main:
e7bb0572235ec4bac81eb098eb0ad8900f0065ab - MySQL: 8.3.0
CREATE followed by ROLLBACK
create database codex_temp_txn;
use codex_temp_txn;
create table base(id int primary key);
start transaction;
insert into base values(1);
create temporary table tr(id int primary key);
insert into tr values(1);
rollback;
select * from base;
select * from tr;
insert into tr values(2);Both systems roll back the permanent-table insert. MySQL retains tr with no rows and accepts the subsequent insert. MatrixOne reports that tr does not exist.
DROP followed by ROLLBACK
create temporary table td(id int primary key);
insert into td values(1);
start transaction;
insert into base values(3);
drop temporary table td;
rollback;
select * from base;
select * from td;
create temporary table td(id int primary key);Both systems roll back the permanent-table insert, confirming that DROP TEMPORARY TABLE does not implicitly commit.
MySQL keeps td dropped, so the SELECT reports 1146 and recreating it succeeds. MatrixOne restores td with row (1) and then reports 1050 when it is recreated.
Control cases
The following paths match MySQL:
- creating and populating a temporary table followed by
COMMITpreserves both definition and rows; - DML on a temporary table created before
START TRANSACTIONis rolled back while the table remains; - DML on the permanent table remains transactional when temporary-table DDL occurs in the same transaction.
Expected behavior
Temporary-table DDL should follow MySQL's transaction contract: it must not cause an implicit commit, but the CREATE or DROP itself must remain effective after a later rollback. Only transactional DML performed on the temporary table should be undone.
Activity
docs: define temporary DDL transaction ownership for matrixorigin#28255
docs: define temporary DDL transaction ownership for matrixorigin#28255
feat: make temporary DDL transaction-independent (#28332)
slyunnn commentedon Sep 9, 2026
Regression and extended verification for #28255 (2026-09-09)
Verification Environment
origin/mainat363f8c3fe63ab21f19d8e9ba854c24d2dcaadfc3—fix(logservice): retry transient HAKeeper backend closures (#28453).feat: make temporary DDL transaction-independent, merged ascc205f5f5ef16c4e462fe31dc5dd2632d27f9f94. The merge commit is an ancestor of the baseline.mo-servicehosts LOG/HAKeeper, one TN, and one CN. No Proxy and no second CN were used.127.0.0.1:6001; TN127.0.0.1:19000; Log/HAKeeper127.0.0.1:32001.mysqlCLI, PyMySQL, and MOTR/PyMySQL over MySQL wire protocol via TCP to127.0.0.1:6001.What Was Covered
CREATE TEMPORARY TABLEpath: afterROLLBACK, the permanent-table insert is absent, the temporary definition remains, its transaction-created row is absent, and a laterINSERTsucceeds.DROP TEMPORARY TABLEpath: afterROLLBACK, the permanent-table insert is absent, the temporary relation remains dropped withERROR 1146, and recreating the same name succeeds.CREATE TEMPORARY TABLEplus temporary DML followed byCOMMITretains both the definition and committed row.START TRANSACTIONrolls back while the table definition remains.DROPdoes not implicitly commit surrounding permanent-table DML; an explicitCOMMITpersists that permanent row while the dropped temporary table remains absent.CREATE, populate,DROP, recreate, and populate the same temporary name in one transaction leaves only the latest empty definition afterROLLBACK; subsequent temporary DML still rolls back normally.CTAS, failedCTAScleanup/retry, preparedCREATE, hidden-index definitions, repeatable-read snapshot behavior, and multi-session observation.8.3.0comparison and automatic removal on connection close; those compatibility facts were not changed by PR feat: make temporary DDL transaction-independent #28332 and were not needed to distinguish this rollback contract.Findings
The current
mainpreserves the intended MySQL-compatible boundary:CREATE TEMPORARY TABLEandDROP TEMPORARY TABLEneither implicitly commit the surrounding transaction nor have their definition effect reversed by a laterROLLBACK. Temporary-table DML and permanent-table DML remain transactional.Large-data regression is not required. This defect concerns transaction ownership of a session-local temporary-table definition; it does not depend on row count, block/batch boundaries, memory/spill, concurrency, skew, network transfer, or resource scale. One row per DML outcome and two same-name generations are the minimum stable data set for the relevant state transitions.
MOTR / BVT Coverage
suites/14_issue_regression/t/issue_28255_temp_ddl_rollback.testandsuites/14_issue_regression/r/issue_28255_temp_ddl_rollback.result.50statements with0failures.test/issue-28255-temp-ddl-rollback, commit85b720f. No issue-specific PR was created.Final Conclusion
Fixed. The current
maincontains the associated fix, and the original scenario plus happy-path, DML, commit, rollback, recreate-generation, and targeted BVT/MOTR coverage all pass. Large-data regression is not needed for the reasons above.feat: make temporary DDL transaction-independent (matrixorigin#28332)
feat: make temporary DDL transaction-independent (matrixorigin#28332)
feat: make temporary DDL transaction-independent (matrixorigin#28332)