Debian Codegraph @

mysql-test/suite/storage_engine/insert_low_prio.test

raw
1 #
2 # INSERT LOW_PRIORITY
3 #
4 --source have_engine.inc
5
6 --source include/count_sessions.inc
7
8 --disable_warnings
9 DROP TABLE IF EXISTS t1;
10 --enable_warnings
11
12 # We will be changing the GLOBAL value of low_priority_updates
13 # due to bug#64892
14 # (Session-level low_priority_updates does not work for INSERT)
15 SET @low_prio_updates = @@global.low_priority_updates;
16
17 # Concurrent insert might interfere
18 # with HIGH|LOW_PRIORITY logic
19 SET @concur_insert = @@global.concurrent_insert;
20 SET GLOBAL concurrent_insert = NEVER;
21
22 --source create_table.inc
23 INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b');
24
25 # We will have 3 connections:
26 # con1 will start SELECT which should give us enough time;
27 # con0 will run INSERT
28 # con2 will then start another SELECT.
29 # With INSERT LOW_PRIORITY we should see only old rows in both resultsets.
30
31 --connect (con0,localhost,root,,)
32 SET lock_wait_timeout = 4;
33 --connect (con1,localhost,root,,)
34 SET lock_wait_timeout = 4;
35 --connect (con2,localhost,root,,)
36 SET lock_wait_timeout = 4;
37
38 --connection con1
39
40 --send
41 SELECT SLEEP(1) FROM t1;
42
43 --connection con0
44 let $show_statement = SHOW PROCESSLIST;
45 let $field = State;
46 let $condition = = 'User sleep';
47 # We don't need to wait long,
48 # thread should show up in the processlist right away
49 let $wait_timeout = 2;
50 --source include/wait_show_condition.inc
51 --send
52 INSERT LOW_PRIORITY INTO t1 (a,b) VALUES (3,'z');
53
54 --connection con2
55
56 let $condition = = 'Waiting for table level lock';
57 let $wait_timeout = 2;
58 --source include/wait_show_condition.inc
59 if (!$found)
60 {
61 --let $mysql_errname = timeout in wait_show_condition
62 --let $functionality = INSERT LOW_PRIORITY or table locking
63 --source unexpected_result.inc
64 }
65 if ($found)
66 {
67 --echo # Should return only 2 rows
68 SELECT SLEEP(1) FROM t1;
69 }
70
71 --connection con1
72 --reap
73
74 --connection con0
75 --reap
76 --sorted_result
77 SELECT a,b FROM t1;
78
79 --disconnect con0
80 --disconnect con1
81 --disconnect con2
82 --connection default
83
84 SET GLOBAL low_priority_updates = @low_prio_updates;
85 SET GLOBAL concurrent_insert = @concur_insert;
86
87 # Cleanup
88 DROP TABLE t1;
89
90 --source include/wait_until_count_sessions.inc
91
92 --source cleanup_engine.inc
93