| 1 |
# |
| 2 |
# Purpose: |
| 3 |
# When using mariadb-binlog with options for --raw and --stop-never, events |
| 4 |
# from the master's currently active log file should be written to their |
| 5 |
# respective log file specified by --result-file, and shown on-disk. This test |
| 6 |
# ensures that the log files on disk, created by mariadb-binlog, have the most |
| 7 |
# up-to-date events from the master. |
| 8 |
# Option --raw works only with --read-from-remote-server, otherwise returns error. |
| 9 |
# |
| 10 |
# Methodology: |
| 11 |
# On the master, rotate to a newly active binlog file and write an event to |
| 12 |
# it. Read the master's binlog using mariadb-binlog with --raw and --stop-never |
| 13 |
# and write the data to an intermediary binlog file (a timeout is used on this |
| 14 |
# command to ensure it exits). Read the local intermediary binlog file to ensure |
| 15 |
# that the master's most recent event exists in the local file. |
| 16 |
# |
| 17 |
# References: |
| 18 |
# MDEV-14608: mysqlbinlog lastest backupfile size is 0 |
| 19 |
# |
| 20 |
|
| 21 |
--source include/linux.inc |
| 22 |
--source include/have_log_bin.inc |
| 23 |
# Test needs to reset the binlog as it is checking specific GTID. |
| 24 |
RESET MASTER; |
| 25 |
|
| 26 |
RESET MASTER; |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options |
| 30 |
--echo # --raw [and] --flashback |
| 31 |
--echo # |
| 32 |
# Test --raw format without -R (--read-from-remote-server) |
| 33 |
--error 1 # Error 1 operation not permitted |
| 34 |
--exec $MYSQL_BINLOG --raw --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 |
| 35 |
|
| 36 |
# Create newly active log |
| 37 |
CREATE TABLE t1 (a int); |
| 38 |
FLUSH LOGS; |
| 39 |
INSERT INTO t1 VALUES (1); |
| 40 |
|
| 41 |
# Read binlog data from master to intermediary result file |
| 42 |
--let TIMEOUT=5 |
| 43 |
--echo # timeout TIMEOUT MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=MASTER_MYPORT --stop-never --result-file=MYSQLTEST_VARDIR/tmp/ master-bin.000001 |
| 44 |
--error 124 # Error 124 means timeout was reached |
| 45 |
--exec timeout $TIMEOUT $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 |
| 46 |
|
| 47 |
# Ensure the binlog output has the most recent events from the master |
| 48 |
--echo # MYSQL_BINLOG MYSQLTEST_VARDIR/tmp/master-bin.000002 > MYSQLTEST_VARDIR/tmp/local-bin.000002.out |
| 49 |
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/tmp/master-bin.000002 > $MYSQLTEST_VARDIR/tmp/local-bin.000002.out |
| 50 |
--let SEARCH_PATTERN= GTID 0-1-2 |
| 51 |
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/local-bin.000002.out |
| 52 |
--source include/search_pattern_in_file.inc |
| 53 |
|
| 54 |
# Cleanup |
| 55 |
DROP TABLE t1; |
| 56 |
--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001 |
| 57 |
--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002 |
| 58 |
--remove_file $MYSQLTEST_VARDIR/tmp/local-bin.000002.out |