File: binlog_mysqlbinlog_stop_never.test

package info (click to toggle)
mariadb-10.1 10.1.45-0%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 476,916 kB
  • sloc: cpp: 1,124,656; ansic: 871,843; perl: 52,917; sh: 40,078; pascal: 35,370; javascript: 15,555; yacc: 14,728; ruby: 8,684; xml: 5,377; sql: 3,490; makefile: 2,934; python: 1,970; java: 1,691; asm: 837; lex: 757; php: 22; sed: 16
file content (66 lines) | stat: -rw-r--r-- 2,526 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# ==== Purpose ====
#
# Test verifies that continuous streaming of binary log content using the
# "mysqlbinlog --stop-never" option and sourcing it to mysql client works
# fine.
#
# ==== Implementation ====
#
# Steps:
#    1 - Create a table on a server on which binary log is enabled and insert
#        a row.
#    2 - Disable the binary log on the server and drop the table.
#    3 - Capture the binary log output using "mysqlbinlog --stop_never" option
#        and source it to mysql client.
#    4 - Query the PROCESSLIST table to ensure that the dump thread which is
#        serving "stop_never" option has read entire binlog.
#    5 - Verify that the table is populated on the server.
#    6 - Cleanup.
#
# ==== References ====
#
# MDEV-11154: Write_on_release_cache(log_event.cc) function will not write
#             "COMMIT", if use "mysqlbinlog ... | mysql ..."

--source include/not_windows.inc

# Test is not specific to any binlog format. Hence Running only for 'row'.
--source include/have_binlog_format_row.inc

# binlog file name is needed in the test. To use master-bin.000001,
# RESET MASTER is needed.
RESET MASTER;
# kill the dump threads if there any dump threads (may be from previous test)
--source include/stop_dump_threads.inc

--echo # Step-1: Execute some dummy statements.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);

--echo # Step-2: Disable binary log temporarily and drop the table 't1'.
set @@SESSION.SQL_LOG_BIN = 0;
DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;

--echo # Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
--write_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
(`$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  &
EOF
--exec /bin/bash $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh

--echo # Step-4: Wait till dump thread transfer is completed.
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
--source include/wait_condition.inc

--echo # Step-5: Check that the data is there.
let $count= 1;
let $table= test.t1;
source include/wait_until_rows_count.inc;

--echo # Step-6: Cleanup
--echo # kill the dump thread serving the mysqlbinlog --stop-never process
--source include/stop_dump_threads.inc

DROP TABLE t1;
--remove_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh