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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4;
start slave;
Got one of the listed errors
start slave;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
start slave;
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 60
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
select * from t1;
s
Could not break slave
Tried hard
flush logs;
create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123);
flush logs;
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
master-bin.000003 #
create table t3 select * from temp_table;
select * from t3;
a
testing temporary tables
drop table temp_table, t3;
insert into t2 values(1234);
set insert_id=1234;
insert into t2 values(NULL);
set global sql_slave_skip_counter=1;
start slave;
purge master logs to 'master-bin.000002';
show master logs;
Log_name master-bin.000002
File_size #
Log_name master-bin.000003
File_size #
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
master-bin.000002 #
master-bin.000003 #
select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
from information_schema.tables
where TABLE_SCHEMA="test" and TABLE_NAME="t2";
purge master logs before (@time_for_purge);
show binary logs;
Log_name File_size
master-bin.000003 #
insert into t2 values (65);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 60
Master_Log_File master-bin.000003
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000003
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
select * from t2;
m
34
65
67
123
1234
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables part 2");
create table t3 (n int);
select count(*) from t3 where n >= 4;
count(*)
100
create table t4 select * from temp_table;
show binary logs;
Log_name File_size
master-bin.000003 #
master-bin.000004 #
master-bin.000005 #
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000005 # <Binlog_Do_DB> <Binlog_Ignore_DB>
select * from t4;
a
testing temporary tables part 2
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 60
Master_Log_File master-bin.000005
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000005
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
100
unlock tables;
drop table if exists t1,t2,t3,t4;
End of 4.1 tests
show binlog events in 'non existing_binlog_file';
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
purge master logs before now();
show binlog events in '';
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
purge master logs before now();
End of 5.0 tests
|