Debian Codegraph @

mysql-test/suite/storage_engine/update_low_prio.test

raw
1 #
2 # UPDATE 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 --source create_table.inc
13 INSERT INTO t1 (a,b) VALUES (11,'foobar'),(12,'b');
14
15 # We will have 3 connections:
16 # con1 will start SELECT which should give us enough time;
17 # default will run UPDATE
18 # con2 will then start another SELECT.
19 # With LOW_PRIORITY_UPDATES = 0,
20 # with standard UPDATE we should see old data in con1 resultset,
21 # but new data in con2 resultset.
22 # With UPDATE LOW_PRIORITY we should see old data in both resultsets.
23 # Then we will set LOW_PRIORITY_UPDATES to 1.
24 # Then with standard UPDATE we should also see old data in both resultsets.
25
26 SET LOW_PRIORITY_UPDATES = 0;
27 SET lock_wait_timeout = 4;
28
29 # Normal UPDATE with low_priority_updates=0
30
31 --connect (con1,localhost,root,,)
32 SET lock_wait_timeout = 2;
33 --send
34 SELECT a+SLEEP(1) FROM t1;
35
36 --connection default
37 let $show_statement = SHOW PROCESSLIST;
38 let $field = State;
39 let $condition = = 'User sleep';
40 # We don't need to wait long,
41 # if the feature works, threads
42 # should show up in the processlist right away
43 let $wait_timeout = 2;
44 --source include/wait_show_condition.inc
45 --send
46 UPDATE t1 SET a=a+10;
47
48 --connect (con2,localhost,root,,)
49 SET lock_wait_timeout = 3;
50 let $field = Info;
51 let $condition = = 'UPDATE t1 SET a=a+10';
52 let $wait_timeout = 2;
53 --source include/wait_show_condition.inc
54 if (!$found)
55 {
56 --let $mysql_errname = timeout in wait_show_condition.inc
57 --let $functionality = Table locking
58 --source unexpected_result.inc
59 }
60 --sorted_result
61 SELECT a+SLEEP(1) FROM t1;
62
63 --connection con1
64 --sorted_result
65 --reap
66
67 --connection default
68 --reap
69 if ($mysql_errname)
70 {
71 --let $my_last_stmt = UPDATE t1 SET a=a+10
72 --let $functionality = UPDATE
73 --source unexpected_result.inc
74 }
75
76 --sorted_result
77 SELECT a,b FROM t1;
78
79 # UPDATE LOW_PRIORITY
80
81 --connection con1
82 --send
83 SELECT a+SLEEP(1) FROM t1;
84
85 --connection default
86 let $field = State;
87 let $condition = = 'User sleep';
88 let $wait_timeout = 2;
89 --source include/wait_show_condition.inc
90 --send
91 UPDATE LOW_PRIORITY t1 SET a=a+20;
92
93 --connection con2
94 let $field = Info;
95 let $condition = = 'UPDATE LOW_PRIORITY t1 SET a=a+20';
96 let $wait_timeout = 2;
97 --source include/wait_show_condition.inc
98 --sorted_result
99 SELECT a+SLEEP(1) FROM t1;
100
101 --connection con1
102 --sorted_result
103 --reap
104
105 --connection default
106 --reap
107 --sorted_result
108 SELECT a,b FROM t1;
109
110 SET LOW_PRIORITY_UPDATES = 1;
111
112 # Normal UPDATE with low_priority_updates=1
113
114 --connection con1
115 --send
116 SELECT a+SLEEP(1) FROM t1;
117
118 --connection default
119 let $field = State;
120 let $condition = = 'User sleep';
121 let $wait_timeout = 2;
122 --source include/wait_show_condition.inc
123 --send
124 UPDATE t1 SET a=a+30;
125
126 --connection con2
127 let $field = Info;
128 let $condition = = 'UPDATE t1 SET a=a+30';
129 let $wait_timeout = 2;
130 --source include/wait_show_condition.inc
131 if (!$found)
132 {
133 --let $mysql_errname = timeout in wait_show_condition.inc
134 --let $functionality = Table locking
135 --source unexpected_result.inc
136 }
137 --sorted_result
138 SELECT a+SLEEP(1) FROM t1;
139
140 --connection con1
141 --sorted_result
142 --reap
143
144 --connection default
145 --reap
146 if ($mysql_errname)
147 {
148 --let $my_last_stmt = UPDATE t1 SET a=a+30
149 --let $functionality = UPDATE
150 --source unexpected_result.inc
151 }
152 --sorted_result
153 SELECT a,b FROM t1;
154
155 --disconnect con1
156 --disconnect con2
157
158 --connection default
159 # Cleanup
160 DROP TABLE t1;
161
162 --source include/wait_until_count_sessions.inc
163
164 --source cleanup_engine.inc
165