summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/binlog/r/binlog_incident.result12
-rw-r--r--mysql-test/suite/binlog/t/binlog_incident-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_incident.test27
-rw-r--r--sql/log_event.cc2
4 files changed, 41 insertions, 1 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_incident.result b/mysql-test/suite/binlog/r/binlog_incident.result
new file mode 100644
index 00000000000..d8b0357b8c4
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_incident.result
@@ -0,0 +1,12 @@
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+a
+1
+2
+3
+REPLACE INTO t1 VALUES (4);
+DROP TABLE t1;
+FLUSH LOGS;
+Contain RELOAD DATABASE
+1
diff --git a/mysql-test/suite/binlog/t/binlog_incident-master.opt b/mysql-test/suite/binlog/t/binlog_incident-master.opt
new file mode 100644
index 00000000000..57ce0081ae5
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_incident-master.opt
@@ -0,0 +1 @@
+--loose-debug=+d,incident_database_resync_on_replace \ No newline at end of file
diff --git a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test
new file mode 100644
index 00000000000..208c7f24df2
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_incident.test
@@ -0,0 +1,27 @@
+# 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_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 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
+--disable_query_log
+eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
+--enable_query_log
+
+remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; \ No newline at end of file
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a10a36f3b43..cc144691fe1 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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