summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 19:11:36 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 19:11:36 +0200
commitc498250888ec126fddda2867d1239b2a7734482f (patch)
treee308174c977c0981d8e36f6f9b791b1b266d0cb0 /sql/sql_prepare.cc
parent09a1f0075a8d5752dd7b2940a20d86a040af1741 (diff)
parent1418439d3823fe059b41092af72ab32d5e7cd7ab (diff)
downloadmariadb-git-bb-10.6-georg.tar.gz
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 57d6b27fcbb..ec76d1f3ff0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB
+ Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -122,7 +122,10 @@ When one supplies long data for a placeholder:
#include "sql_handler.h"
#include "transaction.h" // trans_rollback_implicit
#include "mysql/psi/mysql_ps.h" // MYSQL_EXECUTE_PS
+#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
+#include "wsrep_trans_observer.h"
+#endif /* WITH_WSREP */
/* Constants defining bits in parameter type flags. Flags are read from high byte of short value */
static const uint PARAMETER_FLAG_UNSIGNED = 128U << 8;
@@ -4607,6 +4610,23 @@ reexecute:
thd->m_reprepare_observer= NULL;
+#ifdef WITH_WSREP
+ if (!(sql_command_flags[lex->sql_command] & CF_PS_ARRAY_BINDING_OPTIMIZED) &&
+ WSREP(thd))
+ {
+ if (wsrep_after_statement(thd))
+ {
+ /*
+ Re-execution success is unlikely after an error from
+ wsrep_after_statement(), so retrun error immediately.
+ */
+ thd->get_stmt_da()->reset_diagnostics_area();
+ wsrep_override_error(thd, thd->wsrep_cs().current_error(),
+ thd->wsrep_cs().current_error_status());
+ }
+ }
+ else
+#endif /* WITH_WSREP */
if (unlikely(error) &&
(sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) &&
!thd->is_fatal_error && !thd->killed &&