diff options
author | Alexander Barkov <bar@mariadb.org> | 2018-01-15 13:50:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-01-15 13:50:28 +0400 |
commit | 88a9b23396531f0f0f63c1f989af69772216d442 (patch) | |
tree | 1ba43a3216ab692907124fa3f8c740362a4ff6b5 /sql/transaction.cc | |
parent | 5fe1d7d07611855963ea62ca39461289d8f8d25e (diff) | |
download | mariadb-git-88a9b23396531f0f0f63c1f989af69772216d442.tar.gz |
MDEV-14609 XA Transction unable to ROLLBACK TO SAVEPOINT
The function trans_rollback_to_savepoint(), unlike trans_savepoint(),
did not allow xa_state=XA_ACTIVE, so an attempt to do ROLLBCK TO SAVEPOINT
inside an XA transaction incorrectly returned an error
"...command cannot be executed ... in the ACTIVE state...".
Partially merging a MySQL patch:
7fb5c47390311d9b1b5367f97cb8fedd4102dd05
This is WL#7193 (Decouple THD and st_transactions)...
The currently merged part includes these changes:
- Introducing st_xid_state::check_has_uncommitted_xa()
- Reusing it in both trans_rollback_to_savepoint() and trans_savepoint(),
so now both allow XA_ACTIVE.
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index ae38e920a1d..6b09bd18d4c 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -433,12 +433,8 @@ bool trans_savepoint(THD *thd, LEX_STRING name) !opt_using_transactions) DBUG_RETURN(FALSE); - enum xa_states xa_state= thd->transaction.xid_state.xa_state; - if (xa_state != XA_NOTR && xa_state != XA_ACTIVE) - { - my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + if (thd->transaction.xid_state.check_has_uncommitted_xa()) DBUG_RETURN(TRUE); - } sv= find_savepoint(thd, name); @@ -513,12 +509,8 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name) DBUG_RETURN(TRUE); } - enum xa_states xa_state= thd->transaction.xid_state.xa_state; - if (xa_state != XA_NOTR) - { - my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + if (thd->transaction.xid_state.check_has_uncommitted_xa()) DBUG_RETURN(TRUE); - } if (ha_rollback_to_savepoint(thd, sv)) res= TRUE; |