mariadb/mysql-test/t/mysqlbinlog_row_big.test
Monty e64184134a mysqlbinlog now prints "# Number of rows" and stops on errors
Main problem was that no log-event print function checked for disk
full error on the IO_CACHE.
All changes in this patch only affects mysqlbinlog, not the server!

- Changed all log-event print functions to return 1 on error
- Fixed memory usage when not using --flashback.
- Added printing of number of rows in row events. Can be disabled with
  --print-row-count=0
- Print annotated rows when using mysqlbinlog --short-form
- Fixed that mysqlbinlog --debug works
- Fixed create_drop_binlog.test test failure
- Reorganized fields in PRINT_EVENT_INFO to be according to size to
  optimize storage
- Don't change print_row_event_position or print_row_counts if set by user
- Remove some testing of argument to my_free is 0
- base64-output=never is now supported and works in all context
- Updated help information for --base64-output and --short-form
- print_row_count is now on by default. Reset automatically if --short-form
  is used
- Removed obsolote warning for mysql 5.6.0
- More DBUG_PRINT for mysqltest.cc
- my_b_write_byte() now checks for flush failures. This fixed a memory
  overrun on disk full
- my_b_printf() now returns 1 on failure, 0 on ok.  This simplifies code
  and no old code was using the old return value of my_b_printf().
- my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok
- Fixed some error conditions in log printing that was not previously
  handled.
- Slave_rows_error_report() can now handle longlong positions
- Write_on_release_cache() rewritten so that we can detect errors
  on flush. Not depending on automatic release anymore.
- Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS
- Fixed that copy_event_cache_to_string_and_reinit() works with strings
  longer than 4G (Changed to use LEX_STRING instead of String)
- Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are
  anyway restricted to UINT32_MAX
- Fixed bug in rpl_binlog_state::write_to_iocache() which hide write
  failures (duplicate variable name)
- Fixed bug in String::append if original string was not allocated
- Stop mysqlbinlog output at once if there is an error.
- Before printing error message, flush result file. This ensures that
  the error message is printed last. (Easier to find)
2017-12-29 13:35:41 +02:00

148 lines
3.9 KiB
Text

# mysqlbinlog_big.test
#
# Show that mysqlbinlog can handle big rows.
#
#
# The *huge* output of mysqlbinlog will be redirected to
# $MYSQLTEST_VARDIR/$mysqlbinlog_output
#
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
#--source include/have_myisam.inc
--let $engine_type= MyISAM
#
# This test case is insensitive to the binlog format
# because we don't display the output of mysqlbinlog.
#
#--source include/have_binlog_format_row.inc
--source include/have_log_bin.inc
# This is a big test.
--source include/big_test.inc
--echo #
--echo # Preparatory cleanup.
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo #
--echo # We need a fixed timestamp to avoid varying results.
--echo #
SET timestamp=1000000000;
--echo #
--echo # We need big packets.
--echo #
--echo # Capture initial value to reset at the end of the test
# use let $<var> = query_get_value as FLUSH statements
# in the test will set @<var> values to NULL
let $orig_max_allowed_packet =
query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
--echo # Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 1024*1024*1024;
--echo max_allowed_packet is a global variable.
--echo In order for the preceding change in max_allowed_packets' value
--echo to be seen and used, we must start a new connection.
--echo The change does not take effect with the current one.
--echo For simplicity, we just disconnect / reconnect connection default here.
disconnect default;
connect (default, localhost,root,,);
--echo #
--echo # Delete all existing binary logs.
--echo #
RESET MASTER;
--echo #
--echo # Create a test table.
--echo #
eval CREATE TABLE t1 (
c1 LONGTEXT
) ENGINE=$engine_type DEFAULT CHARSET latin1;
--echo #
--echo # Show how many rows are affected by each statement.
--echo #
--enable_info
--echo #
--echo # Insert some big rows.
--echo #
--echo 64MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
--echo 32MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
--echo 4MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
--echo 512KB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
--echo #
--echo # Show what we have in the table.
--echo # Do not display the column value itself, just its length.
--echo #
--sorted_result
query_vertical SELECT LENGTH(c1) FROM t1;
--echo #
--echo # Grow the rows by updating.
--echo #
UPDATE t1 SET c1 = CONCAT(c1, c1);
--echo #
--echo # Show what we have in the table.
--echo # Do not display the column value itself, just its length.
--echo #
--sorted_result
query_vertical SELECT LENGTH(c1) FROM t1;
--echo #
--echo # Delete the rows.
--echo #
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
--echo #
--echo # Hide how many rows are affected by each statement.
--echo #
--disable_info
--echo #
--echo # Flush all log buffers to the log file.
--echo #
FLUSH LOGS;
--echo #
--echo # Call mysqlbinlog to display the log file contents.
--echo # NOTE: The output of mysqlbinlog is redirected to
--echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo # If you want to examine it, disable remove_file
--echo # at the bottom of the test script.
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--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 = #/
--exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo #
--echo # Cleanup.
--echo #
--echo # reset variable value to pass testcase checks
eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
DROP TABLE t1;
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
#
# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
#
--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output