Debian Codegraph @

mysql-test/suite/binlog/t/binlog_mysqlbinlog_stop_never.test

raw
1 # ==== Purpose ====
2 #
3 # Test verifies that continuous streaming of binary log content using the
4 # "mysqlbinlog --stop-never" option and sourcing it to mysql client works
5 # fine.
6 #
7 # ==== Implementation ====
8 #
9 # Steps:
10 # 1 - Create a table on a server on which binary log is enabled and insert
11 # a row.
12 # 2 - Disable the binary log on the server and drop the table.
13 # 3 - Capture the binary log output using "mysqlbinlog --stop_never" option
14 # and source it to mysql client.
15 # 4 - Query the PROCESSLIST table to ensure that the dump thread which is
16 # serving "stop_never" option has read entire binlog.
17 # 5 - Verify that the table is populated on the server.
18 # 6 - Cleanup.
19 #
20 # ==== References ====
21 #
22 # MDEV-11154: Write_on_release_cache(log_event.cc) function will not write
23 # "COMMIT", if use "mysqlbinlog ... | mysql ..."
24
25 --source include/not_windows.inc
26
27 # Test is not specific to any binlog format. Hence Running only for 'row'.
28 --source include/have_binlog_format_row.inc
29
30 # binlog file name is needed in the test. To use master-bin.000001,
31 # RESET MASTER is needed.
32 RESET MASTER;
33 # kill the dump threads if there any dump threads (may be from previous test)
34 --source include/stop_dump_threads.inc
35
36 --echo # Step-1: Execute some dummy statements.
37 CREATE TABLE t1(i int);
38 INSERT INTO t1 values (1);
39
40 --echo # Step-2: Disable binary log temporarily and drop the table 't1'.
41 set @@SESSION.SQL_LOG_BIN = 0;
42 DROP TABLE t1;
43 set @@SESSION.SQL_LOG_BIN = 1;
44
45 --echo # Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
46 --exec ($MYSQL_BINLOG --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT) < /dev/null > /dev/null 2>&1 &
47
48 --echo # Step-4: Wait till dump thread transfer is completed.
49 let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
50 --source include/wait_condition.inc
51
52 --echo # Step-5: Check that the data is there.
53 let $count= 1;
54 let $table= test.t1;
55 source include/wait_until_rows_count.inc;
56
57 --echo # Step-6: Cleanup
58 --echo # kill the dump thread serving the mysqlbinlog --stop-never process
59 --source include/stop_dump_threads.inc
60
61 DROP TABLE t1;