3 # Show that mysqlbinlog can handle big rows.
7 # The *huge* output of mysqlbinlog will be redirected to
8 # $MYSQLTEST_VARDIR/$mysqlbinlog_output
10 --let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
12 #--source include/have_myisam.inc
13 --let $engine_type= MyISAM
16 # This test case is insensitive to the binlog format
17 # because we don't display the output of mysqlbinlog.
19 #--source include/have_binlog_format_row.inc
21 --source include/have_log_bin.inc
24 --source include/big_test.inc
27 --echo # Preparatory cleanup.
30 DROP TABLE IF EXISTS t1;
34 --echo # We need a fixed timestamp to avoid varying results.
36 SET timestamp=1000000000;
39 --echo # We need big packets.
41 --echo # Capture initial value to reset at the end of the test
42 # use let $<var> = query_get_value as FLUSH statements
43 # in the test will set @<var> values to NULL
44 let $orig_max_allowed_packet =
45 query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
47 --echo # Now adjust max_allowed_packet
48 SET @@global.max_allowed_packet= 1024*1024*1024;
50 --echo max_allowed_packet is a global variable.
51 --echo In order for the preceding change in max_allowed_packets' value
52 --echo to be seen and used, we must start a new connection.
53 --echo The change does not take effect with the current one.
54 --echo For simplicity, we just disconnect / reconnect connection default here.
55 --echo Disconnecting default connection...
57 --echo Reconnecting default connection...
58 connect (default, localhost,root,,);
59 --echo default connection established, continuing with the test
62 --echo # Delete all existing binary logs.
67 --echo # Create a test table.
69 eval CREATE TABLE t1 (
71 ) ENGINE=$engine_type DEFAULT CHARSET latin1;
74 --echo # Show how many rows are affected by each statement.
79 --echo # Insert some big rows.
83 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
86 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
89 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
92 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
95 --echo # Show what we have in the table.
96 --echo # Do not display the column value itself, just its length.
99 query_vertical SELECT LENGTH(c1) FROM t1;
102 --echo # Grow the rows by updating.
104 UPDATE t1 SET c1 = CONCAT(c1, c1);
107 --echo # Show what we have in the table.
108 --echo # Do not display the column value itself, just its length.
111 query_vertical SELECT LENGTH(c1) FROM t1;
114 --echo # Delete the rows.
116 DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
119 --echo # Hide how many rows are affected by each statement.
124 --echo # Flush all log buffers to the log file.
129 --echo # Call mysqlbinlog to display the log file contents.
130 --echo # NOTE: The output of mysqlbinlog is redirected to
131 --echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
132 --echo # If you want to examine it, disable remove_file
133 --echo # at the bottom of the test script.
135 let $MYSQLD_DATADIR= `select @@datadir`;
136 --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
137 --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 = #/
138 --exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
143 --echo # reset variable value to pass testcase checks
144 eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
147 --echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
149 # NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
151 --remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output