summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
blob: 1f95ee4a6e0f9ef31ebc3102d0d5220f025bace4 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
include/rpl_init.inc [topology=1->2]
*** Test connecting with empty GTID state to start from very beginning of binlog ***
include/stop_slave.inc
RESET MASTER;
RESET SLAVE;
RESET MASTER;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL gtid_pos="";
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=1;
include/start_slave.inc
SELECT * FROM t1;
a
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
include/stop_slave.inc
*** Test that master gives error when slave asks for empty gtid pos and binlog files have been purged. ***
FLUSH LOGS;
INSERT INTO t1 VALUES (2);
include/wait_for_purge.inc "master-bin.000003"
show binary logs;
Log_name	File_size
master-bin.000003	#
SET GLOBAL gtid_pos="";
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=1;
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1236]
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
SET sql_log_bin=0;
call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files');
SET sql_log_bin=1;
*** Test that we give error when explict @@gtid_pos=xxx that conflicts with what is in our binary log ***
include/stop_slave.inc
INSERT INTO t1 VALUES(3);
SET GLOBAL gtid_pos='0-1-3';
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=1;
include/start_slave.inc
SELECT * FROM t1 ORDER by a;
a
1
2
3
include/stop_slave.inc
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (10);
DELETE FROM t1 WHERE a=10;
SET GLOBAL gtid_pos='0-1-4';
ERROR HY000: Requested GTID_POS 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
RESET MASTER;
SET GLOBAL gtid_pos='0-1-4';
START SLAVE;
SELECT * FROM t1 ORDER by a;
a
1
2
3
4
DROP TABLE t1;
*** MDEV-4275: I/O thread restart duplicates events in relay log ***
include/stop_slave.inc
RESET SLAVE ALL;
RESET MASTER;
RESET MASTER;
SET GLOBAL gtid_pos='';
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=1;
include/start_slave.inc
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
include/stop_slave_io.inc
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
INSERT INTO t1 VALUES (2);
SELECT * FROM t1 ORDER BY a;
a
1
2
*** MDEV-4329: GTID_POS='' is not checked for conflicts with binlog ***
include/stop_slave.inc
DROP TABLE t1;
RESET SLAVE;
SET GLOBAL gtid_pos="";
ERROR HY000: Requested GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
RESET MASTER;
SET GLOBAL gtid_pos="";
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
include/stop_slave.inc
SET SQL_LOG_BIN=0;
DROP TABLE t1;
SET SQL_LOG_BIN=1;
RESET SLAVE;
SET GLOBAL gtid_pos="";
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
*** Test that RESET SLAVE clears the Using_Gtid flag. ***
include/stop_slave.inc
RESET SLAVE;
Using_Gtid = '0'
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1050]
STOP SLAVE IO_THREAD;
CHANGE MASTER TO MASTER_USE_GTID=1;
include/start_slave.inc
INSERT INTO t1 VALUES(3);
SELECT * FROM t1 ORDER BY a;
a
1
2
3
SET SQL_LOG_BIN=0;
call mtr.add_suppression("Slave: Table 't1' already exists Error_code: 1050");
SET SQL_LOG_BIN=1;
*** Test reconnecting slave with GTID after purge logs on master. ***
FLUSH LOGS;
INSERT INTO t1 VALUES (4);
include/stop_slave.inc
FLUSH LOGS;
FLUSH LOGS;
include/wait_for_purge.inc "master-bin.000004"
show binary logs;
Log_name	File_size
master-bin.000004	#
INSERT INTO t1 VALUES (5);
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
*** Test modifying binlog on slave and the effect on GTID state. ***
include/stop_slave.inc
RESET MASTER;
SET GLOBAL gtid_pos="";
RESET MASTER;
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (10);
include/start_slave.inc
SELECT * FROM t1;
a
10
SELECT '1' AS Using_Gtid;
Using_Gtid
1
SELECT '0-1-2' AS Gtid_Pos;
Gtid_Pos
0-1-2
UPDATE t1 SET a=9 WHERE a=10;
UPDATE t1 SET a=10 WHERE a=9;
SELECT '0-2-4' AS Gtid_Pos;
Gtid_Pos
0-2-4
include/stop_slave.inc
SET GLOBAL gtid_pos='0-1-2';
ERROR HY000: Requested GTID_POS 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
RESET MASTER;
SELECT '0-1-2' AS Gtid_Pos;
Gtid_Pos
0-1-2
SET GLOBAL gtid_pos='0-1-2';
include/start_slave.inc
SELECT '0-1-2' AS Gtid_Pos;
Gtid_Pos
0-1-2
DROP TABLE t1;
include/rpl_end.inc