Debian Codegraph @

mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_max_ins_2.test

raw
1 #
2 # Test engine native conflict resolution for
3 # NDB$MAX_INS algorithm for INSERT operations
4 #
5
6 --source include/have_ndb.inc
7 --source include/have_binlog_format_mixed_or_row.inc
8 --source suite/ndb_rpl/ndb_master-slave.inc
9
10 --disable_query_log
11 --connection master
12 CREATE TABLE mysql.ndb_replication
13 (db VARBINARY(63),
14 table_name VARBINARY(63),
15 server_id INT UNSIGNED,
16 binlog_type INT UNSIGNED,
17 conflict_fn VARBINARY(128),
18 PRIMARY KEY USING HASH (db,table_name,server_id))
19 ENGINE=NDB PARTITION BY KEY(db,table_name);
20 create table `test`.`t1$EX`
21 (server_id int unsigned,
22 master_server_id int unsigned,
23 master_epoch bigint unsigned,
24 count int unsigned,
25 a int not null,
26 d varchar(9) not null,
27 primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
28 --enable_query_log
29
30 --echo *** Test 1 ********************************************************
31 --echo * test native NDB\$MAX_INS() conflict resolution
32 --echo * test with both allowed "conflict column" types, uint32 and uint64
33 --echo *******************************************************************
34 --connection master
35 set @save_luaw = @@global.ndb_log_update_as_write;
36 set @save_luo = @@global.ndb_log_updated_only;
37 set global ndb_log_update_as_write=0;
38 set global ndb_log_updated_only=0;
39 # Option 0 for binlog_type means use server defaults, above.
40 insert into mysql.ndb_replication values ("test", "t1", 0, 0, "NDB$MAX_INS(X)");
41 --let col_type = int unsigned
42 --source suite/ndb_rpl/t/ndb_rpl_conflict_2.inc
43
44 --echo *** Test 2 ********************************************************
45 --echo * test native NDB\$MAX_INS() conflict resolution
46 --echo * test with both allowed "conflict column" types, uint32 and uint64
47 --echo *******************************************************************
48 --connection master
49 --let col_type = bigint unsigned
50 --source suite/ndb_rpl/t/ndb_rpl_conflict_2.inc
51
52 --echo *** Test 3 ********************************************************
53 --echo * test native NDB\$MAX_INS() conflict resolution
54 --echo * test that setting binlog update option via table works equally well
55 --echo *******************************************************************
56 --connection master
57 set global ndb_log_update_as_write=1;
58 set global ndb_log_updated_only=1;
59 update mysql.ndb_replication set binlog_type=7; # Full, Use Update
60 --let col_type = bigint unsigned
61 --source suite/ndb_rpl/t/ndb_rpl_conflict_2.inc
62
63 --echo *** Test 4 ***********************************************************
64 --echo * test behaviour with updates logged as writes, but all columns present
65 --echo * Should succeed since the NDB\$MAX_INS() supports conflict detection
66 --echo * and resolution for INSERTS.
67 --echo * ********************************************************************
68 --connection master
69 update mysql.ndb_replication set binlog_type=3; # Full, Use Write
70 --let col_type = int unsigned
71 --source suite/ndb_rpl/t/ndb_rpl_conflict_2.inc
72
73 set @save_lum = @@global.ndb_log_update_minimal;
74 --echo *** Test 5 ****************************************************************************
75 --echo * Test with ndb_log_update_minimal binlogging option and NBT_UPDATED_FULLY_MINIMAL type
76 --echo ***************************************************************************************
77 set global ndb_log_update_minimal=1;
78 update mysql.ndb_replication set binlog_type=9;
79 --let col_type = int unsigned
80 --source suite/ndb_rpl/t/ndb_rpl_conflict_2.inc
81 set global ndb_log_update_minimal = @save_lum;
82
83 --echo *** test cleanup
84 set global ndb_log_update_as_write= @save_luaw;
85 set global ndb_log_updated_only = @save_luo;
86 --disable_query_log
87 --connection master
88 drop table mysql.ndb_replication;
89 drop table `test`.`t1$EX`;
90 --sync_slave_with_master
91 --enable_query_log
92
93 --source include/rpl_end.inc