config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_max.result

include/master-slave.inc
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	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.
[connection master]
*** Test 1 ********************************************************
* test native NDB$MAX() conflict resolution
* test with both allowed "conflict column" types, uint32 and uint64
*******************************************************************
set @save_luaw = @@global.ndb_log_update_as_write;
set @save_luo = @@global.ndb_log_updated_only;
set global ndb_log_update_as_write=0;
set global ndb_log_updated_only=0;
insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$MAX(X)");
create table t1 (a int, b varchar(32), X int unsigned, d varchar(9), primary key (a, d)) engine ndb;
create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
************************************************
* some basic positive testing, i.e. no conflicts
************************************************
*** insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
commit;
*** master - update all
begin;
update t1 set b="Master t1 X=2", X=X+1;
update t2 set b="Master t2 c=2", c=c+1;
commit;
*** slave - check update all
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 X=2	2	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 c=2	2	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - update 2 rows in different tables
update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
*** slave - check update 2 rows in different tables
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 a=2 at X=3	3	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 a=3 at c=3	3	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - delete all
delete from t1;
delete from t2;
*** slave - check delete all
select * from t1 order by a, d;
a	b	X	d
select * from t2 order by a, d;
a	b	c	d
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
************************
* start conflict testing
************************
*** master - insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
insert into t1 values (4, "Master t1 a=4 at X=10", 10, '111222333');
insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
insert into t2 values (4, "Master t2 a=4 at c=10", 10, '111222333');
commit;
*** slave - check conflict info, no conflicts yet
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check insert some data
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=10	10	111
2	Master t1 a=2 at X=10	10	111222
3	Master t1 a=3 at X=10	10	111222333
4	Master t1 a=4 at X=10	10	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=10	10	111
2	Master t2 a=2 at c=10	10	111222
3	Master t2 a=3 at c=10	10	111222333
4	Master t2 a=4 at c=10	10	111222333
*** slave - update some data to cause conflicts
begin;
update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
update t1 set b="Slave t1 a=4 at X=12", X=12 where a=4 and d='111222333';
update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
update t2 set b="Slave t2 a=4 at c=12", c=12 where a=4;
commit;
*** master - update some data to cause conflicts
begin;
update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
delete from t1 where a = 4;
update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
delete from t2 where a = 4;
commit;
*** slave - check conflict info, there should be some
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check update some data that causes conflicts
select * from t1 order by a, d;
a	b	X	d
1	Slave t1 a=1 at X=12	12	111
2	Slave t1 a=2 at X=12	12	111222
3	Slave t1 a=3 at X=12	12	111222333
4	Slave t1 a=4 at X=12	12	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=11	11	111
2	Master t2 a=2 at c=11	11	111222
3	Master t2 a=3 at c=11	11	111222333
*** slave - correct some data to correspond to the master
update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
delete from t1 where a = 4;
*** master - update some data, use higher timestamp
begin;
update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
commit;
*** slave - check conflict info, change depends on calling test
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check higer timestamp
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=13	13	111
2	Master t1 a=2 at X=13	13	111222
3	Master t1 a=3 at X=13	13	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=13	13	111
2	Master t2 a=2 at c=13	13	111222
3	Master t2 a=3 at c=13	13	111222333
drop table t1, t2;
*** Test 2 ********************************************************
* test native NDB$MAX() conflict resolution
* test with both allowed "conflict column" types, uint32 and uint64
*******************************************************************
create table t1 (a int, b varchar(32), X bigint unsigned, d varchar(9), primary key (a, d)) engine ndb;
create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
************************************************
* some basic positive testing, i.e. no conflicts
************************************************
*** insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
commit;
*** master - update all
begin;
update t1 set b="Master t1 X=2", X=X+1;
update t2 set b="Master t2 c=2", c=c+1;
commit;
*** slave - check update all
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 X=2	2	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 c=2	2	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - update 2 rows in different tables
update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
*** slave - check update 2 rows in different tables
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 a=2 at X=3	3	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 a=3 at c=3	3	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - delete all
delete from t1;
delete from t2;
*** slave - check delete all
select * from t1 order by a, d;
a	b	X	d
select * from t2 order by a, d;
a	b	c	d
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
************************
* start conflict testing
************************
*** master - insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
insert into t1 values (4, "Master t1 a=4 at X=10", 10, '111222333');
insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
insert into t2 values (4, "Master t2 a=4 at c=10", 10, '111222333');
commit;
*** slave - check conflict info, no conflicts yet
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check insert some data
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=10	10	111
2	Master t1 a=2 at X=10	10	111222
3	Master t1 a=3 at X=10	10	111222333
4	Master t1 a=4 at X=10	10	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=10	10	111
2	Master t2 a=2 at c=10	10	111222
3	Master t2 a=3 at c=10	10	111222333
4	Master t2 a=4 at c=10	10	111222333
*** slave - update some data to cause conflicts
begin;
update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
update t1 set b="Slave t1 a=4 at X=12", X=12 where a=4 and d='111222333';
update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
update t2 set b="Slave t2 a=4 at c=12", c=12 where a=4;
commit;
*** master - update some data to cause conflicts
begin;
update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
delete from t1 where a = 4;
update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
delete from t2 where a = 4;
commit;
*** slave - check conflict info, there should be some
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check update some data that causes conflicts
select * from t1 order by a, d;
a	b	X	d
1	Slave t1 a=1 at X=12	12	111
2	Slave t1 a=2 at X=12	12	111222
3	Slave t1 a=3 at X=12	12	111222333
4	Slave t1 a=4 at X=12	12	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=11	11	111
2	Master t2 a=2 at c=11	11	111222
3	Master t2 a=3 at c=11	11	111222333
*** slave - correct some data to correspond to the master
update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
delete from t1 where a = 4;
*** master - update some data, use higher timestamp
begin;
update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
commit;
*** slave - check conflict info, change depends on calling test
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check higer timestamp
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=13	13	111
2	Master t1 a=2 at X=13	13	111222
3	Master t1 a=3 at X=13	13	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=13	13	111
2	Master t2 a=2 at c=13	13	111222
3	Master t2 a=3 at c=13	13	111222333
drop table t1, t2;
*** Test 3 ********************************************************
* test native NDB$MAX() conflict resolution
* test that setting binlog update option via table works equally well
*******************************************************************
set global ndb_log_update_as_write=1;
set global ndb_log_updated_only=1;
update mysql.ndb_replication set binlog_type=7;
create table t1 (a int, b varchar(32), X bigint unsigned, d varchar(9), primary key (a, d)) engine ndb;
create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
************************************************
* some basic positive testing, i.e. no conflicts
************************************************
*** insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
commit;
*** master - update all
begin;
update t1 set b="Master t1 X=2", X=X+1;
update t2 set b="Master t2 c=2", c=c+1;
commit;
*** slave - check update all
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 X=2	2	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 c=2	2	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - update 2 rows in different tables
update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
*** slave - check update 2 rows in different tables
select * from t1 order by a, d;
a	b	X	d
1	Master t1 X=2	2	1
2	Master t1 a=2 at X=3	3	12
3	Master t1 X=2	2	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 a=3 at c=3	3	123
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - delete all
delete from t1;
delete from t2;
*** slave - check delete all
select * from t1 order by a, d;
a	b	X	d
select * from t2 order by a, d;
a	b	c	d
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
************************
* start conflict testing
************************
*** master - insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
insert into t1 values (4, "Master t1 a=4 at X=10", 10, '111222333');
insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
insert into t2 values (4, "Master t2 a=4 at c=10", 10, '111222333');
commit;
*** slave - check conflict info, no conflicts yet
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check insert some data
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=10	10	111
2	Master t1 a=2 at X=10	10	111222
3	Master t1 a=3 at X=10	10	111222333
4	Master t1 a=4 at X=10	10	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=10	10	111
2	Master t2 a=2 at c=10	10	111222
3	Master t2 a=3 at c=10	10	111222333
4	Master t2 a=4 at c=10	10	111222333
*** slave - update some data to cause conflicts
begin;
update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
update t1 set b="Slave t1 a=4 at X=12", X=12 where a=4 and d='111222333';
update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
update t2 set b="Slave t2 a=4 at c=12", c=12 where a=4;
commit;
*** master - update some data to cause conflicts
begin;
update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
delete from t1 where a = 4;
update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
delete from t2 where a = 4;
commit;
*** slave - check conflict info, there should be some
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check update some data that causes conflicts
select * from t1 order by a, d;
a	b	X	d
1	Slave t1 a=1 at X=12	12	111
2	Slave t1 a=2 at X=12	12	111222
3	Slave t1 a=3 at X=12	12	111222333
4	Slave t1 a=4 at X=12	12	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=11	11	111
2	Master t2 a=2 at c=11	11	111222
3	Master t2 a=3 at c=11	11	111222333
*** slave - correct some data to correspond to the master
update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
delete from t1 where a = 4;
*** master - update some data, use higher timestamp
begin;
update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
commit;
*** slave - check conflict info, change depends on calling test
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check higer timestamp
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=13	13	111
2	Master t1 a=2 at X=13	13	111222
3	Master t1 a=3 at X=13	13	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=13	13	111
2	Master t2 a=2 at c=13	13	111222
3	Master t2 a=3 at c=13	13	111222333
drop table t1, t2;
*** Test 4 ***********************************************************
* test behaviour with updates logged as writes, but all columns present
* Should succeed, but miss update conflict detection as no updates are
* recorded.  Bit of a weird test...
* ********************************************************************
update mysql.ndb_replication set binlog_type=3;
create table t1 (a int, b varchar(32), X int unsigned, d varchar(9), primary key (a, d)) engine ndb;
create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
************************************************
* some basic positive testing, i.e. no conflicts
************************************************
*** insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
commit;
*** master - update all
begin;
update t1 set b="Master t1 X=2", X=X+1;
update t2 set b="Master t2 c=2", c=c+1;
commit;
*** slave - check update all
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
2	Master t1 a=2 at X=1	1	12
3	Master t1 a=3 at X=1	1	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 c=2	2	123
Conflict algorithm counter diff :
ndb_conflict_fn_max
3
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	1
2	1	#	#	2	12
2	1	#	#	3	123
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - update 2 rows in different tables
update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
*** slave - check update 2 rows in different tables
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
2	Master t1 a=2 at X=1	1	12
3	Master t1 a=3 at X=1	1	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 c=2	2	1
2	Master t2 c=2	2	12
3	Master t2 a=3 at c=3	3	123
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	1
2	1	#	#	2	12
2	1	#	#	2	12
2	1	#	#	3	123
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** master - delete all
delete from t1;
delete from t2;
*** slave - check delete all
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
2	Master t1 a=2 at X=1	1	12
3	Master t1 a=3 at X=1	1	123
select * from t2 order by a, d;
a	b	c	d
Conflict algorithm counter diff :
ndb_conflict_fn_max
7
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	1	#	#
2	1	#	2	#	#
2	1	#	3	#	#
2	1	#	4	#	#
2	1	#	5	#	#
2	1	#	6	#	#
2	1	#	7	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	1
2	1	#	#	1	1
2	1	#	#	2	12
2	1	#	#	2	12
2	1	#	#	2	12
2	1	#	#	3	123
2	1	#	#	3	123
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
************************
* start conflict testing
************************
*** master - insert some data
begin;
insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
insert into t1 values (4, "Master t1 a=4 at X=10", 10, '111222333');
insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
insert into t2 values (4, "Master t2 a=4 at c=10", 10, '111222333');
commit;
*** slave - check conflict info, no conflicts yet
Conflict algorithm counter diff :
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check insert some data
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
1	Master t1 a=1 at X=10	10	111
2	Master t1 a=2 at X=10	10	111222
2	Master t1 a=2 at X=1	1	12
3	Master t1 a=3 at X=10	10	111222333
3	Master t1 a=3 at X=1	1	123
4	Master t1 a=4 at X=10	10	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=10	10	111
2	Master t2 a=2 at c=10	10	111222
3	Master t2 a=3 at c=10	10	111222333
4	Master t2 a=4 at c=10	10	111222333
*** slave - update some data to cause conflicts
begin;
update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
update t1 set b="Slave t1 a=4 at X=12", X=12 where a=4 and d='111222333';
update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
update t2 set b="Slave t2 a=4 at c=12", c=12 where a=4;
commit;
*** master - update some data to cause conflicts
begin;
update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
delete from t1 where a = 4;
update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
delete from t2 where a = 4;
commit;
*** slave - check conflict info, there should be some
Conflict algorithm counter diff :
ndb_conflict_fn_max
4
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	8	#	#
2	1	#	9	#	#
2	1	#	10	#	#
2	1	#	11	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check update some data that causes conflicts
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
1	Slave t1 a=1 at X=12	12	111
2	Slave t1 a=2 at X=12	12	111222
2	Master t1 a=2 at X=1	1	12
3	Slave t1 a=3 at X=12	12	111222333
3	Master t1 a=3 at X=1	1	123
4	Slave t1 a=4 at X=12	12	111222333
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=11	11	111
2	Master t2 a=2 at c=11	11	111222
3	Master t2 a=3 at c=11	11	111222333
*** slave - correct some data to correspond to the master
update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
delete from t1 where a = 4;
*** master - update some data, use higher timestamp
begin;
update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
commit;
*** slave - check conflict info, change depends on calling test
Conflict algorithm counter diff :
ndb_conflict_fn_max
7
Exception table contents
SELECT server_id, master_server_id, master_epoch, count, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	8	#	#
2	1	#	9	#	#
2	1	#	10	#	#
2	1	#	11	#	#
2	1	#	12	#	#
2	1	#	13	#	#
2	1	#	14	#	#
SELECT * FROM `t1$EX` ORDER BY a, d;
server_id	master_server_id	master_epoch	count	a	d
2	1	#	#	1	111
2	1	#	#	1	111
2	1	#	#	2	111222
2	1	#	#	2	111222
2	1	#	#	3	111222333
2	1	#	#	3	111222333
2	1	#	#	4	111222333
SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
SELECT * FROM `t2$EX` ORDER BY a, d;
*** slave - check higer timestamp
select * from t1 order by a, d;
a	b	X	d
1	Master t1 a=1 at X=1	1	1
1	Slave t1 a=1 at X=11	11	111
2	Slave t1 a=2 at X=12	12	111222
2	Master t1 a=2 at X=1	1	12
3	Slave t1 a=3 at X=12	12	111222333
3	Master t1 a=3 at X=1	1	123
select * from t2 order by a, d;
a	b	c	d
1	Master t2 a=1 at c=13	13	111
2	Master t2 a=2 at c=13	13	111222
3	Master t2 a=3 at c=13	13	111222333
drop table t1, t2;
*** Test 5 ***********************************************************
* test that missing timestamp column in after-image for update, or
* test before image for delete results in slave stopping
**********************************************************************
update mysql.ndb_replication set binlog_type=6;
create table t1 (a int, b varchar(32), X bigint unsigned, d varchar(9), primary key (a, d)) engine ndb;
insert into t1 values (1, "Master row 1 at X=1", 1, "1:1");
insert into t1 values (2, "Master row 2 at X=1", 1, "2:1");
insert into t1 values (3, "Master row 3 at X=1", 1, "3:1");
Show update missing timestamp column causes slave failure
update t1 set b='Blah' where a=1 and d="1:1";
call mtr.add_suppression(".*missing info necessary for conflict detection.*");
call mtr.add_suppression(".*Slave SQL for channel '': Could not execute.*rows event on table.*");
call mtr.add_suppression(".*error 1610.*");
Wait for slave to choke on that event.
include/wait_for_slave_sql_error.inc [errno=1296]
include/stop_slave_io.inc
RESET SLAVE;
include/rpl_reset.inc
Show delete missing timestamp column (in before image) causes
slave failure
delete from t1 where a=3 and d="3:1";
Wait for slave to choke on that event.
include/wait_for_slave_sql_error.inc [errno=1296]
include/stop_slave_io.inc
RESET SLAVE;
include/rpl_reset.inc
drop table t1;
*** test cleanup
set global ndb_log_update_as_write= @save_luaw;
set global ndb_log_updated_only = @save_luo;
include/rpl_end.inc

Man Man