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 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_basic.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] insert into mysql.ndb_replication values ("test", "t1_old", 0, 7, "NDB$OLD(X)"); insert into mysql.ndb_replication values ("test", "t1_max", 0, 7, "NDB$MAX(X)"); insert into mysql.ndb_replication values ("test", "t1_max_delete_win", 0, 7, "NDB$MAX_DELETE_WIN(X)"); create table `t1_old$EX` (server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table `t1_max$EX` (server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table `t1_max_delete_win$EX` (server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table t1_old (a int primary key, b varchar(32), X int unsigned) engine = ndb; create table t1_max (a int primary key, b varchar(32), X int unsigned) engine = ndb; create table t1_max_delete_win (a int primary key, b varchar(32), X int unsigned) engine = ndb; "Test 1" insert into t1_old values (1, 'Initial X=1', 1); insert into t1_max values (1, 'Initial X=1', 1); insert into t1_max_delete_win values (1, 'Initial X=1', 1); update t1_old set X = 2, b='Slave X=2'; update t1_max set X = 2, b='Slave X=2'; update t1_max_delete_win set X = 2, b='Slave X=2'; update t1_old set X = 3, b='Master X=3'; update t1_max set X = 3, b='Master X=3'; update t1_max_delete_win set X = 3, b='Master X=3'; "Expect t1_old to contain slave row, and t1_max* to contain master row" select * from t1_old; a b X 1 Slave X=2 2 select * from t1_max; a b X 1 Master X=3 3 select * from t1_max_delete_win; a b X 1 Master X=3 3 update t1_old set X = 3, b='Master X=3'; "Test 2" update t1_old set X = 4, b='Slave X=4'; update t1_max set X = 4, b='Slave X=4'; update t1_max_delete_win set X = 4, b='Slave X=4'; delete from t1_old; delete from t1_max; delete from t1_max_delete_win; "Expect t1_old and t1_max to contain slave row, and t1_max_delete_win to be empty(as master)" select * from t1_old; a b X 1 Slave X=4 4 select * from t1_max; a b X 1 Slave X=4 4 select * from t1_max_delete_win; a b X delete from t1_old; delete from t1_max; drop table t1_old, t1_max, t1_max_delete_win; delete from t1_old$EX; delete from t1_max$EX; delete from t1_max_delete_win$EX; delete from t1_old$EX; delete from t1_max$EX; delete from t1_max_delete_win$EX; create table t1_old (a int primary key, b longtext, X int unsigned) engine = ndb; create table t1_max (a int primary key, b longtext, X int unsigned) engine = ndb; create table t1_max_delete_win (a int primary key, b longtext, X int unsigned) engine = ndb; "Test 3" insert into t1_old values (1, repeat('Initial X=1',1000), 1); insert into t1_max values (1, repeat('Initial X=1',1000), 1); insert into t1_max_delete_win values (1, repeat('Initial X=1',1000), 1); update t1_old set X = 2, b=repeat('Slave X=2',1001); update t1_max set X = 2, b=repeat('Slave X=2',1001); update t1_max_delete_win set X = 2, b=repeat('Slave X=2',1001); update t1_old set X = 3, b=repeat('Master X=3',1002); update t1_max set X = 3, b=repeat('Master X=3',1002); update t1_max_delete_win set X = 3, b=repeat('Master X=3',1002); "Expect t1_old to contain slave row, and t1_max* to contain master row" select a, left(b, 20), length(b), X from t1_old; a left(b, 20) length(b) X 1 Slave X=2Slave X=2Sl 9009 2 select a, left(b, 20), length(b), X from t1_max; a left(b, 20) length(b) X 1 Master X=3Master X=3 10020 3 select a, left(b, 20), length(b), X from t1_max_delete_win; a left(b, 20) length(b) X 1 Master X=3Master X=3 10020 3 Expect t1_old to have 1 entry, and t1_max* to have no entries select server_id, master_server_id, count, a from t1_old$EX order by count; server_id master_server_id count a 2 1 1 1 select server_id, master_server_id, count, a from t1_max$EX order by count; server_id master_server_id count a select server_id, master_server_id, count, a from t1_max_delete_win$EX order by count; server_id master_server_id count a delete from t1_max$EX; delete from t1_max_delete_win$EX; delete from t1_old$EX; update t1_old set X = 3, b=repeat('Master X=3', 1002); "Test 4" update t1_old set X = 4, b=repeat('Slave X=4',2000); update t1_max set X = 4, b=repeat('Slave X=4',2000); update t1_max_delete_win set X = 4, b=repeat('Slave X=4',2000); delete from t1_old; delete from t1_max; delete from t1_max_delete_win; "Expect t1_old and t1_max to contain slave row, and t1_max_delete_win to be empty(as master)" select a, left(b, 20), length(b), X from t1_old; a left(b, 20) length(b) X 1 Slave X=4Slave X=4Sl 18000 4 select a, left(b, 20), length(b), X from t1_max; a left(b, 20) length(b) X 1 Slave X=4Slave X=4Sl 18000 4 select a, left(b, 20), length(b), X from t1_max_delete_win; a left(b, 20) length(b) X Expect t1_old and t1_max to contain 1 entry, and t1_max_delete_win to be empty select server_id, master_server_id, count, a from t1_old$EX order by count; server_id master_server_id count a 2 1 2 1 select server_id, master_server_id, count, a from t1_max$EX order by count; server_id master_server_id count a 2 1 1 1 select server_id, master_server_id, count, a from t1_max_delete_win$EX order by count; server_id master_server_id count a delete from t1_max$EX; delete from t1_max_delete_win$EX; delete from t1_old$EX; delete from t1_old; delete from t1_max; delete from t1_max_delete_win; delete from t1_old; delete from t1_max; delete from t1_max_delete_win; "Test 5" Test that Updates affecting Blobs are rejected correctly on the slave drop table t1_max; create table t1_max (a int primary key, b int, c longtext, d longtext, X int unsigned) engine = ndb; insert into t1_max values (1, 1, repeat("B", 10000), repeat("E", 10001), 1); insert into t1_max values (2, 2, repeat("A", 10002), repeat("T", 10003), 1); update t1_max set X=20; Initial values on Slave select a,b,SHA1(c),length(c), SHA1(d), length(d), X from t1_max order by a; a b SHA1(c) length(c) SHA1(d) length(d) X 1 1 4a222e18b539cdefbf0960eaa7f4362a4976e1e0 10000 9641d473ab1bd921263190eee074397084933e2d 10001 20 2 2 f833241322c062495632923d74314a6a5c23034d 10002 2dad269dfa115f6c7e53e91a73251e597aab8fe9 10003 20 Originate update which will be rejected update t1_max set c=repeat("Z", 10006), d=repeat("I", 10005), X=2 where a=1; Check slave has rejected due to lower version select a,b,SHA1(c),length(c), SHA1(d), length(d), X from t1_max order by a; a b SHA1(c) length(c) SHA1(d) length(d) X 1 1 4a222e18b539cdefbf0960eaa7f4362a4976e1e0 10000 9641d473ab1bd921263190eee074397084933e2d 10001 20 2 2 f833241322c062495632923d74314a6a5c23034d 10002 2dad269dfa115f6c7e53e91a73251e597aab8fe9 10003 20 Originate delete which will be rejected (due to NDB-OLD) algorith delete from t1_max where a=1; Check slave has rejected due to before image mismatch select a,b,SHA1(c),length(c), SHA1(d), length(d), X from t1_max order by a; a b SHA1(c) length(c) SHA1(d) length(d) X 1 1 4a222e18b539cdefbf0960eaa7f4362a4976e1e0 10000 9641d473ab1bd921263190eee074397084933e2d 10001 20 2 2 f833241322c062495632923d74314a6a5c23034d 10002 2dad269dfa115f6c7e53e91a73251e597aab8fe9 10003 20 Originate insert which will be rejected (as row exists) insert into t1_max values (1, 1, repeat("R", 10004), repeat("A", 10007), 1); Check slave has rejected due to row existing already select a,b,SHA1(c),length(c), SHA1(d), length(d), X from t1_max order by a; a b SHA1(c) length(c) SHA1(d) length(d) X 1 1 4a222e18b539cdefbf0960eaa7f4362a4976e1e0 10000 9641d473ab1bd921263190eee074397084933e2d 10001 20 2 2 f833241322c062495632923d74314a6a5c23034d 10002 2dad269dfa115f6c7e53e91a73251e597aab8fe9 10003 20 Expect t1_max to have 3 entries select server_id, master_server_id, count, a from t1_old$EX order by count; server_id master_server_id count a select server_id, master_server_id, count, a from t1_max$EX order by count; server_id master_server_id count a 2 1 1 1 2 1 2 1 2 1 3 1 select server_id, master_server_id, count, a from t1_max_delete_win$EX order by count; server_id master_server_id count a delete from t1_max$EX; delete from t1_max_delete_win$EX; delete from t1_old$EX; Test 6 Check that non-Blob related operations in a batch with a Blob operation are still subject to conflict detection. insert into mysql.ndb_replication values ("test", "t2_max", 0, 7, "NDB$MAX(X)"); create table `t2_max$EX` (server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table t2_max (a int primary key, b int, X bigint unsigned) engine=ndb; insert into t2_max values (1,1,10), (2,2,10), (3,3,10), (4,4,10), (5,5,10); Now issue a transaction with a successful Blob op, and unsuccessful non-Blob op. Check that the Blob op succeeds, and the unsuccessful non-Blob op is handled as expected. begin; update t2_max set b=b+1, X=1 where a=3; update t1_max set c=repeat("R", 10008), d=repeat("A", 10009), X = 21 where a=1; commit; Contents on Slave Expect Blob data applied to t1_max, no update applied to t2_max select a,b,left(c,1), length(c), left(d,1), length(d), X from t1_max where a=1; a b left(c,1) length(c) left(d,1) length(d) X 1 1 R 10008 A 10009 21 select * from t2_max order by a; a b X 1 1 10 2 2 10 3 3 10 4 4 10 5 5 10 Expect No conflict in t1_max, 1 conflict in t2_max select server_id, master_server_id, count, a from t1_max$EX order by count; server_id master_server_id count a select server_id, master_server_id, count, a from t2_max$EX order by count; server_id master_server_id count a 2 1 1 3 drop table t2_max, t2_max$EX; drop table t1_old, `t1_old$EX`, t1_max, `t1_max$EX`, t1_max_delete_win, `t1_max_delete_win$EX`; delete from mysql.ndb_replication; Test that online table distribution sets up conflict functions and exceptions tables insert into mysql.ndb_replication values ("test", "t1allsame", 0, 7, "NDB$MAX(X)"); insert into mysql.ndb_replication values ("test", "t2diffex", 1, 7, "NDB$OLD(X)"); insert into mysql.ndb_replication values ("test", "t2diffex", 3, 7, "NDB$MAX(X)"); insert into mysql.ndb_replication values ("test", "t3oneex", 3, 7, "NDB$EPOCH()"); create table t2diffex$EX ( server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table t3oneex$EX ( server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, primary key(server_id, master_server_id, master_epoch, count)) engine ndb; create table t1allsame(a int primary key, b varchar(200), X int unsigned) engine=ndb; create table t2diffex(a int primary key, b varchar(200), X int unsigned) engine=ndb; create table t3oneex(a int primary key, b varchar(200)) engine=ndb; show variables like 'server_id'; Variable_name Value server_id 1 MySQLD error output for server 1.1 matching pattern %NDB Slave% relevant [note] ndb slave: table test.t2diffex using conflict_fn ndb$old on attribute x. [note] ndb slave: table test.t2diffex logging exceptions to test.t2diffex$ex [note] ndb slave: table test.t1allsame using conflict_fn ndb$max on attribute x. [note] ndb slave: table test.t2_max using conflict_fn ndb$max on attribute x. show variables like 'server_id'; Variable_name Value server_id 3 MySQLD error output for server 2.1 matching pattern %NDB Slave% relevant [warning] ndb slave: table test.t3oneex : no extra row author bits in table. [note] ndb slave: table test.t3oneex : ndb$epoch, low epoch resolution [note] ndb slave: table test.t2diffex using conflict_fn ndb$max on attribute x. [note] ndb slave: table test.t2diffex logging exceptions to test.t2diffex$ex [note] ndb slave: table test.t1allsame using conflict_fn ndb$max on attribute x. [note] ndb slave: table test.t2_max using conflict_fn ndb$max on attribute x. drop table t3oneex, t2diffex, t1allsame, t3oneex$EX, t2diffex$EX; delete from mysql.ndb_replication; Test exceptions table schema flexibility insert into mysql.ndb_replication values ("test", "t1", 0, 7, "NDB$MAX(X)"); Test 'normal' mandatory column names + all table pks create table test.t1$EX( server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, b int not null, c int not null, primary key (server_id, master_server_id, master_epoch, count)) engine=ndb; create table test.t1 (a int, b int, c int, d int, e int, X int unsigned, primary key(a,b,c)) engine=ndb; Generate a conflict on the slave insert into test.t1 values (1,1,1,1,1,1); update test.t1 set X=0 where a=1 and b=1 and c=1; Check that conflict has been recorded. select * from test.t1$EX; server_id master_server_id master_epoch count a b c 2 1 <epoch_num> 1 1 1 1 drop table test.t1; drop table test.t1$EX; Test 'normal' mandatory column names + all table pks + extra columns with same and different names to main table columns Also a defaulted extra column. create table test.t1$EX( server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, a int not null, b int not null, c int not null, d int, # Same name as main table, but user defined lilljeholmen varchar(50) default 'Slussen', # Separate, user defined primary key (server_id, master_server_id, master_epoch, count)) engine=ndb; create table test.t1 (a int, b int, c int, d int, e int, X int unsigned, primary key(a,b,c)) engine=ndb; Generate a conflict on the slave insert into test.t1 values (1,1,1,1,1,1); update test.t1 set X=0 where a=1 and b=1 and c=1; Check that conflict has been recorded. select * from test.t1$EX; server_id master_server_id master_epoch count a b c d lilljeholmen 2 1 <epoch_num> 1 1 1 1 NULL Slussen drop table test.t1; drop table test.t1$EX; Test unusual mandatory column names + all table pks + extra columns with same and different names to main table columns Also a defaulted extra column. create table test.t1$EX( monteverdi int unsigned, asparagi int unsigned, plenipotentiary bigint unsigned, mountebank int unsigned, a int not null, b int not null, c int not null, d int, # Same name as main table, but user defined lilljeholmen varchar(50) default 'Slussen', # Separate, user defined primary key (monteverdi, asparagi, plenipotentiary, mountebank)) engine=ndb; create table test.t1 (a int, b int, c int, d int, e int, X int unsigned, primary key(a,b,c)) engine=ndb; Generate a conflict on the slave insert into test.t1 values (1,1,1,1,1,1); update test.t1 set X=0 where a=1 and b=1 and c=1; Check that conflict has been recorded. select * from test.t1$EX; monteverdi asparagi plenipotentiary mountebank a b c d lilljeholmen 2 1 <epoch_num> 1 1 1 1 NULL Slussen drop table test.t1; drop table test.t1$EX; Test unusual mandatory column names + all table pks which are same as 'normal' exceptions table column names plus extra columns with same and different names to main table columns Also a defaulted extra column. create table test.t1$EX( monteverdi int unsigned, asparagi int unsigned, plenipotentiary bigint unsigned, mountebank int unsigned, server_id int unsigned not null, master_server_id int unsigned not null, master_epoch bigint unsigned not null, count int unsigned not null, d int, # Same name as main table, but user defined lilljeholmen varchar(50) default 'Slussen', # Separate, user defined primary key (monteverdi, asparagi, plenipotentiary, mountebank)) engine=ndb; create table test.t1 (server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, d int, e int, X int unsigned, primary key(server_id, master_server_id, master_epoch, count)) engine=ndb; Generate a conflict on the slave insert into test.t1 values (1,1,1,1,1,1,1); update test.t1 set X=0 where server_id=1 and master_server_id=1 and master_epoch=1 and count=1; Check that conflict has been recorded. select * from test.t1$EX; monteverdi asparagi plenipotentiary mountebank server_id master_server_id master_epoch count d lilljeholmen 2 1 <epoch_num> 1 1 1 1 1 NULL Slussen drop table test.t1; drop table test.t1$EX; call mtr.add_suppression("NDB Slave: exceptions table .* has wrong definition .*"); call mtr.add_suppression("NDB Slave: exceptions table .* has wrong definition .*"); call mtr.add_suppression("NDB Slave: exceptions table .* has wrong definition .*"); And some bad exceptions table schemata Keys in wrong positions create table test.t1$EX( a int not null, b int not null, c int not null, d int, # Same name as main table, but user defined lilljeholmen varchar(50) default 'Slussen', # Separate, user defined server_id int unsigned, master_server_id int unsigned, master_epoch bigint unsigned, count int unsigned, primary key (server_id, master_server_id, master_epoch, count)) engine=ndb; create table test.t1 (a int, b int, c int, d int, e int, X int unsigned, primary key(a,b,c)) engine=ndb; show warnings; Level Code Message MySQLD error output for server 1.1 matching pattern %NDB Slave% relevant [note] ndb slave: table test.t1 using conflict_fn ndb$max on attribute x. [warning] ndb slave: exceptions table t1$ex has wrong definition (initial 4 columns) drop table test.t1; drop table test.t1$EX; Test conflict_fn definitions in ndb_replication which cover exceptions tables and verify that conflict functions are not set up for exceptions tables. insert into mysql.ndb_replication values ("test", "t2%", 1, 7, "NDB$EPOCH()"); create table test.t2$EX ( server_id int unsigned NOT NULL, master_server_id int unsigned NOT NULL, master_epoch bigint unsigned NOT NULL, count int unsigned NOT NULL, a int NOT NULL, PRIMARY KEY (server_id,master_server_id,master_epoch,count) ) ENGINE=ndbcluster; create table test.t2 ( a int primary key, b varchar(100)) engine=ndb; count(*) 1 count(*) 1 drop table test.server_error_log; drop table test.t2; drop table test.t2$EX; "Cleanup" drop table mysql.ndb_replication; include/rpl_end.inc