1
by brian
clean slate |
1 |
# Test for the new options --start-datetime, stop-datetime,
|
2 |
# and a few others.
|
|
3 |
||
4 |
# TODO: Need to look at making row based version once new binlog client is complete.
|
|
5 |
-- source include/have_binlog_format_mixed_or_statement.inc |
|
6 |
||
7 |
||
8 |
--disable_warnings |
|
9 |
drop table if exists t1; |
|
10 |
--enable_warnings |
|
11 |
reset master; |
|
12 |
||
13 |
# We need this for getting fixed timestamps inside of this test.
|
|
14 |
# I use a date in the future to keep a growing timestamp along the
|
|
15 |
# binlog (including the Start_log_event). This test will work
|
|
16 |
# unchanged everywhere, because mysql-test-run has fixed TZ, which it
|
|
17 |
# exports (so mysqlbinlog has same fixed TZ).
|
|
18 |
set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22"); |
|
19 |
set timestamp=@a; |
|
20 |
create table t1 (a int auto_increment not null primary key, b char(3)); |
|
21 |
insert into t1 values(null, "a"); |
|
22 |
insert into t1 values(null, "b"); |
|
23 |
set timestamp=@a+2; |
|
24 |
insert into t1 values(null, "c"); |
|
25 |
set timestamp=@a+4; |
|
26 |
insert into t1 values(null, "d"); |
|
27 |
insert into t1 values(null, "e"); |
|
28 |
||
29 |
flush logs; |
|
30 |
set timestamp=@a+1; # this could happen on a slave |
|
31 |
insert into t1 values(null, "f"); |
|
32 |
||
33 |
# delimiters are for easier debugging in future
|
|
34 |
||
35 |
--disable_query_log |
|
36 |
select "--- Local --" as ""; |
|
37 |
--enable_query_log |
|
38 |
||
39 |
#
|
|
40 |
# We should use --short-form everywhere because in other case output will
|
|
41 |
# be time dependent (the Start events). Better than nothing.
|
|
42 |
#
|
|
43 |
||
44 |
--exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
45 |
||
46 |
--disable_query_log |
|
47 |
select "--- offset --" as ""; |
|
48 |
--enable_query_log |
|
49 |
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
50 |
--disable_query_log |
|
51 |
select "--- start-position --" as ""; |
|
52 |
--enable_query_log |
|
53 |
--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
54 |
--disable_query_log |
|
55 |
select "--- stop-position --" as ""; |
|
56 |
--enable_query_log |
|
57 |
--exec $MYSQL_BINLOG --short-form --stop-position=609 $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
58 |
--disable_query_log |
|
59 |
select "--- start and stop positions ---" as ""; |
|
60 |
--enable_query_log |
|
61 |
--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
62 |
--disable_query_log |
|
63 |
select "--- start-datetime --" as ""; |
|
64 |
--enable_query_log |
|
65 |
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
66 |
--disable_query_log |
|
67 |
select "--- stop-datetime --" as ""; |
|
68 |
--enable_query_log |
|
69 |
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 |
|
70 |
||
71 |
--disable_query_log |
|
72 |
select "--- Local with 2 binlogs on command line --" as ""; |
|
73 |
--enable_query_log |
|
74 |
||
75 |
# This is to verify that some options apply only to first, or last binlog
|
|
76 |
||
77 |
flush logs; |
|
78 |
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
79 |
||
80 |
--disable_query_log |
|
81 |
select "--- offset --" as ""; |
|
82 |
--enable_query_log |
|
83 |
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
84 |
--disable_query_log |
|
85 |
select "--- start-position --" as ""; |
|
86 |
--enable_query_log |
|
87 |
--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
88 |
--disable_query_log |
|
89 |
select "--- stop-position --" as ""; |
|
90 |
--enable_query_log |
|
91 |
--exec $MYSQL_BINLOG --short-form --stop-position=135 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
92 |
--disable_query_log |
|
93 |
select "--- start-datetime --" as ""; |
|
94 |
--enable_query_log |
|
95 |
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
96 |
--disable_query_log |
|
97 |
select "--- stop-datetime --" as ""; |
|
98 |
--enable_query_log |
|
99 |
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 |
|
100 |
||
101 |
--disable_query_log |
|
102 |
select "--- Remote --" as ""; |
|
103 |
--enable_query_log |
|
104 |
||
105 |
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
106 |
||
107 |
--disable_query_log |
|
108 |
select "--- offset --" as ""; |
|
109 |
--enable_query_log |
|
110 |
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
111 |
--disable_query_log |
|
112 |
select "--- start-position --" as ""; |
|
113 |
--enable_query_log |
|
114 |
--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
115 |
--disable_query_log |
|
116 |
select "--- stop-position --" as ""; |
|
117 |
--enable_query_log |
|
118 |
--exec $MYSQL_BINLOG --short-form --stop-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
119 |
--disable_query_log |
|
120 |
select "--- start and stop positions ---" as ""; |
|
121 |
--enable_query_log |
|
122 |
--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
123 |
--disable_query_log |
|
124 |
select "--- start-datetime --" as ""; |
|
125 |
--enable_query_log |
|
126 |
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
127 |
--disable_query_log |
|
128 |
select "--- stop-datetime --" as ""; |
|
129 |
--enable_query_log |
|
130 |
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 |
|
131 |
||
132 |
--disable_query_log |
|
133 |
select "--- Remote with 2 binlogs on command line --" as ""; |
|
134 |
--enable_query_log |
|
135 |
||
136 |
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
137 |
||
138 |
--disable_query_log |
|
139 |
select "--- offset --" as ""; |
|
140 |
--enable_query_log |
|
141 |
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
142 |
--disable_query_log |
|
143 |
select "--- start-position --" as ""; |
|
144 |
--enable_query_log |
|
145 |
--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
146 |
--disable_query_log |
|
147 |
select "--- stop-position --" as ""; |
|
148 |
--enable_query_log |
|
149 |
--exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
150 |
--disable_query_log |
|
151 |
select "--- start-datetime --" as ""; |
|
152 |
--enable_query_log |
|
153 |
--exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
154 |
--disable_query_log |
|
155 |
select "--- stop-datetime --" as ""; |
|
156 |
--enable_query_log |
|
157 |
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 |
|
158 |
||
159 |
--disable_query_log |
|
160 |
select "--- to-last-log --" as ""; |
|
161 |
--enable_query_log |
|
162 |
||
163 |
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 |
|
164 |
||
165 |
# clean up
|
|
166 |
--disable_query_log |
|
167 |
select "--- end of test --" as ""; |
|
168 |
--enable_query_log |
|
169 |
drop table t1; |
|
170 |
||
171 |
# End of 4.1 tests
|