summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorTeemu Ollakka <teemu.ollakka@galeracluster.com>2019-03-08 17:22:30 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2019-03-11 16:33:01 +0200
commit15ccd3902e24279ff49c0365886824cf4de11b1a (patch)
tree8ee606d1d284c377a6233e9918f8f879db9a87f4 /sql/sp_head.cc
parent88d89ee0bae24b71416c2af4f4c2f2be7b6a033a (diff)
downloadmariadb-git-15ccd3902e24279ff49c0365886824cf4de11b1a.tar.gz
MDEV-18837 Fixed stored procedure wsrep error handling and MW-388
Fixed sync points in MW-388 and fixed SP wsrep error handling to avoid propagating wsrep errors via client-server protocol response.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index f2d3a01b953..dc5123efe36 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -3609,7 +3609,7 @@ sp_instr_stmt::exec_core(THD *thd, uint *nextp)
{
/*
SP was killed, and it is not due to a wsrep conflict.
- We skip after_command hook at this point because
+ We skip after_statement hook at this point because
otherwise it clears the error, and cleans up the
whole transaction. For now we just return and finish
our handling once we are back to mysql_parse.
@@ -3619,6 +3619,18 @@ sp_instr_stmt::exec_core(THD *thd, uint *nextp)
else
{
(void) wsrep_after_statement(thd);
+ /*
+ Final wsrep error status for statement is known only after
+ wsrep_after_statement() call. If the error is set, override
+ error in thd diagnostics area and reset wsrep client_state error
+ so that the error does not get propagated via client-server protocol.
+ */
+ if (wsrep_current_error(thd))
+ {
+ wsrep_override_error(thd, wsrep_current_error(thd),
+ wsrep_current_error_status(thd));
+ thd->wsrep_cs().reset_error();
+ }
}
#endif /* WITH_WSREP */
MYSQL_QUERY_EXEC_DONE(res);