1include/master-slave.inc
2Warnings:
3Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
4Note	####	Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5[connection master]
6
7*** Test 1 ***
8
9create table t1 (a int key, b int) engine innodb;
10create table t2 (a int key, b int) engine innodb;
11
12alter table t1 engine ndb;
13alter table t2 engine ndb;
14
15insert into t1 values (1,2);
16
17select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
18from mysql.ndb_apply_status;
19@log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
20<log_name>	<start_pos>	<end_pos>
21
22# Now check that that is in the apply_status table is consistant
23# with what is in the binlog
24
25# since insert is done with transactional engine, expect a BEGIN
26# at <start_pos>
27
28show binlog events from <binlog_start> limit 1;
29Log_name	Pos	Event_type	Server_id	End_log_pos	Info
30master-bin.000001	#	Query	#	#	BEGIN
31
32# Now the insert, one step after
33
34show binlog events from <binlog_start> limit 1,1;
35Log_name	Pos	Event_type	Server_id	End_log_pos	Info
36master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1,2)
37
38# and the COMMIT should be at <end_pos>
39
40show binlog events from <binlog_start> limit 2,1;
41Log_name	Pos	Event_type	Server_id	End_log_pos	Info
42master-bin.000001	#	Xid	#	#	COMMIT /* XID */
43
44begin;
45insert into t1 values (2,3);
46insert into t2 values (3,4);
47commit;
48
49select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
50from mysql.ndb_apply_status;
51@log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
52<log_name>	<start_pos>	<end_pos>
53show binlog events from <binlog_start> limit 1;
54Log_name	Pos	Event_type	Server_id	End_log_pos	Info
55master-bin.000001	#	Query	#	#	BEGIN
56
57show binlog events from <binlog_start> limit 1,2;
58Log_name	Pos	Event_type	Server_id	End_log_pos	Info
59master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2,3)
60master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (3,4)
61
62show binlog events from <binlog_start> limit 3,1;
63Log_name	Pos	Event_type	Server_id	End_log_pos	Info
64master-bin.000001	#	Xid	#	#	COMMIT /* XID */
65
66DROP TABLE test.t1, test.t2;
67SHOW TABLES;
68Tables_in_test
69
70*** Test 2 ***
71
72DROP DATABASE IF EXISTS tpcb;
73CREATE DATABASE tpcb;
74
75CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2),
76filler CHAR(255), PRIMARY KEY(id));
77
78CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
79PRIMARY KEY(bid));
80
81CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
82PRIMARY KEY(tid));
83
84CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
85tid INT, bid INT,  amount DECIMAL(10,2),
86tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
87filler CHAR(80),PRIMARY KEY (id));
88
89--- Create stored procedures & functions ---
90
91
92*** Stored Procedures Created ***
93
94USE tpcb;
95ALTER TABLE account ENGINE NDB;
96ALTER TABLE branch ENGINE NDB;
97ALTER TABLE teller ENGINE NDB;
98ALTER TABLE history ENGINE NDB;
99
100select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
101from mysql.ndb_apply_status;
102@log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
103<log_name>	<start_pos>	<end_pos>
104
105show binlog events in 'master-bin.000001'  from <start_pos> limit 9,1;
106Log_name	Pos	Event_type	Server_id	End_log_pos	Info
107master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
108
109** Test 3 **
110
111FLUSH LOGS;
112
113select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
114from mysql.ndb_apply_status;
115@log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
116<log_name>	<start_pos>	<end_pos>
117
118show binlog events in 'master-bin.000002'  from <start_pos> limit 9,1;
119Log_name	Pos	Event_type	Server_id	End_log_pos	Info
120master-bin.000002	#	Xid	1	<end_pos>	COMMIT /* XID */
121
122** Test 4 **
123
124include/rpl_reset.inc
125
126select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
127from mysql.ndb_apply_status;
128@log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
129<log_name>	<start_pos>	<end_pos>
130
131show binlog events in 'master-bin.000001'  from <start_pos> limit 9,1;
132Log_name	Pos	Event_type	Server_id	End_log_pos	Info
133master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
134
135*** DUMP MASTER & SLAVE FOR COMPARE ********
136DROP DATABASE tpcb;
137****** Do dumps compare ************
138include/rpl_end.inc
139