summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorDenis Protivensky <denis.protivensky@galeracluster.com>2023-03-14 14:08:12 +0300
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2023-04-19 14:08:57 +0200
commit210db2935cb3802f6806ba3b23c32263611e3e2f (patch)
treec9bdda1e0c6ea3bc02603c33dd191e724dba2183 /sql
parent75063d128812347228873e2dce4ae7799f348ebf (diff)
downloadmariadb-git-210db2935cb3802f6806ba3b23c32263611e3e2f.tar.gz
MDEV-30804 Rollback multi-engine transaction requiring 2PC but committing in one phase
Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 4afd30021ee..e0dd51376ad 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -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);