1include/rpl_init.inc [topology=1->2->1]
2include/rpl_connect.inc [creating master]
3include/rpl_connect.inc [creating slave]
4CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
5SHOW TABLES;
6Tables_in_test
7t1
8INSERT INTO t1 VALUES (1,2);
9INSERT INTO t1 VALUES (2,3);
10SELECT * FROM t1 ORDER BY a;
11a	b
121	2
132	3
14show slave status;;
15Slave_IO_State	#
16Master_Host	127.0.0.1
17Master_User	root
18Master_Port	#
19Connect_Retry	1
20Master_Log_File	master-bin.000001
21Read_Master_Log_Pos	#
22Relay_Log_File	#
23Relay_Log_Pos	#
24Relay_Master_Log_File	master-bin.000001
25Slave_IO_Running	Yes
26Slave_SQL_Running	Yes
27Replicate_Do_DB
28Replicate_Ignore_DB
29Replicate_Do_Table
30Replicate_Ignore_Table
31Replicate_Wild_Do_Table
32Replicate_Wild_Ignore_Table
33Last_Errno	0
34Last_Error
35Skip_Counter	0
36Exec_Master_Log_Pos	#
37Relay_Log_Space	#
38Until_Condition	None
39Until_Log_File
40Until_Log_Pos	0
41Master_SSL_Allowed	No
42Master_SSL_CA_File
43Master_SSL_CA_Path
44Master_SSL_Cert
45Master_SSL_Cipher
46Master_SSL_Key
47Seconds_Behind_Master	#
48Master_SSL_Verify_Server_Cert	No
49Last_IO_Errno	#
50Last_IO_Error	#
51Last_SQL_Errno	0
52Last_SQL_Error
53Replicate_Ignore_Server_Ids
54Master_Server_Id	1
55Master_Bind
56Slave Binlog contains all ops as log_slave_updates is on
57show variables like 'server_id';
58Variable_name	Value
59server_id	2
60show variables like 'log_bin';
61Variable_name	Value
62log_bin	ON
63show variables like 'log_slave_updates';
64Variable_name	Value
65log_slave_updates	ON
66show binlog events from <binlog_start>;
67Log_name	Pos	Event_type	Server_id	End_log_pos	Info
68slave-bin.000001	#	Query	2	#	use `test`; CREATE TABLE t1 (a int key, b int) ENGINE=ndb
69slave-bin.000001	#	Query	2	#	BEGIN
70slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
71slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
72slave-bin.000001	#	Write_rows	2	#	table_id: #
73slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
74slave-bin.000001	#	Query	2	#	COMMIT
75slave-bin.000001	#	Query	2	#	BEGIN
76slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
77slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
78slave-bin.000001	#	Write_rows	2	#	table_id: #
79slave-bin.000001	#	Write_rows	2	#	table_id: # flags: STMT_END_F
80slave-bin.000001	#	Query	2	#	COMMIT
81include/check_slave_is_running.inc
82SELECT * FROM t1 ORDER BY a;
83a	b
841	2
852	3
86include/check_slave_is_running.inc
87Master Binlog contains only Master ops as log_slave_updates is off
88show variables like 'server_id';
89Variable_name	Value
90server_id	1
91show variables like 'log_bin';
92Variable_name	Value
93log_bin	ON
94show variables like 'log_slave_updates';
95Variable_name	Value
96log_slave_updates	OFF
97show binlog events from <binlog_start>;
98Log_name	Pos	Event_type	Server_id	End_log_pos	Info
99master-bin.000001	#	Query	1	#	BEGIN
100master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
101master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
102master-bin.000001	#	Write_rows	1	#	table_id: #
103master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
104master-bin.000001	#	Query	1	#	COMMIT
105STOP SLAVE;
106DROP TABLE t1;
107start slave;
108create table t1 (a int primary key, b int) engine=ndb;
109show variables like '%log_orig%';
110Variable_name	Value
111ndb_log_orig	ON
112'Master' has only slave's serverid entry
113select server_id, log_name from mysql.ndb_apply_status order by server_id;
114server_id	log_name
1152	slave-bin.000001
116set global ndb_log_apply_status=On;
117show variables like 'ndb_log_apply_status';
118Variable_name	Value
119ndb_log_apply_status	ON
120'Slave' has only Master's serverid entry
121select server_id, log_name from mysql.ndb_apply_status order by server_id;
122server_id	log_name
1231	master-bin.000001
124'Slave' has following ndb_binlog_index entries
125select inserts, updates, deletes, schemaops, orig_server_id from mysql.ndb_binlog_index order by position;
126inserts	updates	deletes	schemaops	orig_server_id
1271	0	0	0	1
1281	0	0	0	2
129set global ndb_log_apply_status=On;
130show variables like 'ndb_log_apply_status';
131Variable_name	Value
132ndb_log_apply_status	ON
133stop slave;
134insert into t1 values (1,1);
135'Slave' still has only Master's serverid entry
136select server_id, log_name from mysql.ndb_apply_status order by server_id;
137server_id	log_name
1381	master-bin.000001
139show binlog events;
140'Slave' has following ndb_binlog_index entries
141select inserts, updates, deletes, schemaops, orig_server_id from mysql.ndb_binlog_index order by position;
142inserts	updates	deletes	schemaops	orig_server_id
1431	0	0	0	1
1441	0	0	0	2
1450	0	0	0	2
1461	0	0	0	1
147'Master' still has only Slave's serverid entry
148select server_id, log_name from mysql.ndb_apply_status order by server_id;
149server_id	log_name
1502	slave-bin.000001
151start slave;
152'Master' now has own serverid entry as well.
153select server_id, log_name from mysql.ndb_apply_status order by server_id;
154server_id	log_name
1551	master-bin.000001
1562	slave-bin.000001
157'Slave' still only has 'Master''s serverid entry
158select server_id, log_name from mysql.ndb_apply_status order by server_id;
159server_id	log_name
1601	master-bin.000001
161Now create event originating at Slave
162insert into t1 values (2,2);
163'Slave' now also has its own serverid entry
164select server_id, log_name from mysql.ndb_apply_status order by server_id;
165server_id	log_name
1661	master-bin.000001
1672	slave-bin.000001
168stop slave;
169set global ndb_log_apply_status=off;
170set global ndb_log_apply_status=off;
171stop slave;
172drop table t1;
173drop table t1;
174include/rpl_end.inc
175