3 # Test the --[start|stop]-[position|datetime] options to mysqlbinlog,
4 # with/without --read-from-remote-server, with one or two binary logs
7 # ==== Implementation ====
9 # TODO: Need to look at making row based version once new binlog client is complete.
11 CREATE
TABLE t1 (a INT);
14 # We need to set fixed timestamps in this test.
15 # Use a date in the future to keep a growing timestamp along the
16 # binlog (including the Start_log_event). This test will work
17 # unchanged everywhere, because mysql-test-run has fixed TZ, which it
18 # exports (so mysqlbinlog has same fixed TZ).
19 --let $datetime_1= 2031-01-01 12:00:00
20 eval SET TIMESTAMP= UNIX_TIMESTAMP(
"$datetime_1");
21 INSERT INTO t1 VALUES(1);
22 --let $pos_1= query_get_value(SHOW MASTER
STATUS, Position, 1)
24 --let $datetime_2= 2032-01-01 12:00:00
25 eval SET TIMESTAMP= UNIX_TIMESTAMP(
"$datetime_2");
26 INSERT INTO t1 VALUES(2);
27 --let $pos_2= query_get_value(SHOW MASTER
STATUS, Position, 1)
29 eval SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00");
30 INSERT INTO t1 VALUES(3);
32 --let $file_1= query_get_value(SHOW MASTER STATUS, File, 1)
35 SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00");
36 INSERT INTO t1 VALUES(4);
37 --let $pos_3= query_get_value(SHOW MASTER STATUS, Position, 1)
38 --let $datetime_3= 2035-01-01 12:00:00
39 eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_3");
40 INSERT INTO t1 VALUES(5);
42 --let $file_2= query_get_value(SHOW MASTER STATUS, File, 1)
45 --let $MYSQLD_DATADIR= `select @@datadir`
48 --echo ==== Local ====
50 --let $start_position= $pos_1
51 --let $start_datetime= $datetime_1
53 --let $stop_position= $pos_2
54 --let $stop_datetime= $datetime_2
55 --let $extra_options= $MYSQLD_DATADIR/$file_1
56 --source
extra/binlog_tests/mysqlbinlog_start_stop_1.inc
59 --echo ==== Local with 2 binlogs on command line ====
60 # This is to verify that some options apply only to first, or last binlog
62 --let $stop_position= $pos_3
63 --let $stop_datetime= $datetime_3
64 --let $extra_options= $MYSQLD_DATADIR/$file_1 $MYSQLD_DATADIR/$file_2
65 --source
extra/binlog_tests/mysqlbinlog_start_stop_1.inc
68 --echo ==== Remote ====
70 --let $stop_position= $pos_2
71 --let $stop_datetime= $datetime_2
72 --let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1
73 --source
extra/binlog_tests/mysqlbinlog_start_stop_1.inc
76 --echo ==== Remote with 2 binlogs on command line ====
78 --let $stop_position= $pos_3
79 --let $stop_datetime= $datetime_3
80 --let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1 $file_2
81 --source
extra/binlog_tests/mysqlbinlog_start_stop_1.inc
83 # ==== to-last-log ====
85 --let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1
86 --let $option= --
to-last-log
87 --source
extra/binlog_tests/mysqlbinlog_start_stop_2.inc
90 --echo ==== clean up ====