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