summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sven@riska.(none)>2008-02-08 18:17:00 +0100
committerunknown <sven@riska.(none)>2008-02-08 18:17:00 +0100
commit5db7ee3ee94fcb4c698221fc5aac7bcefb54a7f6 (patch)
treedfa23c1d0952d0a0f6b8c2cbaf5aaca83888fa5e /mysql-test
parent187e5c5fa3444555b7e53addee6fb1dd947d4f5b (diff)
downloadmariadb-git-5db7ee3ee94fcb4c698221fc5aac7bcefb54a7f6.tar.gz
BUG#33247: mysqlbinlog does not clean up after itself on abnormal termination
Problem: mysqlbinlog does not free memory if an error happens. Fix: binlog-processing functions do not call exit() anymore. Instead, they print an error and return an error code. Error codes are propagated all the way back to main, and all allocated memory is freed on the way. client/mysqlbinlog.cc: - New error handling policy: functions processing binlogs don't just exit() anymore. Instead, they print a message and return an error status. - New policy for the global `mysql' and `glob_description_event': these are not passed as parameters anymore. The global pointer is used instead. - More error situations are detected and reported. - Better error messages: the program never terminates with exit status 1 without explanation any more. Fixed spelling errors. Use consistent format of messages (a single line beginning with "ERROR: " or "WARNING: " and ending with "." is printed to stderr.) - New memory handling: memory is always freed on program termination. - Better comments: more functions are explained, doxygen is used, and more precise formulations in some existing comments. mysql-test/suite/binlog/r/binlog_base64_flag.result: Result file updated since output format of mysqlbinlog changed while the test was disabled. mysql-test/suite/binlog/t/binlog_killed.test: Mysqlbinlog now works as described when the binlog is open. Hence, the --force-if-open flag must be passed mysql-test/suite/binlog/t/binlog_killed_simulate.test: Mysqlbinlog now works as described when the binlog is open. Hence, the --force-if-open flag must be passed mysql-test/suite/binlog/t/disabled.def: Now that mysqlbinlog cleans up after itself on abnormal termination, we can enable this test again.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result7
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test6
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test4
-rw-r--r--mysql-test/suite/binlog/t/disabled.def1
4 files changed, 11 insertions, 7 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index aa801346d9f..8e5d7def823 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -40,8 +40,13 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int) engine= myisam/*!*/;
+create table t1 (a int) engine= myisam
+/*!*/;
# at 203
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
==== Test non-matching FD event and Row event ====
BINLOG '
4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index e5f7288b17c..ab8a8cd59bd 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -39,7 +39,7 @@ connection con2;
reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
---exec $MYSQL_BINLOG --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
@@ -250,7 +250,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -296,7 +296,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index 2121a90dc8c..cb3b5a6e827 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -23,7 +23,7 @@ update t1 set a=2 /* will be "killed" after work has been done */;
#todo: introduce a suite private macro that provides numeric values
# for some constants like the offset of the first real event
# that is different between severs versions.
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -51,7 +51,7 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "kil
source include/show_binlog_events.inc;
---exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def
index c93bc2a158e..a6e73fa31d8 100644
--- a/mysql-test/suite/binlog/t/disabled.def
+++ b/mysql-test/suite/binlog/t/disabled.def
@@ -10,4 +10,3 @@
#
##############################################################################
binlog_multi_engine : Bug#32663 binlog_multi_engine.test fails randomly
-binlog_base64_flag : BUG#33247 2007-12-14 Sven: mysqlbinlog does not clean up after itself on termination. When compiled in debug mode, this test generates lots of warnings for memory leaks.