File: galera_concurrent_ctas.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (100 lines) | stat: -rw-r--r-- 2,735 bytes parent folder | download | duplicates (3)
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
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug_sync.inc

#
# To have real concurrent CTAS this test uses DEBUG_SYNC
#

--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2

--connection node_1
#
# Send CTAS it will block before open_tables call
#
SET DEBUG_SYNC = 'wsrep_create_table_as_select WAIT_FOR continue';
--send CREATE table t1 as SELECT SLEEP(0.1);

--connection node_1a
#
# Wait for CTAS to block
#
--echo # Wait until CTAS is on debug sync point
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: wsrep_create_table_as_select'
--source include/wait_condition.inc

--connection node_1b
#
# Block node_1 applier
#
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb';

#
# Send concurrent CTAS it will block on applier
#
--connection node_2
--send CREATE table t1 as SELECT SLEEP(0.2);

#
# Wait until second CTAS is blocked
#
--connection node_1b
SET SESSION debug_sync = 'now WAIT_FOR sync.wsrep_apply_cb_reached';

--echo # Signal first CTAS to continue and wait until CTAS has executed
SET DEBUG_SYNC= 'now SIGNAL continue';
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Creating table	CREATE table t1 as SELECT SLEEP(0.1)'
--source include/wait_condition.inc

--connection node_2b
--echo # Wait first CTAS to replicate
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
SELECT * FROM t1;

--connection node_1b
#
# Release second CTAS and cleanup
#
SET GLOBAL debug_dbug= '';
SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb';
#
# Wait until second CTAS continues
#
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point: now%'
--source include/wait_condition.inc
#
# Wait until second CTAS finishes
#
--connection node_2a
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Creating table	CREATE table t1 as SELECT SLEEP(0.2)'
--source include/wait_condition.inc
#
# Cleanup
#
--connection node_1b
SET DEBUG_SYNC= 'RESET';
#
# Verify that at least one is successful
#
--connection node_2
--reap
SELECT * FROM t1;

--connection node_1
--error 0,ER_QUERY_INTERRUPTED,ER_LOCK_DEADLOCK
--reap
SELECT * FROM t1;
DROP TABLE t1;

--disconnect node_1a
--disconnect node_1b
--disconnect node_2a
--disconnect node_2b

--source include/galera_end.inc
--echo # End of test