Commit df05e311 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-34589 pass error from ha_rollback_trans() to trans_rollback_stmt()

Storage engine handler rollback may fail, in which case
ha_rollback_trans() should indicate failure too, otherwise the
dastatus may be inconsistent.
parent 3e93edb6
......@@ -2141,7 +2141,6 @@ int ha_rollback_trans(THD *thd, bool all)
handlerton *ht= ha_info->ht();
if ((err= ht->rollback(ht, thd, all)))
{
// cannot happen
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), err);
error=1;
#ifdef WITH_WSREP
......
......@@ -518,6 +518,7 @@ bool trans_commit_stmt(THD *thd)
*/
bool trans_rollback_stmt(THD *thd)
{
bool ret= FALSE;
DBUG_ENTER("trans_rollback_stmt");
/*
......@@ -532,7 +533,7 @@ bool trans_rollback_stmt(THD *thd)
if (thd->transaction->stmt.ha_list)
{
ha_rollback_trans(thd, FALSE);
ret= ha_rollback_trans(thd, FALSE) ? TRUE : FALSE;
if (! thd->in_active_multi_stmt_transaction())
trans_reset_one_shot_chistics(thd);
}
......@@ -547,7 +548,7 @@ bool trans_rollback_stmt(THD *thd)
thd->transaction->stmt.reset();
DBUG_RETURN(FALSE);
DBUG_RETURN(ret);
}
/* Find a named savepoint in the current transaction. */
......
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE USER spider@localhost IDENTIFIED BY 'pwd';
GRANT ALL ON test.* TO spider@localhost;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd');
SET spider_internal_sql_log_off=0;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2;
call mtr.add_suppression(".*\\[Warning\\] WSREP: handlerton rollback failed,.* SQL CHECK TABLE t2");
CHECK TABLE t2;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
drop table t1, t2;
drop server srv;
drop user spider@localhost;
for master_1
for child2
for child3
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link= 1;
CREATE USER spider@localhost IDENTIFIED BY 'pwd';
GRANT ALL ON test.* TO spider@localhost;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd');
SET spider_internal_sql_log_off=0;
CREATE TABLE t1 (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2;
call mtr.add_suppression(".*\\[Warning\\] WSREP: handlerton rollback failed,.* SQL CHECK TABLE t2");
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CHECK TABLE t2;
drop table t1, t2;
drop server srv;
drop user spider@localhost;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
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