Commit e9c10f99 authored by Jan Lindström's avatar Jan Lindström

MDEV-7908: assertion in innobase_release_savepoint

Problem was that in XA prepared state we should still be able to
release a savepoint, but assertions were too strict.
parent b53bcd43
xa rollback 'xid2';
ERROR XAE04: XAER_NOTA: Unknown XID
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create table t1(a int)engine=innodb;
rollback;
xa start 'xid2';
insert into `t1` values (1);
savepoint `sv1`;
xa end 'xid2';
start transaction;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
xa prepare 'xid2';
release savepoint `sv1`;
xa commit 'xid2';
drop table t1;
--source include/have_innodb.inc
--disable_abort_on_error
xa rollback 'xid2';
drop table if exists t1;
create table t1(a int)engine=innodb;
rollback;
xa start 'xid2';
insert into `t1` values (1);
savepoint `sv1`;
xa end 'xid2';
start transaction;
xa prepare 'xid2';
release savepoint `sv1`;
xa commit 'xid2';
drop table t1;
......@@ -4116,7 +4116,10 @@ innobase_release_savepoint(
DBUG_ASSERT(hton == innodb_hton_ptr);
trx = check_trx_exists(thd);
trx_start_if_not_started(trx);
if (trx->state == TRX_STATE_NOT_STARTED) {
trx_start_if_not_started(trx);
}
/* TODO: use provided savepoint data area to store savepoint data */
......
......@@ -495,7 +495,7 @@ trx_release_savepoint_for_mysql(
{
trx_named_savept_t* savep;
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || trx_state_eq(trx, TRX_STATE_PREPARED));
ut_ad(trx->in_mysql_trx_list);
savep = trx_savepoint_find(trx, savepoint_name);
......
......@@ -4679,7 +4679,10 @@ innobase_release_savepoint(
DBUG_ASSERT(hton == innodb_hton_ptr);
trx = check_trx_exists(thd);
trx_start_if_not_started(trx);
if (trx->state == TRX_STATE_NOT_STARTED) {
trx_start_if_not_started(trx);
}
/* TODO: use provided savepoint data area to store savepoint data */
......
......@@ -492,7 +492,7 @@ trx_release_savepoint_for_mysql(
{
trx_named_savept_t* savep;
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || trx_state_eq(trx, TRX_STATE_PREPARED));
ut_ad(trx->in_mysql_trx_list);
savep = trx_savepoint_find(trx, savepoint_name);
......
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