diff options
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 531d639d6f4..184540b7aa9 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 && |