Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-14 19:27:00+02:00, tomas@stripped +5 -0
WL#4080
- more testing
mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test@stripped, 2007-10-14 19:26:57+02:00,
tomas@stripped +62 -0
more testing
mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result@stripped, 2007-10-14 19:26:57+02:00,
tomas@stripped +210 -3
more testing
mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result@stripped, 2007-10-14 19:26:57+02:00,
tomas@stripped +219 -34
more testing
mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test@stripped, 2007-10-14 19:26:57+02:00,
tomas@stripped +16 -13
more testing
mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test@stripped, 2007-10-14 19:26:57+02:00,
tomas@stripped +16 -13
more testing
diff -Nrup a/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test
b/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test
--- a/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test 2007-10-14 12:32:28 +02:00
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test 2007-10-14 19:26:57 +02:00
@@ -3,6 +3,57 @@
--eval create table t1 (a int, b varchar(32), X $col_type, 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;
+--echo ************************************************
+--echo * some basic positive testing, i.e. no conflicts
+--echo ************************************************
+--connection master
+--echo *** 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;
+
+--echo *** master - update all
+--connection master
+begin;
+update t1 set b="Master t1 X=2", X=X+1;
+update t2 set b="Master t2 c=2", c=c+1;
+commit;
+--echo *** slave - check update all
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+
+--echo *** master - update 2 rows in different tables
+--connection master
+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;
+--echo *** slave - check update 2 rows in different tables
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+
+--echo *** master - delete all
+--connection master
+delete from t1;
+delete from t2;
+--echo *** slave - check delete all
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+
+--echo ************************
+--echo * start conflict testing
+--echo ************************
+--echo *** master - insert some data
+--connection master
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');
@@ -12,13 +63,16 @@ insert into t2 values (2, "Master t2 a=2
insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
commit;
+--echo *** slave - check conflict info, no conflicts yet
--sync_slave_with_master
--connection slave
--source include/ndb_conflict_info.inc
+--echo *** slave - check insert some data
select * from t1 order by a, d;
select * from t2 order by a, d;
+--echo *** 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';
@@ -28,6 +82,7 @@ update t2 set b="Slave t2 a=2 at c=12",
update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
commit;
+--echo *** master - update some data to cause conflicts
--connection master
begin;
update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
@@ -38,13 +93,18 @@ update t2 set b="Master t2 a=2 at c=11",
update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
commit;
+--echo *** slave - check conflict info, there should be some
--sync_slave_with_master
--connection slave
--source include/ndb_conflict_info.inc
+--echo *** slave - check update some data that causes conflicts
select * from t1 order by a, d;
select * from t2 order by a, d;
+--echo *** 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';
+--echo *** master - update some data, use higher timestamp
--connection master
begin;
update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
@@ -55,10 +115,12 @@ update t2 set b="Master t2 a=2 at c=13",
update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
commit;
+--echo *** slave - check conflict info, change depends on calling test
--sync_slave_with_master
--connection slave
--source include/ndb_conflict_info.inc
+--echo *** slave - check higer timestamp
select * from t1 order by a, d;
select * from t2 order by a, d;
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result 2007-10-14 14:27:35 +02:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result 2007-10-14 19:26:57 +02:00
@@ -4,10 +4,67 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-**** Test 1 ****
+*** Test 1 ********************************************************
+* test native NDB() conflict resolution
+* test with both allowed "conflict column" types, uint32 and uint64
+*******************************************************************
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
+*** 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
+*** 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
+************************
+* 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');
@@ -16,6 +73,7 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
@@ -26,6 +84,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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
@@ -36,6 +95,7 @@ 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
+*** 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';
@@ -44,6 +104,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -52,6 +113,7 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
3
@@ -62,6 +124,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 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
@@ -72,6 +135,9 @@ 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';
+*** 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';
@@ -80,6 +146,7 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
3
@@ -90,6 +157,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 higer timestamp
select * from t1 order by a, d;
a b X d
1 Master t1 a=1 at X=13 13 111
@@ -101,11 +169,69 @@ a b c d
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 2 ********************************************************
+* test native NDB() conflict resolution
+* test with both allowed "conflict column" types, uint32 and uint64
+* test that setting binlog update option via table works equally well
+*******************************************************************
set global ndb_log_update_as_write=1;
update mysql.ndb_replication set binlog_type=4;
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
+*** 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
+*** 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
+************************
+* 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');
@@ -114,6 +240,7 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
3
@@ -124,6 +251,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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
@@ -134,6 +262,7 @@ 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
+*** 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';
@@ -142,6 +271,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -150,6 +280,7 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
6
@@ -160,6 +291,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 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
@@ -170,6 +302,9 @@ 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';
+*** 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';
@@ -178,6 +313,7 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
6
@@ -188,6 +324,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 higer timestamp
select * from t1 order by a, d;
a b X d
1 Master t1 a=1 at X=13 13 111
@@ -199,11 +336,69 @@ a b c d
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 3 ***********************************************************
+* test that setting binlog type really also sets the "USE_UPDATE" flag
+* in this case it will result in conflict resolution failure, as
+* update_row never gets called
+* ********************************************************************
set global ndb_log_update_as_write=0;
update mysql.ndb_replication set binlog_type=2;
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
+*** 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
+*** 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
+************************
+* 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');
@@ -212,6 +407,7 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
6
@@ -222,6 +418,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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
@@ -232,6 +429,7 @@ 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
+*** 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';
@@ -240,6 +438,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -248,6 +447,7 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
6
@@ -258,6 +458,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 update some data that causes conflicts
select * from t1 order by a, d;
a b X d
1 Master t1 a=1 at X=11 11 111
@@ -268,6 +469,9 @@ 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';
+*** 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';
@@ -276,6 +480,7 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
6
@@ -286,6 +491,7 @@ SELECT * FROM `t1$EX` ORDER BY server_id
SELECT * FROM `t1$EX` ORDER BY 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 higer timestamp
select * from t1 order by a, d;
a b X d
1 Master t1 a=1 at X=13 13 111
@@ -297,3 +503,4 @@ a b c d
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 cleanup
diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result
b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result 2007-10-14 12:32:28 +02:00
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result 2007-10-14 19:26:57 +02:00
@@ -4,10 +4,67 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-**** Test 1 ****
+*** Test 1 ********************************************************
+* test native NDB() conflict resolution
+* test with both allowed "conflict column" types, uint32 and uint64
+*******************************************************************
insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$OLD(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
+*** 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
+*** 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
+************************
+* 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');
@@ -16,6 +73,7 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
@@ -28,6 +86,7 @@ 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
@@ -38,6 +97,7 @@ 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
+*** 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';
@@ -46,6 +106,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -54,6 +115,7 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
@@ -72,6 +134,7 @@ server_id master_server_id master_epoch
2 1 # # 3 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
@@ -82,6 +145,9 @@ 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';
+*** 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';
@@ -90,12 +156,13 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-6
+5
SELECT * 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 # #
@@ -103,20 +170,19 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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
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 Slave t1 a=1 at X=12 12 111
+1 Master t1 a=1 at X=13 13 111
2 Slave t1 a=2 at X=12 12 111222
3 Slave t1 a=3 at X=12 12 111222333
select * from t2 order by a, d;
@@ -125,11 +191,69 @@ a b c d
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 2 ********************************************************
+* test native NDB() conflict resolution
+* test with both allowed "conflict column" types, uint32 and uint64
+* test that setting binlog update option via table works equally well
+*******************************************************************
set global ndb_log_update_as_write=1;
update mysql.ndb_replication set binlog_type=4;
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
+*** 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
+*** 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
+************************
+* 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');
@@ -138,12 +262,13 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-6
+5
SELECT * 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 # #
@@ -151,17 +276,16 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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
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
@@ -172,6 +296,7 @@ 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
+*** 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';
@@ -180,6 +305,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -188,12 +314,13 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-9
+8
SELECT * 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 # #
@@ -201,7 +328,6 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
2 1 # 1 # #
2 1 # 2 # #
2 1 # 3 # #
@@ -209,7 +335,6 @@ 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 # # 1 111
2 1 # # 2 111222
2 1 # # 2 111222
2 1 # # 2 111222
@@ -218,6 +343,7 @@ server_id master_server_id master_epoch
2 1 # # 3 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
@@ -228,6 +354,9 @@ 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';
+*** 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';
@@ -236,12 +365,13 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-12
+10
SELECT * 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 # #
@@ -249,19 +379,15 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
2 1 # 1 # #
2 1 # 2 # #
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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 # # 1 111
-2 1 # # 1 111
2 1 # # 2 111222
2 1 # # 2 111222
2 1 # # 2 111222
@@ -272,9 +398,10 @@ server_id master_server_id master_epoch
2 1 # # 3 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 Slave t1 a=1 at X=12 12 111
+1 Master t1 a=1 at X=13 13 111
2 Slave t1 a=2 at X=12 12 111222
3 Slave t1 a=3 at X=12 12 111222333
select * from t2 order by a, d;
@@ -283,11 +410,69 @@ a b c d
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 3 ***********************************************************
+* test that setting binlog type really also sets the "USE_UPDATE" flag
+* in this case it will result in conflict resolution failure, as
+* update_row never gets called
+* ********************************************************************
set global ndb_log_update_as_write=0;
update mysql.ndb_replication set binlog_type=2;
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
+*** 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
+*** 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
+************************
+* 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');
@@ -296,12 +481,13 @@ insert into t2 values (1, "Master t2 a=1
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');
commit;
+*** slave - check conflict info, no conflicts yet
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-12
+10
SELECT * 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 # #
@@ -309,19 +495,15 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
2 1 # 1 # #
2 1 # 2 # #
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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 # # 1 111
-2 1 # # 1 111
2 1 # # 2 111222
2 1 # # 2 111222
2 1 # # 2 111222
@@ -332,6 +514,7 @@ server_id master_server_id master_epoch
2 1 # # 3 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 insert some data
select * from t1 order by a, d;
a b X d
1 Master t1 a=1 at X=10 10 111
@@ -342,6 +525,7 @@ 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
+*** 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';
@@ -350,6 +534,7 @@ update t2 set b="Slave t2 a=1 at c=12",
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;
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';
@@ -358,12 +543,13 @@ update t2 set b="Master t2 a=1 at c=11",
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;
commit;
+*** slave - check conflict info, there should be some
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-12
+10
SELECT * 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 # #
@@ -371,19 +557,15 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
2 1 # 1 # #
2 1 # 2 # #
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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 # # 1 111
-2 1 # # 1 111
2 1 # # 2 111222
2 1 # # 2 111222
2 1 # # 2 111222
@@ -394,6 +576,7 @@ server_id master_server_id master_epoch
2 1 # # 3 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=11 11 111
@@ -404,6 +587,9 @@ 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';
+*** 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';
@@ -412,12 +598,13 @@ update t2 set b="Master t2 a=1 at c=13",
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
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
VARIABLE_VALUE-@init_ndb_conflict_fn_max
0
SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
VARIABLE_VALUE-@init_ndb_conflict_fn_old
-12
+10
SELECT * 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 # #
@@ -425,19 +612,15 @@ server_id master_server_id master_epoch
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
2 1 # 1 # #
2 1 # 2 # #
2 1 # 3 # #
2 1 # 4 # #
2 1 # 5 # #
-2 1 # 6 # #
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 # # 1 111
-2 1 # # 1 111
2 1 # # 2 111222
2 1 # # 2 111222
2 1 # # 2 111222
@@ -448,6 +631,7 @@ server_id master_server_id master_epoch
2 1 # # 3 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
@@ -459,3 +643,4 @@ a b c d
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 cleanup
diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test
b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test 2007-10-08 22:14:38 +02:00
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test 2007-10-14 19:26:57 +02:00
@@ -23,35 +23,38 @@ drop table if exists `test`.`t2$EX`;
--enable_warnings
--enable_query_log
-##
-# test native NDB$MAX() conflict resolution
-# test with both allowed "conflict column" types, uint32 and uint64
-#
---echo **** Test 1 ****
+--echo *** Test 1 ********************************************************
+--echo * test native NDB$MAX() conflict resolution
+--echo * test with both allowed "conflict column" types, uint32 and uint64
+--echo *******************************************************************
--connection master
insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$MAX(X)");
--let col_type = int unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
-# test that setting binlog update option via table works equally well
---echo **** Test 2 ****
+
+--echo *** Test 2 ********************************************************
+--echo * test native NDB$MAX() conflict resolution
+--echo * test with both allowed "conflict column" types, uint32 and uint64
+--echo * test that setting binlog update option via table works equally well
+--echo *******************************************************************
--connection master
set global ndb_log_update_as_write=1;
update mysql.ndb_replication set binlog_type=4;
--let col_type = bigint unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
-##
-# test that setting binlog type really also sets the "USE_UPDATE" flag
-# in this case it will result in conflict resolution failure, as
-# update_row never gets called
-#
---echo **** Test 3 ****
+--echo *** Test 3 ***********************************************************
+--echo * test that setting binlog type really also sets the "USE_UPDATE" flag
+--echo * in this case it will result in conflict resolution failure, as
+--echo * update_row never gets called
+--echo * ********************************************************************
--connection master
set global ndb_log_update_as_write=0;
update mysql.ndb_replication set binlog_type=2;
--let col_type = int unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
+--echo *** test cleanup
--disable_query_log
--connection slave
stop slave;
diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test
b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test 2007-10-14 12:32:28 +02:00
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test 2007-10-14 19:26:57 +02:00
@@ -31,35 +31,38 @@ create table `test`.`t1$EX`
--enable_warnings
--enable_query_log
-##
-# test native NDB$OLD() conflict resolution
-# test with both allowed "conflict column" types, uint32 and uint64
-#
---echo **** Test 1 ****
+--echo *** Test 1 ********************************************************
+--echo * test native NDB$OLD() conflict resolution
+--echo * test with both allowed "conflict column" types, uint32 and uint64
+--echo *******************************************************************
--connection master
insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$OLD(X)");
--let col_type = int unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
-# test that setting binlog update option via table works equally well
---echo **** Test 2 ****
+
+--echo *** Test 2 ********************************************************
+--echo * test native NDB$OLD() conflict resolution
+--echo * test with both allowed "conflict column" types, uint32 and uint64
+--echo * test that setting binlog update option via table works equally well
+--echo *******************************************************************
--connection master
set global ndb_log_update_as_write=1;
update mysql.ndb_replication set binlog_type=4;
--let col_type = bigint unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
-##
-# test that setting binlog type really also sets the "USE_UPDATE" flag
-# in this case it will result in conflict resolution failure, as
-# update_row never gets called
-#
---echo **** Test 3 ****
+--echo *** Test 3 ***********************************************************
+--echo * test that setting binlog type really also sets the "USE_UPDATE" flag
+--echo * in this case it will result in conflict resolution failure, as
+--echo * update_row never gets called
+--echo * ********************************************************************
--connection master
set global ndb_log_update_as_write=0;
update mysql.ndb_replication set binlog_type=2;
--let col_type = int unsigned
--source extra/rpl_tests/rpl_ndb_conflict_1.test
+--echo *** test cleanup
--disable_query_log
--connection slave
stop slave;
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2650) | tomas | 14 Oct |