summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-05-03 18:10:13 +0200
committerSergei Golubchik <serg@mariadb.org>2021-05-08 18:02:34 +0200
commit66acec99d5877241b694493e96a0265be9260c69 (patch)
treef26c6933c7a32ad0b0c47893c3baf8c774690732 /sql
parent18fbe566bdf7420fbd9b4a1a8bede76e351d3b95 (diff)
downloadmariadb-git-66acec99d5877241b694493e96a0265be9260c69.tar.gz
XA PREPARE and SHOW STATUS
XA transaction only allows to access data in specific states, in ACTIVE, but not in IDLE or PREPARE. But even then one should be able to run SHOW STATUS.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 16689f86c4e..e3c30c7433b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3985,13 +3985,19 @@ bool open_tables(THD *thd, const DDL_options_st &options,
bool has_prelocking_list;
DBUG_ENTER("open_tables");
- /* Accessing data in XA_IDLE or XA_PREPARED is not allowed. */
- enum xa_states xa_state= thd->transaction.xid_state.xa_state;
- if (*start && (xa_state == XA_IDLE || xa_state == XA_PREPARED))
- {
- my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
- DBUG_RETURN(true);
- }
+ /* Data access in XA transaction is only allowed when it is active. */
+ for (TABLE_LIST *table= *start; table; table= table->next_global)
+ if (!table->schema_table)
+ {
+ enum xa_states xa_state= thd->transaction.xid_state.xa_state;
+ if (xa_state == XA_IDLE || xa_state == XA_PREPARED)
+ {
+ my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
+ DBUG_RETURN(true);
+ }
+ else
+ break;
+ }
thd->current_tablenr= 0;
restart: