mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for BUG#25628: "mysqlbinlog crashes while processing binary logs".
mysqlbinlog prints all row-based events of a single statement as a single "BINLOG" statement containing the concatenation of those events. Big (i.e. >64k) concatenations of row-based events (e.g. Write_rows_log_event) caused mysqlbinlog's IO_CACHE to overflow to a temporary file but the IO_CACHE had not been inited with open_cached_file(), so it tried to create a temporary file in an uninitialized directory (thus failing to create, then to write; some OS errors were printed, and it finally segfaulted). After fixing this, it appeared that mysqlbinlog was printing only a piece of big concatenations of row-based events (it printed at most the size of the IO_CACHE's buffer i.e. 64k); that caused data loss at restore. We fix and test that. Last, mysqlbinlog's printouts looked a bit strange with the informative header (#-prefixed) of groupped Rows_log_event all on one line, so we insert \n. After that, a small bug in the --hexdump code appeared (only if the string to hex-print had its length a multiple of 16), we fix it.
This commit is contained in:
@ -86,5 +86,25 @@ Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
flush logs;
|
||||
drop table t2;
|
||||
create table t2 (word varchar(20));
|
||||
load data infile '../std_data_ln/words.dat' into table t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
35840
|
||||
flush logs;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
35840
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
@ -31,6 +31,34 @@ drop table t2;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
#
|
||||
# Verify that events larger than the default IO_CACHE buffer
|
||||
# are handled correctly (BUG#25628).
|
||||
#
|
||||
flush logs;
|
||||
drop table t2;
|
||||
create table t2 (word varchar(20));
|
||||
load data infile '../std_data_ln/words.dat' into table t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
select count(*) from t2;
|
||||
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
|
||||
#
|
||||
# Verify that all binlog events have been executed
|
||||
#
|
||||
select count(*) from t2;
|
||||
|
||||
#
|
||||
# Test cleanup
|
||||
#
|
||||
|
Reference in New Issue
Block a user