From a2f2f686cbcb239420724fe9b1520089933e36fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Dec 2018 15:50:01 +0200 Subject: [PATCH] Work around the crash in MDEV-17814 Internal transactions may not have trx->mysql_thd. But at the same time, trx->duplicates should only hold if REPLACE or INSERT...ON DUPLICATE KEY UPDATE was executed from SQL. The flag feels misplaced. A more appropriate place for it would be row_prebuilt_t or similar. --- sql/sql_class.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 71d5b80eaa3..86eb6f28807 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2017, MariaDB Corporation. + Copyright (c) 2008, 2018, MariaDB Corporation. 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 @@ -4525,7 +4525,8 @@ extern "C" int thd_rpl_is_parallel(const MYSQL_THD thd) extern "C" int thd_rpl_stmt_based(const MYSQL_THD thd) { - return !thd->is_current_stmt_binlog_format_row() && + return thd && + !thd->is_current_stmt_binlog_format_row() && !thd->is_current_stmt_binlog_disabled(); }