Commit 210db293 authored by Denis Protivensky's avatar Denis Protivensky Committed by Julius Goryavsky

MDEV-30804 Rollback multi-engine transaction requiring 2PC but committing in one phase

Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 75063d12
connection node_2;
connection node_1;
CREATE TABLE t (a INT) ENGINE=Aria;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t VALUES ('1');
INSERT INTO t1 VALUES ('1');
COMMIT;
ERROR HY000: Transactional commit not supported by involved engine(s)
DROP TABLE t;
DROP TABLE t1;
!include ../galera_2nodes.cnf
[mysqld.1]
log-bin
[mysqld.2]
log-bin
#
# Test that transaction requiring two-phase commit and involving
# storage engines not supporting it rolls back with a message.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_aria.inc
CREATE TABLE t (a INT) ENGINE=Aria;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t VALUES ('1');
INSERT INTO t1 VALUES ('1');
--error ER_ERROR_DURING_COMMIT
COMMIT;
DROP TABLE t;
DROP TABLE t1;
......@@ -1733,7 +1733,19 @@ int ha_commit_trans(THD *thd, bool all)
ordering is normally done. Commit ordering must be done here.
*/
if (run_wsrep_hooks)
error= wsrep_before_commit(thd, all);
{
// This commit involves more than one storage engine and requires
// two phases, but some engines don't support it.
// Issue a message to the client and roll back the transaction.
if (trans->no_2pc && rw_ha_count > 1)
{
my_message(ER_ERROR_DURING_COMMIT, "Transactional commit not supported "
"by involved engine(s)", MYF(0));
error= 1;
}
else
error= wsrep_before_commit(thd, all);
}
if (error)
{
ha_rollback_trans(thd, FALSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment