1include/master-slave.inc
2[connection master]
3reset master;
4stop slave;
5Generate something in the Masters Binlog
6use test;
7create table t1 (a int primary key, b int) engine=ndb;
8insert into t1 values (1,1);
9Initial state
10select * from mysql.ndb_apply_status;
11server_id	epoch	log_name	start_pos	end_pos
12select variable_value from information_schema.global_status
13where variable_name like '%Ndb_slave_max_replicated_epoch%';
14variable_value
150
16select @slave_server_id:=(variable_value+0) from information_schema.global_variables
17where variable_name like 'server_id';
18@slave_server_id:=(variable_value+0)
192
20Default, no data, max replicated epoch will be 0.
21reset slave;
22start slave;
23select server_id from mysql.ndb_apply_status order by server_id;
24server_id
251
26select variable_value from information_schema.global_status
27where variable_name like 'Ndb_slave_max_replicated_epoch';
28variable_value
290
30Default, load of own serverid from ndb_apply_status, should be 111
31drop table test.t1;
32stop slave;
33reset slave;
34insert into mysql.ndb_apply_status values (@slave_server_id, 111, 'Fictional log', 222, 333);
35start slave;
36select server_id from mysql.ndb_apply_status order by server_id;
37server_id
381
392
40select variable_value from information_schema.global_status
41where variable_name like 'Ndb_slave_max_replicated_epoch';
42variable_value
43111
44drop table test.t1;
45Check that reset slave resets Ndb_slave_max_replicated_epoch
46stop slave;
47select variable_value from information_schema.global_status
48where variable_name like 'Ndb_slave_max_replicated_epoch';
49variable_value
50111
51reset slave;
52select variable_value from information_schema.global_status
53where variable_name like 'Ndb_slave_max_replicated_epoch';
54variable_value
550
56Multiple-channel, load highest of configured serverids, should be 222
57set @other_local_server_id=@slave_server_id+1;
58set @other_remote_server_id=@slave_server_id+2;
59insert into mysql.ndb_apply_status values (@slave_server_id, 111, 'Fictional log', 222, 333);
60insert into mysql.ndb_apply_status values (@other_local_server_id, 222, 'Fictional log', 222, 333);
61insert into mysql.ndb_apply_status values (@other_remote_server_id, 444, 'Fictional log', 222, 333);
62CHANGE MASTER TO IGNORE_SERVER_IDS=(3);;
63start slave;
64select server_id from mysql.ndb_apply_status order by server_id;
65server_id
661
672
683
694
70select variable_value from information_schema.global_status
71where variable_name like 'Ndb_slave_max_replicated_epoch';
72variable_value
73222
74stop slave;
75CHANGE MASTER TO IGNORE_SERVER_IDS= ();
76start slave;
77drop table test.t1;
78include/rpl_end.inc
79