List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:April 30 2009 1:59pm
Subject:bzr commit into mysql-5.1-bugteam branch (mats:2872) Bug#44442
View as plain text  
#At file:///home/bzr/bugs/b44442-5.1-bugteam/ based on revid:patrick.crews@stripped

 2872 Mats Kindahl	2009-04-30
      Bug #44442: Incident events are silent in mysqlbinlog output
      
      In the output from mysqlbinlog, incident log events were
      represented as just a comment. Since the incident log event
      represents an incident that could cause the contents of the
      database to change without being logged to the binary log,
      it means that if the SQL is applied to a server, it could
      potentially lead to that the databases are out of sync.
      
      In order to handle that, this patch adds the statement "RELOAD
      DATABASE" to the SQL output for the incident log event. This will
      require a DBA to edit the file and handle the case as apropriate
      before applying the output to a server.
     @ mysql-test/suite/binlog/std_data/binlog_incident-bug44442.sql
        Reference for mysqlbinlog output.
     @ mysql-test/suite/binlog/t/binlog_incident-master.opt
        Options file to cause server to generate an incident log
        event when executing a REPLACE.
     @ mysql-test/suite/binlog/t/binlog_incident.test
        Test to check that the incident log event is represented
        correctly in the output from mysqlbinlog.
     @ sql/log_event.cc
        The incident log event now ouput a "RELOAD DATABASE" instead
        of just a comment. RELOAD DATABASE is not an existing command
        and will generate a syntax error.

    added:
      mysql-test/suite/binlog/std_data/binlog_incident-bug44442.sql
      mysql-test/suite/binlog/t/binlog_incident-master.opt
      mysql-test/suite/binlog/t/binlog_incident.test
    modified:
      sql/log_event.cc
=== added file 'mysql-test/suite/binlog/std_data/binlog_incident-bug44442.sql'
--- a/mysql-test/suite/binlog/std_data/binlog_incident-bug44442.sql	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/std_data/binlog_incident-bug44442.sql	2009-04-30 13:59:08 +0000
@@ -0,0 +1,31 @@
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 106
+#YYMMDD HH:MM:SS server id 1  end_log_pos 192 	Query	thread_id=2	exec_time=0	error_code=0
+use test/*!*/;
+SET TIMESTAMP=nnn/*!*/;
+SET @@session.pseudo_thread_id=2/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (a INT)
+/*!*/;
+# at 192
+#YYMMDD HH:MM:SS server id 1  end_log_pos 288 	Query	thread_id=2	exec_time=0	error_code=0
+SET TIMESTAMP=nnn/*!*/;
+INSERT INTO t1 VALUES (1),(2),(3)
+/*!*/;
+# at 288
+#YYMMDD HH:MM:SS server id 1  end_log_pos 310 
+# Incident: LOST_EVENTS
+RELOAD DATABASE; # Shall generate syntax error# at 310
+#YYMMDD HH:MM:SS server id 1  end_log_pos 354 	Rotate to master-bin.000002  pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

=== added file 'mysql-test/suite/binlog/t/binlog_incident-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_incident-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_incident-master.opt	2009-04-30 13:59:08 +0000
@@ -0,0 +1 @@
+--loose-debug=+d,incident_database_resync_on_replace
\ No newline at end of file

=== added file 'mysql-test/suite/binlog/t/binlog_incident.test'
--- a/mysql-test/suite/binlog/t/binlog_incident.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_incident.test	2009-04-30 13:59:08 +0000
@@ -0,0 +1,26 @@
+# The purpose of this test is to provide a reference for how the
+# incident log event is represented in the output from the mysqlbinlog
+# program.
+
+source include/have_log_bin.inc;
+source include/have_binlog_format_statement.inc;
+source include/have_debug.inc;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+
+# This will generate an incident log event and store it in the binary
+# log before the replace statement.
+REPLACE INTO t1 VALUES (4);
+
+DROP TABLE t1;
+FLUSH LOGS;
+
+exec $MYSQL_BINLOG --start-position=106 --base64-output=never $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+exec perl -pi.bak -e 's/#\d{6} \d\d:\d\d:\d\d/#YYMMDD HH:MM:SS/g;s/SET TIMESTAMP=\d+/SET TIMESTAMP=nnn/' $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+diff_files suite/binlog/std_data/binlog_incident-bug44442.sql $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
\ No newline at end of file

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-04-21 14:31:21 +0000
+++ b/sql/log_event.cc	2009-04-30 13:59:08 +0000
@@ -9311,7 +9311,7 @@ Incident_log_event::print(FILE *file,
 
   Write_on_release_cache cache(&print_event_info->head_cache, file);
   print_header(&cache, print_event_info, FALSE);
-  my_b_printf(&cache, "\n# Incident: %s", description());
+  my_b_printf(&cache, "\n# Incident: %s\nRELOAD DATABASE; # Shall generate syntax error\n", description());
 }
 #endif
 


Attachment: [text/bzr-bundle] bzr/mats@sun.com-20090430135908-qwqh5t6os4tdmwx9.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (mats:2872) Bug#44442Mats Kindahl30 Apr
  • Re: bzr commit into mysql-5.1-bugteam branch (mats:2872) Bug#44442Alfranio Correia11 May
    • Re: bzr commit into mysql-5.1-bugteam branch (mats:2872) Bug#44442Mats Kindahl11 May