From f8aadb60947b6f94ffd6ddec77036091593b54a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Sep 2005 17:58:00 +0200 Subject: [PATCH] BUG#12542: Added comments sql/log_event.cc: Added comments sql/sql_parse.cc: Added comments --- sql/log_event.cc | 20 ++++++++++++++++++++ sql/sql_parse.cc | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 66c732e8cb0..b08439a20b8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1008,6 +1008,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) #endif clear_all_errors(thd, rli); + /* + Note: We do not need to execute reset_one_shot_variables() if this + db_ok() test fails. + Reason: The db stored in binlog events is the same for SET and for + its companion query. If the SET is ignored because of + db_ok(), the companion query will also be ignored, and if + the companion query is ignored in the db_ok() test of + ::exec_event(), then the companion SET also have so we + don't need to reset_one_shot_variables(). + */ if (db_ok(thd->db, replicate_do_db, replicate_ignore_db)) { thd->set_time((time_t)when); @@ -1762,6 +1772,16 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, Create_file_log_event::exec_event() and then discarding Append_block and al. Another way is do the filtering in the I/O thread (more efficient: no disk writes at all). + + + Note: We do not need to execute reset_one_shot_variables() if this + db_ok() test fails. + Reason: The db stored in binlog events is the same for SET and for + its companion query. If the SET is ignored because of + db_ok(), the companion query will also be ignored, and if + the companion query is ignored in the db_ok() test of + ::exec_event(), then the companion SET also have so we + don't need to reset_one_shot_variables(). */ if (db_ok(thd->db, replicate_do_db, replicate_ignore_db)) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8e457b67f00..94064d5ddfa 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1998,7 +1998,8 @@ mysql_execute_command(THD *thd) Exceptions are: - SET: we always execute it (Not that many SET commands exists in - the binary log anyway) + the binary log anyway -- only 4.1 masters write SET statements, + in 5.0 there are no SET statements in the binary log) - DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we have stale files on slave caused by exclusion of one tmp table). */