From 8f21a3166908d71b5828d50bfce65b480508c6c1 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 10 Jul 2014 13:55:53 +0200 Subject: MDEV-6435: Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno() with parallel replication When a MyISAM query is killed midway, the query is logged to the binlog marked with the error. The slave does not attempt to run the query, but aborts with a suitable error message in the error log for the DBA to act on. In this case, the parallel replication code would check the sql_errno() code, even no my_error() had been set. In debug builds, this causes an assertion. Fixed the code to check that we actually have an error set before querying for an error code. --- sql/rpl_parallel.cc | 5 ++++- sql/sp_head.cc | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 98753865568..0d23248539c 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -234,8 +234,11 @@ static void convert_kill_to_deadlock_error(rpl_group_info *rgi) { THD *thd= rgi->thd; - int err_code= thd->get_stmt_da()->sql_errno(); + int err_code; + if (!thd->get_stmt_da()->is_error()) + return; + err_code= thd->get_stmt_da()->sql_errno(); if ((err_code == ER_QUERY_INTERRUPTED || err_code == ER_CONNECTION_KILLED) && rgi->killed_for_retry) { diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 8a9e8ddc816..73218b4fda8 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -43,6 +43,7 @@ #include "sql_base.h" // close_thread_tables #include "transaction.h" // trans_commit_stmt #include "sql_audit.h" +#include "debug_sync.h" /* Sufficient max length of printed destinations and frame offsets (all uints). @@ -1309,6 +1310,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) /* Discard the initial part of executing routines. */ thd->profiling.discard_current_query(); #endif + DEBUG_SYNC(thd, "sp_head_execute_before_loop"); do { sp_instr *i; -- cgit v1.2.1