diff --git a/sql/log_event.h b/sql/log_event.h index 222e611ecae..4e193232f4b 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2227,8 +2227,10 @@ public: virtual bool is_commit() { return false; } virtual bool is_rollback() { return false; } #ifdef MYSQL_SERVER - Query_compressed_log_event(THD* thd_arg, const char* query_arg, ulong query_length, - bool using_trans, bool direct, bool suppress_use, int error); + Query_compressed_log_event(THD* thd_arg, const char* query_arg, + ulong query_length, + bool using_trans, bool direct, bool suppress_use, + int error); virtual bool write(); #endif }; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e522fd1b1af..b94630274d5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -6562,8 +6562,8 @@ exit:; /** Check if we should log a table DDL to the binlog - @@return true yes - @@return false no + @retval true yes + @retval false no */ bool THD::binlog_table_should_be_logged(const LEX_CSTRING *db) @@ -7452,14 +7452,14 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, */ if (binlog_should_compress(query_len)) { - Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans, direct, - suppress_use, errcode); + Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans, + direct, suppress_use, errcode); error= mysql_bin_log.write(&qinfo); } else { Query_log_event qinfo(this, query_arg, query_len, is_trans, direct, - suppress_use, errcode); + suppress_use, errcode); error= mysql_bin_log.write(&qinfo); } /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5e0346c3977..7833059438e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1211,7 +1211,7 @@ values_loop_end: such case the flag is ignored for constructing binlog event. */ DBUG_ASSERT(thd->killed != KILL_BAD_DATA || error > 0); - if (was_insert_delayed && table_list->lock_type == TL_WRITE) + if (was_insert_delayed && table_list->lock_type == TL_WRITE) { /* Binlog INSERT DELAYED as INSERT without DELAYED. */ String log_query; @@ -3823,15 +3823,18 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) */ lex->current_select= lex->first_select_lex(); - res= setup_returning_fields(thd, table_list) || - setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0, 0) || - check_insert_fields(thd, table_list, *fields, values, - !insert_into_view, 1, &map); + res= (setup_returning_fields(thd, table_list) || + setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0, + 0) || + check_insert_fields(thd, table_list, *fields, values, + !insert_into_view, 1, &map)); if (!res && fields->elements) { - Abort_on_warning_instant_set aws(thd, !info.ignore && thd->is_strict_mode()); - res= check_that_all_fields_are_given_values(thd, table_list->table, table_list); + Abort_on_warning_instant_set aws(thd, + !info.ignore && thd->is_strict_mode()); + res= check_that_all_fields_are_given_values(thd, table_list->table, + table_list); } if (info.handle_duplicates == DUP_UPDATE && !res) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8db2ec3d761..16f4330637d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2828,6 +2828,12 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name, append_identifier(thd, &query, table_name); query.append(STRING_WITH_LEN("/* Generated to handle " "failed CREATE OR REPLACE */")); + + /* + In case of temporary tables we don't have to log the database name + in the binary log. We log this for non temporary tables, as the slave + may use a filter to ignore queries for a specific database. + */ error= thd->binlog_query(THD::STMT_QUERY_TYPE, query.ptr(), query.length(), FALSE, FALSE, temporary_table, 0) > 0; @@ -5205,7 +5211,8 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, thd->variables.option_bits|= OPTION_KEEP_LOG; thd->log_current_statement= 1; create_info->table_was_deleted= 1; - DBUG_EXECUTE_IF("send_kill_after_delete", thd->set_killed(KILL_QUERY); ); + DBUG_EXECUTE_IF("send_kill_after_delete", + thd->set_killed(KILL_QUERY); ); /* Restart statement transactions for the case of CREATE ... SELECT. @@ -5745,7 +5752,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, DBUG_ENTER("mysql_rename_table"); DBUG_ASSERT(base); DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'", - old_db->str, old_name->str, new_db->str, new_name->str)); + old_db->str, old_name->str, new_db->str, + new_name->str)); // Temporarily disable foreign key checks if (flags & NO_FK_CHECKS) @@ -5755,8 +5763,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, build_table_filename(from, sizeof(from) - 1, old_db->str, old_name->str, "", flags & FN_FROM_IS_TMP); - length= build_table_filename(to, sizeof(to) - 1, new_db->str, new_name->str, "", - flags & FN_TO_IS_TMP); + length= build_table_filename(to, sizeof(to) - 1, new_db->str, + new_name->str, "", flags & FN_TO_IS_TMP); // Check if we hit FN_REFLEN bytes along with file extension. if (length+reg_ext_length > FN_REFLEN) { diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 677e6cfa510..9417ec667ff 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1826,7 +1826,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db, TABLE table; char path[FN_REFLEN]; bool result= 0; - DBUG_ENTER("Triggers::drop_all_triggers"); + DBUG_ENTER("Table_triggers_list::drop_all_triggers"); table.reset(); init_sql_alloc(key_memory_Table_trigger_dispatcher,