summaryrefslogtreecommitdiff
path: root/mysql-test/include/master-slave-reset.inc
blob: f54f5b83eb562dbd41be792455cd7f1b4d5822e9 (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
# Reset the master and the slave to start fresh.
#
# It is necessary to execute RESET MASTER and RESET SLAVE on both
# master and slave since the replication setup might be circular.
#
# Since we expect STOP SLAVE to produce a warning as the slave is
# stopped (the server was started with skip-slave-start), we disable
# warnings when doing STOP SLAVE.
#
# $no_change_master  If true, no change master will be done nor any reset slave.
#                    This is to avoid touching the relay-log.info file allowing
#                    the test to create one itself.
# $skip_slave_start  If true, the slave will not be started

connection slave;

#we expect STOP SLAVE to produce a warning as the slave is stopped
#(the server was started with skip-slave-start)
--disable_warnings
stop slave;
--disable_query_log
if (!$no_change_master) {
  eval CHANGE MASTER TO MASTER_USER='root',
                        MASTER_CONNECT_RETRY=1,
                        MASTER_HOST='127.0.0.1',
                        MASTER_PORT=$MASTER_MYPORT;
}
--enable_query_log
source include/wait_for_slave_to_stop.inc;
--enable_warnings

connection master;
--disable_warnings
--disable_query_log
use test;
--enable_query_log
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
reset master;

--disable_query_log
if (!$no_change_master) {
  reset slave;
}
--enable_query_log
connection slave;

--disable_warnings
# the first RESET SLAVE may produce a warning about non-existent
# 'ndb_apply_status' table, because this table is created
# asynchronously at the server startup and may not exist yet
# if RESET SLAVE comes too soon after the server startup
if (!$no_change_master) {
  reset slave;
}
--enable_warnings

# Clean up old test tables
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings

--disable_query_log
#eval CHANGE MASTER TO MASTER_USER='root',
#                      MASTER_CONNECT_RETRY=1,
#                      MASTER_HOST='127.0.0.1',
#                      MASTER_PORT=$MASTER_MYPORT;
reset master;
--enable_query_log

if (!$skip_slave_start) {
  start slave;
  source include/wait_for_slave_to_start.inc;
}