summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-12-09 11:21:23 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2017-12-09 11:21:23 +0200
commitfeb8296ee61cbd349a8bc13cac4e126306039fb5 (patch)
treea4e76a1eaa8b7c770a6046d755bf1a58201ede11 /sql
parente66bb5726716b7852c880e02b0acf0f5b9a1e8ee (diff)
downloadmariadb-git-feb8296ee61cbd349a8bc13cac4e126306039fb5.tar.gz
MDEV-14401: Stored procedure that declares a handler that catches ER_LOCK_DEADLOCK error causes thd->is_error() assertion
This was missing bug fix from MySQL wsrep i.e. Galera. Problem was that if stored procedure declares a handler that catches deadlock error, then the error may have been cleared in method sp_rcontext::handle_sql_condition(). Use wsrep_conflict_state correctly to determine is the error already sent to client. Add test case for both this bug and MDEV-12837: WSREP: BF lock wait long. Test requires both fixes to pass.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7337a8aeb21..5cea264e4a8 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5041,14 +5041,19 @@ end_with_restore_list:
thd->print_aborted_warning(3, "RELEASE");
}
#ifdef WITH_WSREP
- if (WSREP(thd) && (thd->wsrep_conflict_state != NO_CONFLICT &&
- thd->wsrep_conflict_state != REPLAYING))
- {
- DBUG_ASSERT(thd->is_error()); // the error is already issued
+ if (WSREP(thd)) {
+
+ if (thd->wsrep_conflict_state == NO_CONFLICT ||
+ thd->wsrep_conflict_state == REPLAYING)
+ {
+ my_ok(thd);
+ }
+ } else {
+#endif /* WITH_WSREP */
+ my_ok(thd);
+#ifdef WITH_WSREP
}
- else
#endif /* WITH_WSREP */
- my_ok(thd);
break;
}
case SQLCOM_ROLLBACK:
@@ -5085,13 +5090,16 @@ end_with_restore_list:
if (tx_release)
thd->set_killed(KILL_CONNECTION);
#ifdef WITH_WSREP
- if (WSREP(thd) && thd->wsrep_conflict_state != NO_CONFLICT)
- {
- DBUG_ASSERT(thd->is_error()); // the error is already issued
+ if (WSREP(thd)) {
+ if (thd->wsrep_conflict_state == NO_CONFLICT) {
+ my_ok(thd);
+ }
+ } else {
+#endif /* WITH_WSREP */
+ my_ok(thd);
+#ifdef WITH_WSREP
}
- else
#endif /* WITH_WSREP */
- my_ok(thd);
break;
}
case SQLCOM_RELEASE_SAVEPOINT:
@@ -5720,8 +5728,9 @@ finish:
if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR))
trans_rollback_stmt(thd);
#ifdef WITH_WSREP
- else if (thd->spcont &&
+ if (thd->spcont &&
(thd->wsrep_conflict_state == MUST_ABORT ||
+ thd->wsrep_conflict_state == ABORTED ||
thd->wsrep_conflict_state == CERT_FAILURE))
{
/*