1# mysqlbinlog_big.test
2#
3# Show that mysqlbinlog can handle big rows.
4#
5
6#
7# The *huge* output of mysqlbinlog will be redirected to
8# $MYSQLTEST_VARDIR/$mysqlbinlog_output
9#
10--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
11
12--source include/have_binlog_format_row.inc
13
14--source include/have_log_bin.inc
15
16# This is a big test.
17--source include/big_test.inc
18# Test needs more than 4G of memory
19--source include/have_64bit.inc
20
21--echo #
22--echo # Preparatory cleanup.
23--echo #
24--disable_warnings
25drop database if exists mysqltest;
26create database mysqltest;
27use mysqltest;
28DROP TABLE IF EXISTS t1;
29--enable_warnings
30
31--echo #
32--echo # We need a fixed timestamp to avoid varying results.
33--echo #
34SET timestamp=1000000000;
35
36--echo #
37--echo # We need big packets.
38--echo #
39--echo # Capture initial value to reset at the end of the test
40# use let $<var> = query_get_value as FLUSH statements
41# in the test will set @<var> values to NULL
42let $orig_max_allowed_packet =
43query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
44
45--echo # Now adjust max_allowed_packet
46SET @@global.max_allowed_packet= 10*1024*1024*1024;
47
48--echo max_allowed_packet is a global variable.
49--echo In order for the preceding change in max_allowed_packets' value
50--echo to be seen and used, we must start a new connection.
51--echo The change does not take effect with the current one.
52--echo For simplicity, we just disconnect / reconnect connection default here.
53disconnect default;
54connect (default, localhost,root,,);
55
56--echo #
57--echo # Delete all existing binary logs.
58--echo #
59RESET MASTER;
60
61--echo #
62--echo # Create a test table.
63--echo #
64use mysqltest;
65eval CREATE TABLE t1 (
66  c1 LONGTEXT
67  ) DEFAULT CHARSET latin1;
68
69--echo #
70--echo # Show how many rows are affected by each statement.
71--echo #
72--enable_info
73
74--echo #
75--echo # Insert some big rows.
76--echo #
77
78--echo insert 1024MB data twice
79INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 67108864));
80INSERT INTO t1 VALUES (REPEAT('MegaByteBlckMany', 67108864));
81
82--echo #
83--echo # Flush all log buffers to the log file.
84--echo #
85FLUSH LOGS;
86
87--echo #
88--echo # Call mysqlbinlog to display the log file contents.
89--echo # NOTE: The output of mysqlbinlog is redirected to
90--echo #       \$MYSQLTEST_VARDIR/$mysqlbinlog_output
91--echo #       If you want to examine it, disable remove_file
92--echo #       at the bottom of the test script.
93--echo #
94let $MYSQLD_DATADIR= `select @@datadir`;
95--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
96--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
97--exec $MYSQL_BINLOG -B -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
98
99--echo #
100--echo # Cleanup.
101--echo #
102--echo # reset variable value to pass testcase checks
103--disable_query_log
104eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
105--enable_query_log
106DROP TABLE t1;
107drop database if exists mysqltest;
108
109--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
110#
111# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
112#
113--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
114
115