File: gr_high_prio_trx.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (108 lines) | stat: -rw-r--r-- 3,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
################################################################################
# Scenario:
#  SigCon=    ({R(B), W(B)})
#  GroupRepApplier=({R(B), W(B), C}, HIGH_PRIORITY).
#
# Outcome: SigCon must abort, THe GroupRepApplier must commit.
#
# Full details on WL#6835.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both members ONLINE. On M1 create table t1 and insert value 0 in
#    column c1.
# 2. On M2, create SIGCON connection using DEBUG point.
# 3. On M2, send update c1 from 0 to 99.
# 4. On M1, update c1 from 0 to 1.
# 5. On M2, wait for c1 to be 1.
# 6. On M2, now signal the waiting thread on sigcon to resume and it should
#    end up in an error stating that it was aborted.
# 7. On M2, reap. It should error out on COMMIT.
# 8. Validate data in c1. It should be 1 on M2.
# 9. Clean up.
################################################################################

--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429548
--source include/have_group_replication_plugin.inc

--source include/group_replication.inc

####### SERVER 1 #######
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0);

####### SIGCON (server2) #######
--let $rpl_connection_name= sigcon
--let $rpl_server_number= 2
--source include/rpl_connect.inc

--echo [connection sigcon]
--let $sync_slave_connection= sigcon
--source include/sync_slave_sql_with_master.inc

SET DEBUG_SYNC='ha_innobase_end_statement WAIT_FOR waiting1';

BEGIN;
--send UPDATE t1 SET c1=99 WHERE c1=0

####### SERVER 2 #######
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
# Wait until sigcon reaches the ha_innobase_update_row_done debug sync point.
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: ha_innobase_end_statement'
--source include/wait_condition.inc

####### SERVER 1 #######
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
UPDATE t1 SET c1=1 WHERE c1=0;

####### SERVER 2 #######
--let $rpl_connection_name= server2
--source include/rpl_connection.inc

# Wait for c1 in t1 to be 1
--let $wait_condition=SELECT COUNT(*)=1 FROM t1 WHERE c1=1
--source include/wait_condition.inc

# Now signal the waiting thread on sigcon to resume
# and it should end up in an error stating that it
# was aborted
SET DEBUG_SYNC='now SIGNAL waiting1';

####### SIGCON #######
--echo [connection sigcon]
--let $rpl_connection_name= sigcon
--source include/rpl_connection.inc
--reap
--error ER_ERROR_DURING_COMMIT
COMMIT;

--disconnect sigcon

####### SERVER 2 #######
--connection server1
--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc

--let $assert_text= 'There is a 1 in t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc

--let $assert_text= 'There is no 0 in t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 0, count, 1] = 0
--source include/assert.inc

--let $assert_text= 'There is no 99 in t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 99, count, 1] = 0
--source include/assert.inc

# Clean up.
--connection server1
DROP TABLE t1;

--source include/group_replication_end.inc