From 00b840b48afac3aabaf8e5b1522dc3d289ba2190 Mon Sep 17 00:00:00 2001 From: Venkatesh Duggirala Date: Fri, 29 Mar 2013 09:28:31 +0530 Subject: Bug#15948818-SEMI-SYNC ENABLED MASTER CRASHES WHEN EVENT SCHEDULER DROPS EVENTS Problem: On a semi sync enabled server (Master/Slave), if event scheduler drops an event after completion, server crashes. Analaysis: If an event is created with "ON COMPLETION NOT PRESERVE" clause, event scheduler deletes the event upon event completion(expiration) and the thread object will be destroyed. In the destructor of the thread object, mysys_var member is set to zero explicitly. Later from the same destructor call(same execution path), incase of semi sync enabled server, while cleanup is called, THD::mysys_var member is accessed by THD::enter_cond() function which causes server to crash. Fix: mysys_var should not be explicitly set to zero and also it is not required. sql/sql_class.cc: mysys_var should not be explicitly set to zero. --- sql/sql_class.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index effdfc4d6d6..639127125ca 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 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 @@ -1362,7 +1362,6 @@ THD::~THD() DBUG_ENTER("~THD()"); /* Ensure that no one is using THD */ mysql_mutex_lock(&LOCK_thd_data); - mysys_var=0; // Safety (shouldn't be needed) mysql_mutex_unlock(&LOCK_thd_data); add_to_status(&global_status_var, &status_var); -- cgit v1.2.1 From 975968e245994b45b11ade869e51d7db39c1707f Mon Sep 17 00:00:00 2001 From: Bill Qu Date: Sat, 27 Apr 2013 16:04:54 +0800 Subject: Bug #13004581 BLACKHOLE BINARY LOG WITH ROW IGNORES UPDATE AND DELETE STATEMENTS When logging to the binary log in row, updates and deletes to a BLACKHOLE engine table are skipped. It is impossible to log binary log in row format for updates and deletes to a BLACKHOLE engine table, as no row events can be generated in these cases. After fix, generate a warning for UPDATE/DELETE statements that modify a BLACKHOLE table, as row events are not logged in row format. --- sql/sql_class.cc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 639127125ca..a2e30bda20a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4411,6 +4411,44 @@ int THD::decide_logging_format(TABLE_LIST *tables) DBUG_PRINT("info", ("decision: logging in %s format", is_current_stmt_binlog_format_row() ? "ROW" : "STATEMENT")); + + if (variables.binlog_format == BINLOG_FORMAT_ROW && + (lex->sql_command == SQLCOM_UPDATE || + lex->sql_command == SQLCOM_UPDATE_MULTI || + lex->sql_command == SQLCOM_DELETE || + lex->sql_command == SQLCOM_DELETE_MULTI)) + { + String table_names; + /* + Generate a warning for UPDATE/DELETE statements that modify a + BLACKHOLE table, as row events are not logged in row format. + */ + for (TABLE_LIST *table= tables; table; table= table->next_global) + { + if (table->placeholder()) + continue; + if (table->table->file->ht->db_type == DB_TYPE_BLACKHOLE_DB && + table->lock_type >= TL_WRITE_ALLOW_WRITE) + { + table_names.append(table->table_name); + table_names.append(","); + } + } + if (!table_names.is_empty()) + { + bool is_update= (lex->sql_command == SQLCOM_UPDATE || + lex->sql_command == SQLCOM_UPDATE_MULTI); + /* + Replace the last ',' with '.' for table_names + */ + table_names.replace(table_names.length()-1, 1, ".", 1); + push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_WARN, + WARN_ON_BLOCKHOLE_IN_RBR, + ER(WARN_ON_BLOCKHOLE_IN_RBR), + is_update ? "UPDATE" : "DELETE", + table_names.c_ptr()); + } + } } #ifndef DBUG_OFF else -- cgit v1.2.1 From c50620f1d3871639a336fc1b2fdae7e7d5b80bc1 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 8 May 2013 12:08:20 +0200 Subject: Bug#16779374: NEW ERROR MESSAGE ADDED TO 5.5 AFTER 5.6 GA - REUSING NUMBER ALREADY USED BY 5.6 The problem was that the patch for Bug#13004581 added a new error message to 5.5. This causes it to use an error number already used in 5.6 by ER_CANNOT_LOAD_FROM_TABLE_V2. Which means that error message number stability between GA releases is broken. This patch fixes the problem by removing the error message and using ER_UNKNOWN_ERROR instead. --- sql/sql_class.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index a2e30bda20a..fb4ed99b8bb 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4443,8 +4443,10 @@ int THD::decide_logging_format(TABLE_LIST *tables) */ table_names.replace(table_names.length()-1, 1, ".", 1); push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_WARN, - WARN_ON_BLOCKHOLE_IN_RBR, - ER(WARN_ON_BLOCKHOLE_IN_RBR), + ER_UNKNOWN_ERROR, + "Row events are not logged for %s statements " + "that modify BLACKHOLE tables in row format. " + "Table(s): '%-.192s'", is_update ? "UPDATE" : "DELETE", table_names.c_ptr()); } -- cgit v1.2.1 From 742899e59d4d1c4ec8d32c140fe7ac4b134757e4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 7 Jun 2013 15:34:59 +0200 Subject: MDEV-4480 Assertion `inited == NONE' fails on closing a connection with open handler on temporary table --- sql/sql_class.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ca17cefff4c..94e58473a5e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1390,6 +1390,8 @@ void THD::cleanup(void) } #endif + mysql_ha_cleanup(this); + close_temporary_tables(this); transaction.xid_state.xa_state= XA_NOTR; @@ -1397,7 +1399,6 @@ void THD::cleanup(void) xid_cache_delete(&transaction.xid_state); locked_tables_list.unlock_locked_tables(this); - mysql_ha_cleanup(this); DBUG_ASSERT(open_tables == NULL); /* -- cgit v1.2.1 From 9675ddc9a2d5ede8b5403fae39da531fd7f22f7d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 1 Jul 2013 12:03:10 +0200 Subject: MDEV-4670 THD::awake bug with my_sleep call --- sql/sql_class.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 94e58473a5e..2d3d0930500 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1679,8 +1679,8 @@ void THD::awake(killed_state state_to_set) mysql_mutex_unlock(mysys_var->current_mutex); break; } + my_sleep(1000000L / WAIT_FOR_KILL_TRY_TIMES); } - my_sleep(1000000L / WAIT_FOR_KILL_TRY_TIMES); } mysql_mutex_unlock(&mysys_var->mutex); } -- cgit v1.2.1