Debian Codegraph @

mysql-test/suite/group_replication/t/gr_disregard_nonunique_key.test

raw
1 ################################################################################
2 #
3 # BUG#20975167 - --TRANSACTION-WRITE-SET-EXTRACTION IS CONSIDERING NON UNIQUE
4 # AND NULL KEYS
5 #
6 # This bug verified that a non unique key or a key with non unique null value
7 # should not be considered to check conflict between incoming transactions.
8 # **The above line is no longer true, GR behaviour is changed after fixing
9 # Bug#24479782**
10 #
11 # CASE I - One of the column of the table is a non unique key. So it should not
12 # be considered as a part of the conflict detection.
13 #
14 # Table t1 has a primary key and a key. For two transactions which have
15 # different primary key value, both should succeed and the table should
16 # finally have two rows.
17 #
18 # T1: WS={t1.(a)=(1,2)}
19 # T2: WS={t1.(a)=(3,2)}
20 #
21 # Outcome: T1 and T2 must commit.
22 #
23 # Test:
24 # 0. The test requires two servers: M1 and M2.
25 # 1. With both members ONLINE. Create a table on M1.
26 # 2. Set a debug sync before broadcast message to group on connection M1.
27 # Commit a transaction that will be blocked before broadcast.
28 # 3. Wait until M1 connection reaches the debug sync point.
29 # 4. Execute a transaction on M2, that will reach certification first, since M1
30 # is blocked before broadcast.
31 # 5. Signal the waiting thread on M1 to resume.
32 # 6. Must not error out since c2 column allows duplicate keys values.
33 # 7. Clean up.
34 ################################################################################
35
36 --source include/have_debug_sync.inc
37 --source include/have_group_replication_plugin.inc
38 --source include/group_replication.inc
39
40 --echo
41 --echo ############################################################
42 --echo # Create a table on server1.
43 --let $rpl_connection_name= server1
44 --source include/rpl_connection.inc
45 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, KEY `c2` (`c2`));
46 --source include/rpl_sync.inc
47
48 --let $local_server_connection1=server1
49 --let $local_server_connection2=server_1
50 --let $remote_server_connection=server2
51 --let $local_transaction=INSERT INTO t1 VALUES (1, 2)
52 --let $remote_transaction=INSERT INTO t1 VALUES (3, 2)
53 --let $conflict_test=0
54 --source include/gr_parallel_local_and_remote_transactions.inc
55
56 --echo
57 --echo ############################################################
58 --echo # Check data sanity.
59 --let $assert_text= The table should have two rows due to the two successful inserts
60 --let $assert_cond= `SELECT COUNT(*) = 2 FROM t1`
61 --source include/assert.inc
62
63 # Cleanup
64 DROP TABLE t1;
65 --source include/group_replication_end.inc