1include/rpl_init.inc [topology=1->2,4->3]
2include/rpl_connect.inc [creating master]
3include/rpl_connect.inc [creating master1]
4include/rpl_connect.inc [creating slave]
5include/rpl_connect.inc [creating slave1]
6include/rpl_start_slaves.inc
7Cluster A servers have no epoch replication info
8select count(1) from mysql.ndb_apply_status;
9count(1)
100
11Cluster A servers have no max replicated epoch value
12Master(1)
13select variable_name, variable_value from information_schema.global_status
14where variable_name='Ndb_slave_max_replicated_epoch';
15variable_name	variable_value
16NDB_SLAVE_MAX_REPLICATED_EPOCH	0
17Master1(3)
18select variable_name, variable_value from information_schema.global_status
19where variable_name='Ndb_slave_max_replicated_epoch';
20variable_name	variable_value
21NDB_SLAVE_MAX_REPLICATED_EPOCH	0
22Make a change originating at Cluster A
23Master(1)
24use test;
25create table t1 (a int primary key, b varchar(100)) engine=ndb;
26insert into t1 values (1, "Venice");
27Allow it to propagate to Cluster B
28Originate a second unrelated change at Cluster B, to allow us to wait for
29reverse propagation in the testcase
30Slave1 (4)
31insert into t1 values (2, "Death");
32Allow it to propagate to Cluster A
33Observe new entry in ndb_apply_status on Cluster A
34Master (1)
35select server_id from mysql.ndb_apply_status order by server_id;
36server_id
371
384
39Non-slave server on Cluster A will have no value for Max Replicated Epoch
40select variable_name, variable_value from information_schema.global_status
41where variable_name='Ndb_slave_max_replicated_epoch';
42variable_name	variable_value
43NDB_SLAVE_MAX_REPLICATED_EPOCH	0
44Slave server on Cluster A has current value for Max Replicated Epoch
45Master1 (3)
46Expect count 1
47select
48count(1)
49from
50information_schema.global_status,
51mysql.ndb_apply_status
52where
53server_id = 1
54and
55variable_name='Ndb_slave_max_replicated_epoch'
56    and
57variable_value = epoch;
58count(1)
591
60Now wait for all replication to quiesce
61Now swap replication channels around
62include/rpl_stop_slaves.inc
63include/rpl_change_topology.inc [new topology=2->1,3->4]
64Get current master status on Cluster A new master (next pos in Binlog)
65Master1 (3)
66Flush logs to ensure any pending update (e.g. reflected apply_status write row)
67is skipped over.
68flush logs;
69Setup slave on Cluster B to use it
70Slave1 (4)
71Get current master status on Cluster B new master (next pos in Binlog)
72Slave (2)
73Flush logs to ensure any pending update (e.g. reflected apply_status write row)
74is skipped over.
75flush logs;
76Setup slave on Cluster A to use it
77Master (1)
78Master (1)
79Show that Cluster A Slave server (old master) has no Max replicated epoch before receiving data
80select variable_name, variable_value from information_schema.global_status
81where variable_name='Ndb_slave_max_replicated_epoch';
82variable_name	variable_value
83NDB_SLAVE_MAX_REPLICATED_EPOCH	0
84Master1 (3)
85Cluster A Master server (old slave) has old Max replicated epoch
86select
87count(1)
88from
89information_schema.global_status,
90mysql.ndb_apply_status
91where
92server_id = 1
93and
94variable_name='Ndb_slave_max_replicated_epoch'
95    and
96variable_value = epoch;
97count(1)
981
99Now start slaves up
100include/rpl_start_slaves.inc
101Show that applying something from Cluster B causes the
102old Max Rep Epoch to be loaded from ndb_apply_status
103There is no new Max Rep Epoch from Cluster A as it has not changed
104anything yet
105Slave (2)
106insert into test.t1 values (3, "From the Sea");
107Allow to propagate to Cluster A
108Master (1)
109New Slave server on Cluster A has loaded old Max-Replicated-Epoch
110select server_id from mysql.ndb_apply_status order by server_id;
111server_id
1121
1132
1144
115select
116count(1)
117from
118information_schema.global_status,
119mysql.ndb_apply_status
120where
121server_id = 1
122and
123variable_name='Ndb_slave_max_replicated_epoch'
124    and
125variable_value = epoch;
126count(1)
1271
128Now make a new Cluster A change and see that the Max Replicated Epoch advances
129once it has propagated
130Master1 (3)
131insert into test.t1 values (4, "Brooke");
132Propagate to Cluster B
133Make change on Cluster B to allow waiting for reverse propagation
134Slave (2)
135insert into test.t1 values (5, "Rupert");
136Wait for propagation back to Cluster A
137Master (1)
138Show that Cluster A now has 2 different server_id entries in ndb_apply_status
139Those from the new master (server_id 3) are highest.
140select server_id from mysql.ndb_apply_status order by server_id;
141server_id
1421
1432
1443
1454
146select
147count(1)
148from
149information_schema.global_status,
150mysql.ndb_apply_status
151where
152server_id = 3
153and
154variable_name='Ndb_slave_max_replicated_epoch'
155    and
156variable_value = epoch;
157count(1)
1581
159local_server_with_max_epoch
1603
161Done
162drop table t1;
163include/rpl_stop_slaves.inc
164CHANGE MASTER TO IGNORE_SERVER_IDS= ();
165CHANGE MASTER TO IGNORE_SERVER_IDS= ();
166CHANGE MASTER TO IGNORE_SERVER_IDS= ();
167CHANGE MASTER TO IGNORE_SERVER_IDS= ();
168include/rpl_start_slaves.inc
169include/rpl_end.inc
170