From 9ba558302bbe95595c10175d34d4bf733da76fd7 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 9 Feb 2010 17:22:31 +0000 Subject: BUG#51021: current_stmt_binlog_row_based not removed in next-mr As part of BUG@39934 fix, the public: - THD::current_stmt_binlog_row_based variable had been removed and replaced by a private variable: - THD::current_stmt_binlog_format. THD was refactored and some modifiers and accessors were implemented for the new variable. However, due to a bad merge, the THD::current_stmt_binlog_row_based variable is back as a public member of THD. This in itself is already potentially harmful. What's even worse is that while merging some more patches and resolving conflicts, the variable started being used again, which is obviously wrong. To fix this we: 1. remove the extraneous variable from sql_class.h 2. revert a bad merge for BUG#49132 3. merge BUG#49132 properly again (actually, making use of the cset used to merge the original patch to mysql-pe). --- sql/sp.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'sql/sp.cc') diff --git a/sql/sp.cc b/sql/sp.cc index cbc0d003c9f..de379e7e725 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -927,8 +927,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); saved_count_cuted_fields= thd->count_cuted_fields; thd->count_cuted_fields= CHECK_FIELD_WARN; @@ -1136,7 +1136,8 @@ done: close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -1174,8 +1175,8 @@ sp_drop_routine(THD *thd, int type, sp_name *name) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -1194,7 +1195,8 @@ sp_drop_routine(THD *thd, int type, sp_name *name) close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } @@ -1233,8 +1235,8 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) row-based replication. The flag will be reset at the end of the statement. */ - save_binlog_row_based= thd->is_current_stmt_binlog_format_row(); - thd->clear_current_stmt_binlog_format_row(); + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->clear_current_stmt_binlog_format_row(); if (!(table= open_proc_table_for_update(thd))) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -1269,7 +1271,8 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) close_thread_tables(thd); /* Restore the state of binlog format */ - thd->current_stmt_binlog_row_based= save_binlog_row_based; + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); } -- cgit v1.2.1 From 7d213e8314d210e7ef975a9743f2dfa38ff1f6a6 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 10 Feb 2010 16:01:31 +0000 Subject: BUG#51021: current_stmt_binlog_row_based not removed in next-mr Deployed DBUG_ASSERT before the conditional binlog format restore. --- sql/sp.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/sp.cc') diff --git a/sql/sp.cc b/sql/sp.cc index de379e7e725..aae825c6c0d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1136,6 +1136,7 @@ done: close_thread_tables(thd); /* Restore the state of binlog format */ + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); if (save_binlog_row_based) thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); @@ -1195,6 +1196,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name) close_thread_tables(thd); /* Restore the state of binlog format */ + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); if (save_binlog_row_based) thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); @@ -1271,6 +1273,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) close_thread_tables(thd); /* Restore the state of binlog format */ + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); if (save_binlog_row_based) thd->set_current_stmt_binlog_format_row(); DBUG_RETURN(ret); -- cgit v1.2.1