Merge lp:~vlad-lesin/percona-server/5.6-sql_timeout into lp:percona-server/5.6
- 5.6-sql_timeout
- Merge into 5.6
Status: | Work in progress |
---|---|
Proposed branch: | lp:~vlad-lesin/percona-server/5.6-sql_timeout |
Merge into: | lp:percona-server/5.6 |
Diff against target: |
3089 lines (+857/-266) 61 files modified
Percona-Server/mysql-test/r/mysqld--help-notwin.result (+2/-0) Percona-Server/mysql-test/r/percona_sql_timeout.result (+120/-0) Percona-Server/mysql-test/suite/sys_vars/r/sql_timeout_basic.result (+151/-0) Percona-Server/mysql-test/suite/sys_vars/t/sql_timeout_basic.test (+194/-0) Percona-Server/mysql-test/t/percona_sql_timeout.test (+82/-0) Percona-Server/sql/binlog.cc (+3/-3) Percona-Server/sql/debug_sync.cc (+12/-12) Percona-Server/sql/event_queue.cc (+3/-3) Percona-Server/sql/event_scheduler.cc (+1/-1) Percona-Server/sql/filesort.cc (+4/-7) Percona-Server/sql/ha_ndbcluster.cc (+12/-12) Percona-Server/sql/ha_ndbcluster_binlog.cc (+14/-14) Percona-Server/sql/handler.cc (+5/-5) Percona-Server/sql/item_func.cc (+10/-5) Percona-Server/sql/item_subselect.cc (+1/-1) Percona-Server/sql/lock.cc (+2/-2) Percona-Server/sql/log.cc (+2/-2) Percona-Server/sql/log_event.cc (+1/-1) Percona-Server/sql/mysqld.cc (+2/-2) Percona-Server/sql/opt_range.cc (+1/-1) Percona-Server/sql/records.cc (+3/-3) Percona-Server/sql/rpl_gtid_execution.cc (+2/-2) Percona-Server/sql/rpl_gtid_state.cc (+1/-1) Percona-Server/sql/rpl_master.cc (+2/-2) Percona-Server/sql/rpl_rli.cc (+5/-5) Percona-Server/sql/rpl_rli_pdb.cc (+9/-9) Percona-Server/sql/rpl_slave.cc (+9/-9) Percona-Server/sql/signal_handler.cc (+1/-1) Percona-Server/sql/sp.cc (+2/-2) Percona-Server/sql/sp_head.cc (+6/-6) Percona-Server/sql/sp_instr.cc (+1/-1) Percona-Server/sql/sp_rcontext.cc (+1/-1) Percona-Server/sql/sql_admin.cc (+1/-1) Percona-Server/sql/sql_base.cc (+5/-5) Percona-Server/sql/sql_cache.cc (+2/-2) Percona-Server/sql/sql_class.cc (+15/-14) Percona-Server/sql/sql_class.h (+31/-4) Percona-Server/sql/sql_connect.cc (+4/-4) Percona-Server/sql/sql_db.cc (+5/-5) Percona-Server/sql/sql_delete.cc (+8/-8) Percona-Server/sql/sql_executor.cc (+12/-12) Percona-Server/sql/sql_insert.cc (+27/-27) Percona-Server/sql/sql_join_buffer.cc (+4/-4) Percona-Server/sql/sql_load.cc (+9/-9) Percona-Server/sql/sql_optimizer.cc (+2/-2) Percona-Server/sql/sql_parse.cc (+20/-12) Percona-Server/sql/sql_planner.cc (+2/-2) Percona-Server/sql/sql_prepare.cc (+1/-1) Percona-Server/sql/sql_reload.cc (+2/-2) Percona-Server/sql/sql_servers.cc (+3/-3) Percona-Server/sql/sql_show.cc (+5/-5) Percona-Server/sql/sql_table.cc (+3/-3) Percona-Server/sql/sql_update.cc (+8/-8) Percona-Server/sql/sys_vars.cc (+6/-0) Percona-Server/sql/table.cc (+1/-1) Percona-Server/storage/innobase/row/row0mysql.cc (+1/-1) Percona-Server/storage/myisam/ha_myisam.cc (+6/-6) Percona-Server/storage/myisam/mi_check.c (+5/-5) Percona-Server/storage/myisam/myisamchk.c (+2/-4) Percona-Server/storage/myisam/myisamdef.h (+1/-1) Percona-Server/storage/myisam/sort.c (+2/-2) |
To merge this branch: | bzr merge lp:~vlad-lesin/percona-server/5.6-sql_timeout |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Needs Fixing | ||
Review via email: mp+142497@code.launchpad.net |
Commit message
Description of the change
New system variable "SQL_TIMEOUT" allows to set limit for query execution time.
If this limit is exceeded the query is killed. SQL_TIMEOUT can be global or
session variable.
The timeout expiration is checked on each db-thread killed state check. If timeout
expires the function that returns thread killed status will return the value which
corresponds to "killed query" status.
Jenkins: http://
Clean 5.6: http://
There can be some issues during merging as THD::killed was renamed to THD::killed_status and became private. But there are getter THD::get_killed() and setter THD::set_killed() which can be used to resolve issues if some new code work with THD::killed.
- 311. By Vlad Lesin
-
New system variable "SQL_TIMEOUT" allows to set limit for query execution time.
If this limit is exceeded the query is killed. SQL_TIMEOUT can be global or
session variable.The timeout expiration is checked on each db-thread killed state check. If timeout
expires the function that returns thread killed status will return the value which
corresponds to "killed query" status.
Alexey Kopytov (akopytov) wrote : | # |
Vlad,
- generally I would use check_killed() instead of get_killed(). yes,
that would be a bit inconsistent naming with set_killed(), but that
would also make porting APC easier, should we need to do so.
- mysqld-
- setting sql_timeout_expire in mysql_parse() prevents the feature
from working with client API prepared statements. this check should
be done in dispatch_command()
- doing it in dispatch_command() will also make statement-based
replication immune to sql_timeout. which is good.
- many lines use tabs for indentation. you can get them with the
following command:
bzr diff -c-1 | grep "+\t"
- changes in merge_buffers() in filesort.cc break the logic it used
previously, i.e. check the killed state on each iteration in the
"while" loop, unless param->not_killable is set.
What we do now is: check the killed state before executing the loop,
reset it if param->not_killable is set, then check the same value
inside the loop. See how that code has been changed in MariaDB to
support APC.
- same problem as above in storage/
- in Interruptible_
only after waiting for the full timeout value, which means up to 5
seconds. Why not do a similar check as with the m_abs_timeout? In
this case you don't even need a call to m_thd->get_killed() as it
will be checked by the caller.
- another problem from the above code is that checking get_killed()
and resetting the error in Interruptible_
normal status to the user. I.e. SELECT SLEEP(N) should fail "ERROR
1317 (70100): Query execution was interrupted" when the timeout is
exceeded, but it doesn't. Same with user-level locks.
- in get_killed(), I'd rewrite it like this to not rely on how smart
is the compiler:
if (!sql_timeout_
return killed_status;
return (my_micro_time() >= sql_timeout_expire) ? THD::KILL_QUERY :
- I wonder if we really need my_micro_time() for this. my_time() has
1 second resolution (which is sufficient in this case) and is also
faster.
- in MyISAM code, I would use thd_killed() and keep the killed_ptr()
name in the same way it is implemented in MariaDB.
Alexey Kopytov (akopytov) wrote : | # |
Vlad,
Please also update the BP. It should contain everything Hrvoje needs to know to document the feature.
Unmerged revisions
- 311. By Vlad Lesin
-
New system variable "SQL_TIMEOUT" allows to set limit for query execution time.
If this limit is exceeded the query is killed. SQL_TIMEOUT can be global or
session variable.The timeout expiration is checked on each db-thread killed state check. If timeout
expires the function that returns thread killed status will return the value which
corresponds to "killed query" status.
Preview Diff
1 | === modified file 'Percona-Server/mysql-test/r/mysqld--help-notwin.result' | |||
2 | --- Percona-Server/mysql-test/r/mysqld--help-notwin.result 2012-12-04 08:24:59 +0000 | |||
3 | +++ Percona-Server/mysql-test/r/mysqld--help-notwin.result 2013-01-09 13:41:38 +0000 | |||
4 | @@ -894,6 +894,7 @@ | |||
5 | 894 | replication. | 894 | replication. |
6 | 895 | --sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual | 895 | --sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual |
7 | 896 | for the complete list of valid sql modes | 896 | for the complete list of valid sql modes |
8 | 897 | --sql-timeout=# Timeout in seconds to wait before killing query. | ||
9 | 897 | --stored-program-cache=# | 898 | --stored-program-cache=# |
10 | 898 | The soft upper limit for number of cached stored routines | 899 | The soft upper limit for number of cached stored routines |
11 | 899 | for one connection. | 900 | for one connection. |
12 | @@ -1233,6 +1234,7 @@ | |||
13 | 1233 | sort-buffer-size 262144 | 1234 | sort-buffer-size 262144 |
14 | 1234 | sporadic-binlog-dump-fail FALSE | 1235 | sporadic-binlog-dump-fail FALSE |
15 | 1235 | sql-mode NO_ENGINE_SUBSTITUTION | 1236 | sql-mode NO_ENGINE_SUBSTITUTION |
16 | 1237 | sql-timeout 0 | ||
17 | 1236 | stored-program-cache 256 | 1238 | stored-program-cache 256 |
18 | 1237 | symbolic-links FALSE | 1239 | symbolic-links FALSE |
19 | 1238 | sync-binlog 0 | 1240 | sync-binlog 0 |
20 | 1239 | 1241 | ||
21 | === added file 'Percona-Server/mysql-test/r/percona_sql_timeout.result' | |||
22 | --- Percona-Server/mysql-test/r/percona_sql_timeout.result 1970-01-01 00:00:00 +0000 | |||
23 | +++ Percona-Server/mysql-test/r/percona_sql_timeout.result 2013-01-09 13:41:38 +0000 | |||
24 | @@ -0,0 +1,120 @@ | |||
25 | 1 | SLEEP(1) | ||
26 | 2 | 0 | ||
27 | 3 | SLEEP(1000) | ||
28 | 4 | 1 | ||
29 | 5 | SLEEP(2) | ||
30 | 6 | 0 | ||
31 | 7 | SLEEP(1) | ||
32 | 8 | 0 | ||
33 | 9 | SLEEP(1000) | ||
34 | 10 | 1 | ||
35 | 11 | SLEEP(2) | ||
36 | 12 | 0 | ||
37 | 13 | SLEEP(1) | ||
38 | 14 | 0 | ||
39 | 15 | SLEEP(1000) | ||
40 | 16 | 1 | ||
41 | 17 | SLEEP(2) | ||
42 | 18 | 0 | ||
43 | 19 | SLEEP(1) | ||
44 | 20 | 0 | ||
45 | 21 | SLEEP(1000) | ||
46 | 22 | 1 | ||
47 | 23 | SLEEP(2) | ||
48 | 24 | 0 | ||
49 | 25 | SLEEP(1) | ||
50 | 26 | 0 | ||
51 | 27 | SLEEP(1000) | ||
52 | 28 | 1 | ||
53 | 29 | SLEEP(2) | ||
54 | 30 | 0 | ||
55 | 31 | SLEEP(1) | ||
56 | 32 | 0 | ||
57 | 33 | SLEEP(1000) | ||
58 | 34 | 1 | ||
59 | 35 | SLEEP(2) | ||
60 | 36 | 0 | ||
61 | 37 | SLEEP(1) | ||
62 | 38 | 0 | ||
63 | 39 | SLEEP(1000) | ||
64 | 40 | 1 | ||
65 | 41 | SLEEP(2) | ||
66 | 42 | 0 | ||
67 | 43 | SLEEP(1) | ||
68 | 44 | 0 | ||
69 | 45 | SLEEP(1000) | ||
70 | 46 | 1 | ||
71 | 47 | SLEEP(2) | ||
72 | 48 | 0 | ||
73 | 49 | SLEEP(1) | ||
74 | 50 | 0 | ||
75 | 51 | SLEEP(1000) | ||
76 | 52 | 1 | ||
77 | 53 | SLEEP(2) | ||
78 | 54 | 0 | ||
79 | 55 | SLEEP(1) | ||
80 | 56 | 0 | ||
81 | 57 | SLEEP(1000) | ||
82 | 58 | 1 | ||
83 | 59 | SLEEP(2) | ||
84 | 60 | 0 | ||
85 | 61 | SLEEP(1) | ||
86 | 62 | 0 | ||
87 | 63 | SLEEP(1000) | ||
88 | 64 | 1 | ||
89 | 65 | SLEEP(2) | ||
90 | 66 | 0 | ||
91 | 67 | SLEEP(1) | ||
92 | 68 | 0 | ||
93 | 69 | SLEEP(1000) | ||
94 | 70 | 1 | ||
95 | 71 | SLEEP(2) | ||
96 | 72 | 0 | ||
97 | 73 | SLEEP(1) | ||
98 | 74 | 0 | ||
99 | 75 | SLEEP(1000) | ||
100 | 76 | 1 | ||
101 | 77 | SLEEP(2) | ||
102 | 78 | 0 | ||
103 | 79 | SLEEP(1) | ||
104 | 80 | 0 | ||
105 | 81 | SLEEP(1000) | ||
106 | 82 | 1 | ||
107 | 83 | SLEEP(2) | ||
108 | 84 | 0 | ||
109 | 85 | SLEEP(1) | ||
110 | 86 | 0 | ||
111 | 87 | SLEEP(1000) | ||
112 | 88 | 1 | ||
113 | 89 | SLEEP(2) | ||
114 | 90 | 0 | ||
115 | 91 | SLEEP(1) | ||
116 | 92 | 0 | ||
117 | 93 | SLEEP(1000) | ||
118 | 94 | 1 | ||
119 | 95 | SLEEP(2) | ||
120 | 96 | 0 | ||
121 | 97 | SLEEP(1) | ||
122 | 98 | 0 | ||
123 | 99 | SLEEP(1000) | ||
124 | 100 | 1 | ||
125 | 101 | SLEEP(2) | ||
126 | 102 | 0 | ||
127 | 103 | SLEEP(1) | ||
128 | 104 | 0 | ||
129 | 105 | SLEEP(1000) | ||
130 | 106 | 1 | ||
131 | 107 | SLEEP(2) | ||
132 | 108 | 0 | ||
133 | 109 | SLEEP(1) | ||
134 | 110 | 0 | ||
135 | 111 | SLEEP(1000) | ||
136 | 112 | 1 | ||
137 | 113 | SLEEP(2) | ||
138 | 114 | 0 | ||
139 | 115 | SLEEP(1) | ||
140 | 116 | 0 | ||
141 | 117 | SLEEP(1000) | ||
142 | 118 | 1 | ||
143 | 119 | SLEEP(2) | ||
144 | 120 | 0 | ||
145 | 0 | 121 | ||
146 | === added file 'Percona-Server/mysql-test/suite/sys_vars/r/sql_timeout_basic.result' | |||
147 | --- Percona-Server/mysql-test/suite/sys_vars/r/sql_timeout_basic.result 1970-01-01 00:00:00 +0000 | |||
148 | +++ Percona-Server/mysql-test/suite/sys_vars/r/sql_timeout_basic.result 2013-01-09 13:41:38 +0000 | |||
149 | @@ -0,0 +1,151 @@ | |||
150 | 1 | SET @start_global_value = @@global.sql_timeout; | ||
151 | 2 | SELECT @start_global_value; | ||
152 | 3 | @start_global_value | ||
153 | 4 | 0 | ||
154 | 5 | SET @start_session_value = @@session.sql_timeout; | ||
155 | 6 | SELECT @start_session_value; | ||
156 | 7 | @start_session_value | ||
157 | 8 | 0 | ||
158 | 9 | '#--------------------FN_DYNVARS_083_01-------------------------#' | ||
159 | 10 | SET @@global.sql_timeout = 100; | ||
160 | 11 | SET @@global.sql_timeout = DEFAULT; | ||
161 | 12 | SELECT @@global.sql_timeout; | ||
162 | 13 | @@global.sql_timeout | ||
163 | 14 | 0 | ||
164 | 15 | SET @@session.sql_timeout = 200; | ||
165 | 16 | SET @@session.sql_timeout = DEFAULT; | ||
166 | 17 | SELECT @@session.sql_timeout; | ||
167 | 18 | @@session.sql_timeout | ||
168 | 19 | 0 | ||
169 | 20 | '#--------------------FN_DYNVARS_083_03-------------------------#' | ||
170 | 21 | SET @@global.sql_timeout = 100; | ||
171 | 22 | SELECT @@global.sql_timeout; | ||
172 | 23 | @@global.sql_timeout | ||
173 | 24 | 100 | ||
174 | 25 | SET @@global.sql_timeout = 200; | ||
175 | 26 | SELECT @@global.sql_timeout; | ||
176 | 27 | @@global.sql_timeout | ||
177 | 28 | 200 | ||
178 | 29 | SET @@global.sql_timeout = 65536; | ||
179 | 30 | SELECT @@global.sql_timeout; | ||
180 | 31 | @@global.sql_timeout | ||
181 | 32 | 65536 | ||
182 | 33 | SET @@global.sql_timeout = 4294967295; | ||
183 | 34 | SELECT @@global.sql_timeout; | ||
184 | 35 | @@global.sql_timeout | ||
185 | 36 | 4294967295 | ||
186 | 37 | SET @@global.sql_timeout = 4294967294; | ||
187 | 38 | SELECT @@global.sql_timeout; | ||
188 | 39 | @@global.sql_timeout | ||
189 | 40 | 4294967294 | ||
190 | 41 | '#--------------------FN_DYNVARS_083_04-------------------------#' | ||
191 | 42 | SET @@session.sql_timeout = 100; | ||
192 | 43 | SELECT @@session.sql_timeout; | ||
193 | 44 | @@session.sql_timeout | ||
194 | 45 | 100 | ||
195 | 46 | SET @@session.sql_timeout = 200; | ||
196 | 47 | SELECT @@session.sql_timeout; | ||
197 | 48 | @@session.sql_timeout | ||
198 | 49 | 200 | ||
199 | 50 | SET @@session.sql_timeout = 4294967295; | ||
200 | 51 | SELECT @@session.sql_timeout; | ||
201 | 52 | @@session.sql_timeout | ||
202 | 53 | 4294967295 | ||
203 | 54 | SET @@session.sql_timeout = 4294967294; | ||
204 | 55 | SELECT @@session.sql_timeout; | ||
205 | 56 | @@session.sql_timeout | ||
206 | 57 | 4294967294 | ||
207 | 58 | SET @@session.sql_timeout = 65535; | ||
208 | 59 | SELECT @@session.sql_timeout; | ||
209 | 60 | @@session.sql_timeout | ||
210 | 61 | 65535 | ||
211 | 62 | '#------------------FN_DYNVARS_083_05-----------------------#' | ||
212 | 63 | SET @@global.sql_timeout = 0; | ||
213 | 64 | SELECT @@global.sql_timeout; | ||
214 | 65 | @@global.sql_timeout | ||
215 | 66 | 0 | ||
216 | 67 | SET @@global.sql_timeout = -1024; | ||
217 | 68 | Warnings: | ||
218 | 69 | Warning 1292 Truncated incorrect sql_timeout value: '-1024' | ||
219 | 70 | SELECT @@global.sql_timeout; | ||
220 | 71 | @@global.sql_timeout | ||
221 | 72 | 0 | ||
222 | 73 | SET @@global.sql_timeout = 65530.34; | ||
223 | 74 | ERROR 42000: Incorrect argument type to variable 'sql_timeout' | ||
224 | 75 | SELECT @@global.sql_timeout; | ||
225 | 76 | @@global.sql_timeout | ||
226 | 77 | 0 | ||
227 | 78 | SET @@global.sql_timeout = test; | ||
228 | 79 | ERROR 42000: Incorrect argument type to variable 'sql_timeout' | ||
229 | 80 | SELECT @@global.sql_timeout; | ||
230 | 81 | @@global.sql_timeout | ||
231 | 82 | 0 | ||
232 | 83 | SET @@session.sql_timeout = 0; | ||
233 | 84 | SELECT @@session.sql_timeout; | ||
234 | 85 | @@session.sql_timeout | ||
235 | 86 | 0 | ||
236 | 87 | SET @@session.sql_timeout = -2; | ||
237 | 88 | Warnings: | ||
238 | 89 | Warning 1292 Truncated incorrect sql_timeout value: '-2' | ||
239 | 90 | SELECT @@session.sql_timeout; | ||
240 | 91 | @@session.sql_timeout | ||
241 | 92 | 0 | ||
242 | 93 | SET @@session.sql_timeout = 65530.34; | ||
243 | 94 | ERROR 42000: Incorrect argument type to variable 'sql_timeout' | ||
244 | 95 | SELECT @@session.sql_timeout; | ||
245 | 96 | @@session.sql_timeout | ||
246 | 97 | 0 | ||
247 | 98 | SET @@session.sql_timeout = test; | ||
248 | 99 | ERROR 42000: Incorrect argument type to variable 'sql_timeout' | ||
249 | 100 | SELECT @@session.sql_timeout; | ||
250 | 101 | @@session.sql_timeout | ||
251 | 102 | 0 | ||
252 | 103 | '#------------------FN_DYNVARS_083_06-----------------------#' | ||
253 | 104 | SELECT @@global.sql_timeout = VARIABLE_VALUE | ||
254 | 105 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
255 | 106 | WHERE VARIABLE_NAME='sql_timeout'; | ||
256 | 107 | @@global.sql_timeout = VARIABLE_VALUE | ||
257 | 108 | 1 | ||
258 | 109 | '#------------------FN_DYNVARS_083_07-----------------------#' | ||
259 | 110 | SELECT @@session.sql_timeout = VARIABLE_VALUE | ||
260 | 111 | FROM INFORMATION_SCHEMA.SESSION_VARIABLES | ||
261 | 112 | WHERE VARIABLE_NAME='sql_timeout'; | ||
262 | 113 | @@session.sql_timeout = VARIABLE_VALUE | ||
263 | 114 | 1 | ||
264 | 115 | '#------------------FN_DYNVARS_083_08-----------------------#' | ||
265 | 116 | SET @@global.sql_timeout = FALSE; | ||
266 | 117 | SELECT @@global.sql_timeout; | ||
267 | 118 | @@global.sql_timeout | ||
268 | 119 | 0 | ||
269 | 120 | '#---------------------FN_DYNVARS_083_09----------------------#' | ||
270 | 121 | SET @@global.sql_timeout = 100; | ||
271 | 122 | SELECT @@sql_timeout = @@global.sql_timeout; | ||
272 | 123 | @@sql_timeout = @@global.sql_timeout | ||
273 | 124 | 0 | ||
274 | 125 | '#---------------------FN_DYNVARS_083_10----------------------#' | ||
275 | 126 | SET @@sql_timeout = 1000; | ||
276 | 127 | SELECT @@sql_timeout = @@local.sql_timeout; | ||
277 | 128 | @@sql_timeout = @@local.sql_timeout | ||
278 | 129 | 1 | ||
279 | 130 | SELECT @@local.sql_timeout = @@session.sql_timeout; | ||
280 | 131 | @@local.sql_timeout = @@session.sql_timeout | ||
281 | 132 | 1 | ||
282 | 133 | '#---------------------FN_DYNVARS_083_11----------------------#' | ||
283 | 134 | SET sql_timeout = 100; | ||
284 | 135 | SELECT @@sql_timeout; | ||
285 | 136 | @@sql_timeout | ||
286 | 137 | 100 | ||
287 | 138 | SELECT local.sql_timeout; | ||
288 | 139 | ERROR 42S02: Unknown table 'local' in field list | ||
289 | 140 | SELECT session.sql_timeout; | ||
290 | 141 | ERROR 42S02: Unknown table 'session' in field list | ||
291 | 142 | SELECT sql_timeout = @@session.sql_timeout; | ||
292 | 143 | ERROR 42S22: Unknown column 'sql_timeout' in 'field list' | ||
293 | 144 | SET @@global.sql_timeout = @start_global_value; | ||
294 | 145 | SELECT @@global.sql_timeout; | ||
295 | 146 | @@global.sql_timeout | ||
296 | 147 | 0 | ||
297 | 148 | SET @@session.sql_timeout = @start_session_value; | ||
298 | 149 | SELECT @@session.sql_timeout; | ||
299 | 150 | @@session.sql_timeout | ||
300 | 151 | 0 | ||
301 | 0 | 152 | ||
302 | === added file 'Percona-Server/mysql-test/suite/sys_vars/t/sql_timeout_basic.test' | |||
303 | --- Percona-Server/mysql-test/suite/sys_vars/t/sql_timeout_basic.test 1970-01-01 00:00:00 +0000 | |||
304 | +++ Percona-Server/mysql-test/suite/sys_vars/t/sql_timeout_basic.test 2013-01-09 13:41:38 +0000 | |||
305 | @@ -0,0 +1,194 @@ | |||
306 | 1 | ############mysql-test\suite\sysvars\t\sql_timeout_basic.test################## | ||
307 | 2 | # # | ||
308 | 3 | # Variable Name: sql_timeout # | ||
309 | 4 | # Scope: GLOBAL | SESSION # | ||
310 | 5 | # Access Type: Dynamic # | ||
311 | 6 | # Data Type: numeric # | ||
312 | 7 | # Default Value: 0 # | ||
313 | 8 | # Range: 1-4294967295 # | ||
314 | 9 | # # | ||
315 | 10 | # # | ||
316 | 11 | # Creation Date: 2012-02-08 # | ||
317 | 12 | # Author: Vlad Lesin # | ||
318 | 13 | # # | ||
319 | 14 | # Description: Test Cases of Dynamic System Variable sql_timeout # | ||
320 | 15 | # that checks the behavior of this variable in the following ways# | ||
321 | 16 | # * Default Value # | ||
322 | 17 | # * Valid & Invalid values # | ||
323 | 18 | # * Scope & Access method # | ||
324 | 19 | # * Data Integrity # | ||
325 | 20 | # # | ||
326 | 21 | # Reference: none # | ||
327 | 22 | # https://blueprints.launchpad.net/percona-server/+spec/sql-timeout # | ||
328 | 23 | # # | ||
329 | 24 | # # | ||
330 | 25 | ############################################################################### | ||
331 | 26 | |||
332 | 27 | ############################################################ | ||
333 | 28 | # START OF sql_timeout TESTS # | ||
334 | 29 | ############################################################ | ||
335 | 30 | |||
336 | 31 | |||
337 | 32 | ############################################################# | ||
338 | 33 | # Save initial value # | ||
339 | 34 | ############################################################# | ||
340 | 35 | |||
341 | 36 | SET @start_global_value = @@global.sql_timeout; | ||
342 | 37 | SELECT @start_global_value; | ||
343 | 38 | SET @start_session_value = @@session.sql_timeout; | ||
344 | 39 | SELECT @start_session_value; | ||
345 | 40 | |||
346 | 41 | |||
347 | 42 | --echo '#--------------------FN_DYNVARS_083_01-------------------------#' | ||
348 | 43 | ################################################################# | ||
349 | 44 | # Display the DEFAULT value of sql_timeout # | ||
350 | 45 | ################################################################# | ||
351 | 46 | |||
352 | 47 | SET @@global.sql_timeout = 100; | ||
353 | 48 | SET @@global.sql_timeout = DEFAULT; | ||
354 | 49 | SELECT @@global.sql_timeout; | ||
355 | 50 | |||
356 | 51 | SET @@session.sql_timeout = 200; | ||
357 | 52 | SET @@session.sql_timeout = DEFAULT; | ||
358 | 53 | SELECT @@session.sql_timeout; | ||
359 | 54 | |||
360 | 55 | --echo '#--------------------FN_DYNVARS_083_03-------------------------#' | ||
361 | 56 | ########################################################################### | ||
362 | 57 | # Change the value of sql_timeout to a valid value for GLOBAL Scope # | ||
363 | 58 | ########################################################################### | ||
364 | 59 | |||
365 | 60 | SET @@global.sql_timeout = 100; | ||
366 | 61 | SELECT @@global.sql_timeout; | ||
367 | 62 | SET @@global.sql_timeout = 200; | ||
368 | 63 | SELECT @@global.sql_timeout; | ||
369 | 64 | SET @@global.sql_timeout = 65536; | ||
370 | 65 | SELECT @@global.sql_timeout; | ||
371 | 66 | SET @@global.sql_timeout = 4294967295; | ||
372 | 67 | SELECT @@global.sql_timeout; | ||
373 | 68 | SET @@global.sql_timeout = 4294967294; | ||
374 | 69 | SELECT @@global.sql_timeout; | ||
375 | 70 | |||
376 | 71 | |||
377 | 72 | --echo '#--------------------FN_DYNVARS_083_04-------------------------#' | ||
378 | 73 | ############################################################################ | ||
379 | 74 | # Change the value of sql_timeout to a valid value for SESSION Scope # | ||
380 | 75 | ############################################################################ | ||
381 | 76 | SET @@session.sql_timeout = 100; | ||
382 | 77 | SELECT @@session.sql_timeout; | ||
383 | 78 | SET @@session.sql_timeout = 200; | ||
384 | 79 | SELECT @@session.sql_timeout; | ||
385 | 80 | SET @@session.sql_timeout = 4294967295; | ||
386 | 81 | SELECT @@session.sql_timeout; | ||
387 | 82 | SET @@session.sql_timeout = 4294967294; | ||
388 | 83 | SELECT @@session.sql_timeout; | ||
389 | 84 | SET @@session.sql_timeout = 65535; | ||
390 | 85 | SELECT @@session.sql_timeout; | ||
391 | 86 | |||
392 | 87 | |||
393 | 88 | --echo '#------------------FN_DYNVARS_083_05-----------------------#' | ||
394 | 89 | ############################################################# | ||
395 | 90 | # Change the value of sql_timeout to an invalid value # | ||
396 | 91 | ############################################################# | ||
397 | 92 | |||
398 | 93 | SET @@global.sql_timeout = 0; | ||
399 | 94 | SELECT @@global.sql_timeout; | ||
400 | 95 | SET @@global.sql_timeout = -1024; | ||
401 | 96 | SELECT @@global.sql_timeout; | ||
402 | 97 | --Error ER_WRONG_TYPE_FOR_VAR | ||
403 | 98 | SET @@global.sql_timeout = 65530.34; | ||
404 | 99 | SELECT @@global.sql_timeout; | ||
405 | 100 | --Error ER_WRONG_TYPE_FOR_VAR | ||
406 | 101 | SET @@global.sql_timeout = test; | ||
407 | 102 | SELECT @@global.sql_timeout; | ||
408 | 103 | |||
409 | 104 | SET @@session.sql_timeout = 0; | ||
410 | 105 | SELECT @@session.sql_timeout; | ||
411 | 106 | SET @@session.sql_timeout = -2; | ||
412 | 107 | SELECT @@session.sql_timeout; | ||
413 | 108 | --Error ER_WRONG_TYPE_FOR_VAR | ||
414 | 109 | SET @@session.sql_timeout = 65530.34; | ||
415 | 110 | SELECT @@session.sql_timeout; | ||
416 | 111 | |||
417 | 112 | --Error ER_WRONG_TYPE_FOR_VAR | ||
418 | 113 | SET @@session.sql_timeout = test; | ||
419 | 114 | SELECT @@session.sql_timeout; | ||
420 | 115 | |||
421 | 116 | |||
422 | 117 | --echo '#------------------FN_DYNVARS_083_06-----------------------#' | ||
423 | 118 | #################################################################### | ||
424 | 119 | # Check if the value in GLOBAL Table matches value in variable # | ||
425 | 120 | #################################################################### | ||
426 | 121 | |||
427 | 122 | |||
428 | 123 | SELECT @@global.sql_timeout = VARIABLE_VALUE | ||
429 | 124 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
430 | 125 | WHERE VARIABLE_NAME='sql_timeout'; | ||
431 | 126 | |||
432 | 127 | --echo '#------------------FN_DYNVARS_083_07-----------------------#' | ||
433 | 128 | #################################################################### | ||
434 | 129 | # Check if the value in SESSION Table matches value in variable # | ||
435 | 130 | #################################################################### | ||
436 | 131 | |||
437 | 132 | SELECT @@session.sql_timeout = VARIABLE_VALUE | ||
438 | 133 | FROM INFORMATION_SCHEMA.SESSION_VARIABLES | ||
439 | 134 | WHERE VARIABLE_NAME='sql_timeout'; | ||
440 | 135 | |||
441 | 136 | |||
442 | 137 | --echo '#------------------FN_DYNVARS_083_08-----------------------#' | ||
443 | 138 | #################################################################### | ||
444 | 139 | # Check if FALSE value can be used on variable # | ||
445 | 140 | #################################################################### | ||
446 | 141 | |||
447 | 142 | SET @@global.sql_timeout = FALSE; | ||
448 | 143 | SELECT @@global.sql_timeout; | ||
449 | 144 | |||
450 | 145 | |||
451 | 146 | --echo '#---------------------FN_DYNVARS_083_09----------------------#' | ||
452 | 147 | ############################################################################# | ||
453 | 148 | # Check if accessing variable with and without GLOBAL point # | ||
454 | 149 | # to same variable # | ||
455 | 150 | ############################################################################# | ||
456 | 151 | |||
457 | 152 | SET @@global.sql_timeout = 100; | ||
458 | 153 | SELECT @@sql_timeout = @@global.sql_timeout; | ||
459 | 154 | |||
460 | 155 | |||
461 | 156 | --echo '#---------------------FN_DYNVARS_083_10----------------------#' | ||
462 | 157 | ############################################################################# | ||
463 | 158 | # Check if accessing variable with SESSION,LOCAL and without SCOPE points # | ||
464 | 159 | # to same session variable # | ||
465 | 160 | ############################################################################# | ||
466 | 161 | |||
467 | 162 | SET @@sql_timeout = 1000; | ||
468 | 163 | SELECT @@sql_timeout = @@local.sql_timeout; | ||
469 | 164 | SELECT @@local.sql_timeout = @@session.sql_timeout; | ||
470 | 165 | |||
471 | 166 | |||
472 | 167 | --echo '#---------------------FN_DYNVARS_083_11----------------------#' | ||
473 | 168 | ############################################################################ | ||
474 | 169 | # Check if sql_timeout can be accessed with and without @@ sign # | ||
475 | 170 | ############################################################################ | ||
476 | 171 | |||
477 | 172 | SET sql_timeout = 100; | ||
478 | 173 | SELECT @@sql_timeout; | ||
479 | 174 | --Error ER_UNKNOWN_TABLE | ||
480 | 175 | SELECT local.sql_timeout; | ||
481 | 176 | --Error ER_UNKNOWN_TABLE | ||
482 | 177 | SELECT session.sql_timeout; | ||
483 | 178 | --Error ER_BAD_FIELD_ERROR | ||
484 | 179 | SELECT sql_timeout = @@session.sql_timeout; | ||
485 | 180 | |||
486 | 181 | |||
487 | 182 | #################################### | ||
488 | 183 | # Restore initial value # | ||
489 | 184 | #################################### | ||
490 | 185 | |||
491 | 186 | SET @@global.sql_timeout = @start_global_value; | ||
492 | 187 | SELECT @@global.sql_timeout; | ||
493 | 188 | SET @@session.sql_timeout = @start_session_value; | ||
494 | 189 | SELECT @@session.sql_timeout; | ||
495 | 190 | |||
496 | 191 | |||
497 | 192 | ############################################################# | ||
498 | 193 | # END OF sql_timeout TESTS # | ||
499 | 194 | ############################################################# | ||
500 | 0 | 195 | ||
501 | === added file 'Percona-Server/mysql-test/t/percona_sql_timeout.test' | |||
502 | --- Percona-Server/mysql-test/t/percona_sql_timeout.test 1970-01-01 00:00:00 +0000 | |||
503 | +++ Percona-Server/mysql-test/t/percona_sql_timeout.test 2013-01-09 13:41:38 +0000 | |||
504 | @@ -0,0 +1,82 @@ | |||
505 | 1 | # | ||
506 | 2 | # SQL_TIMEOUT test | ||
507 | 3 | # | ||
508 | 4 | # SQL_TIMEOUT is a session variable or | ||
509 | 5 | # query keyword which sets the time | ||
510 | 6 | # limit for query execution. | ||
511 | 7 | |||
512 | 8 | # Save the initial number of concurrent sessions | ||
513 | 9 | --source include/count_sessions.inc | ||
514 | 10 | |||
515 | 11 | |||
516 | 12 | --disable_query_log | ||
517 | 13 | |||
518 | 14 | --let $sessions_count=10 | ||
519 | 15 | --let $sessions_prepared_count=10 | ||
520 | 16 | |||
521 | 17 | --let $i=$sessions_count | ||
522 | 18 | while ($i) { | ||
523 | 19 | --dec $i | ||
524 | 20 | --let $connection_name=connection_$i | ||
525 | 21 | --connect ($connection_name,localhost,root,,) | ||
526 | 22 | --delimiter +++ | ||
527 | 23 | let $statement= | ||
528 | 24 | SELECT SLEEP(1); | ||
529 | 25 | SET @@SESSION.SQL_TIMEOUT = 1; | ||
530 | 26 | SELECT SLEEP(1000); | ||
531 | 27 | SET @@SESSION.SQL_TIMEOUT = 0; | ||
532 | 28 | SELECT SLEEP(2); | ||
533 | 29 | +++ | ||
534 | 30 | --delimiter ; | ||
535 | 31 | --send_eval $statement | ||
536 | 32 | } | ||
537 | 33 | |||
538 | 34 | --let $i=$sessions_prepared_count | ||
539 | 35 | while ($i) { | ||
540 | 36 | --dec $i | ||
541 | 37 | --let $ti=$sessions_count+$i | ||
542 | 38 | --let $connection_name=connection_$ti | ||
543 | 39 | --connect ($connection_name,localhost,root,,) | ||
544 | 40 | --delimiter +++ | ||
545 | 41 | let $statement= | ||
546 | 42 | PREPARE P_1_$i FROM 'SELECT SLEEP(1)'; | ||
547 | 43 | PREPARE P_2_$i FROM 'SET @@SESSION.SQL_TIMEOUT = 1'; | ||
548 | 44 | PREPARE P_3_$i FROM 'SELECT SLEEP(1000)'; | ||
549 | 45 | PREPARE P_4_$i FROM 'SET @@SESSION.SQL_TIMEOUT = 0'; | ||
550 | 46 | PREPARE P_5_$i FROM 'SELECT SLEEP(2)'; | ||
551 | 47 | EXECUTE P_1_$i; | ||
552 | 48 | EXECUTE P_2_$i; | ||
553 | 49 | EXECUTE P_3_$i; | ||
554 | 50 | EXECUTE P_4_$i; | ||
555 | 51 | EXECUTE P_5_$i; | ||
556 | 52 | +++ | ||
557 | 53 | --delimiter ; | ||
558 | 54 | --send_eval $statement | ||
559 | 55 | } | ||
560 | 56 | |||
561 | 57 | --let $i=$sessions_count | ||
562 | 58 | while ($i) { | ||
563 | 59 | --dec $i | ||
564 | 60 | --let $connection_name=connection_$i | ||
565 | 61 | --connection $connection_name | ||
566 | 62 | --reap | ||
567 | 63 | --disconnect $connection_name | ||
568 | 64 | } | ||
569 | 65 | |||
570 | 66 | --let $i=$sessions_prepared_count | ||
571 | 67 | while ($i) { | ||
572 | 68 | --dec $i | ||
573 | 69 | --let $ti=$sessions_count+$i | ||
574 | 70 | --let $connection_name=connection_$ti | ||
575 | 71 | --connection $connection_name | ||
576 | 72 | --reap | ||
577 | 73 | --eval DROP PREPARE P_1_$i | ||
578 | 74 | --eval DROP PREPARE P_2_$i | ||
579 | 75 | --eval DROP PREPARE P_3_$i | ||
580 | 76 | --eval DROP PREPARE P_4_$i | ||
581 | 77 | --eval DROP PREPARE P_5_$i | ||
582 | 78 | --disconnect $connection_name | ||
583 | 79 | } | ||
584 | 80 | |||
585 | 81 | --connection default | ||
586 | 82 | --source include/wait_until_count_sessions.inc | ||
587 | 0 | 83 | ||
588 | === modified file 'Percona-Server/sql/binlog.cc' | |||
589 | --- Percona-Server/sql/binlog.cc 2012-12-04 08:24:59 +0000 | |||
590 | +++ Percona-Server/sql/binlog.cc 2013-01-09 13:41:38 +0000 | |||
591 | @@ -1573,7 +1573,7 @@ | |||
592 | 1573 | append_identifier(thd, &log_query, thd->lex->ident.str, | 1573 | append_identifier(thd, &log_query, thd->lex->ident.str, |
593 | 1574 | thd->lex->ident.length); | 1574 | thd->lex->ident.length); |
594 | 1575 | 1575 | ||
596 | 1576 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 1576 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
597 | 1577 | Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), | 1577 | Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), |
598 | 1578 | TRUE, FALSE, TRUE, errcode); | 1578 | TRUE, FALSE, TRUE, errcode); |
599 | 1579 | /* | 1579 | /* |
600 | @@ -1615,7 +1615,7 @@ | |||
601 | 1615 | log_query.append(thd->lex->ident.str, thd->lex->ident.length) || | 1615 | log_query.append(thd->lex->ident.str, thd->lex->ident.length) || |
602 | 1616 | log_query.append("`")) | 1616 | log_query.append("`")) |
603 | 1617 | DBUG_RETURN(1); | 1617 | DBUG_RETURN(1); |
605 | 1618 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 1618 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
606 | 1619 | Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), | 1619 | Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), |
607 | 1620 | TRUE, FALSE, TRUE, errcode); | 1620 | TRUE, FALSE, TRUE, errcode); |
608 | 1621 | DBUG_RETURN(mysql_bin_log.write_event(&qinfo)); | 1621 | DBUG_RETURN(mysql_bin_log.write_event(&qinfo)); |
609 | @@ -1930,7 +1930,7 @@ | |||
610 | 1930 | { | 1930 | { |
611 | 1931 | int error; | 1931 | int error; |
612 | 1932 | 1932 | ||
614 | 1933 | if (not_killed || (thd->killed == THD::KILL_BAD_DATA)) | 1933 | if (not_killed || (thd->get_killed() == THD::KILL_BAD_DATA)) |
615 | 1934 | { | 1934 | { |
616 | 1935 | error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; | 1935 | error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; |
617 | 1936 | 1936 | ||
618 | 1937 | 1937 | ||
619 | === modified file 'Percona-Server/sql/debug_sync.cc' | |||
620 | --- Percona-Server/sql/debug_sync.cc 2012-08-22 01:40:20 +0000 | |||
621 | +++ Percona-Server/sql/debug_sync.cc 2013-01-09 13:41:38 +0000 | |||
622 | @@ -224,10 +224,10 @@ | |||
623 | 224 | mysql_mutex_lock(&mutex); | 224 | mysql_mutex_lock(&mutex); |
624 | 225 | thd->enter_cond(&condition_variable, &mutex, new_message); | 225 | thd->enter_cond(&condition_variable, &mutex, new_message); |
625 | 226 | #if defined(ENABLE_DEBUG_SYNC) | 226 | #if defined(ENABLE_DEBUG_SYNC) |
627 | 227 | if (!thd->killed && !end_of_wait_condition) | 227 | if (!thd->get_killed() && !end_of_wait_condition) |
628 | 228 | DEBUG_SYNC(thd, "sync_point_name"); | 228 | DEBUG_SYNC(thd, "sync_point_name"); |
629 | 229 | #endif | 229 | #endif |
631 | 230 | while (!thd->killed && !end_of_wait_condition) | 230 | while (!thd->get_killed() && !end_of_wait_condition) |
632 | 231 | mysql_cond_wait(&condition_variable, &mutex); | 231 | mysql_cond_wait(&condition_variable, &mutex); |
633 | 232 | thd->exit_cond(old_message); | 232 | thd->exit_cond(old_message); |
634 | 233 | 233 | ||
635 | @@ -262,11 +262,11 @@ | |||
636 | 262 | A bit off-topic: At some places, the loop is taken around the whole | 262 | A bit off-topic: At some places, the loop is taken around the whole |
637 | 263 | synchronization pattern: | 263 | synchronization pattern: |
638 | 264 | 264 | ||
640 | 265 | while (!thd->killed && !end_of_wait_condition) | 265 | while (!thd->get_killed() && !end_of_wait_condition) |
641 | 266 | { | 266 | { |
642 | 267 | mysql_mutex_lock(&mutex); | 267 | mysql_mutex_lock(&mutex); |
643 | 268 | thd->enter_cond(&condition_variable, &mutex, new_message); | 268 | thd->enter_cond(&condition_variable, &mutex, new_message); |
645 | 269 | if (!thd->killed [&& !end_of_wait_condition]) | 269 | if (!thd->get_killed() [&& !end_of_wait_condition]) |
646 | 270 | { | 270 | { |
647 | 271 | [DEBUG_SYNC(thd, "sync_point_name");] | 271 | [DEBUG_SYNC(thd, "sync_point_name");] |
648 | 272 | mysql_cond_wait(&condition_variable, &mutex); | 272 | mysql_cond_wait(&condition_variable, &mutex); |
649 | @@ -274,9 +274,9 @@ | |||
650 | 274 | thd->exit_cond(old_message); | 274 | thd->exit_cond(old_message); |
651 | 275 | } | 275 | } |
652 | 276 | 276 | ||
654 | 277 | Note that it is important to repeat the test for thd->killed after | 277 | Note that it is important to repeat the test for thd->get_killed() after |
655 | 278 | enter_cond(). Otherwise the killing thread may kill this thread after | 278 | enter_cond(). Otherwise the killing thread may kill this thread after |
657 | 279 | it tested thd->killed in the loop condition and before it registered | 279 | it tested thd->get_killed() in the loop condition and before it registered |
658 | 280 | the condition variable and mutex in enter_cond(). In this case, the | 280 | the condition variable and mutex in enter_cond(). In this case, the |
659 | 281 | killing thread does not know that this thread is going to wait on a | 281 | killing thread does not know that this thread is going to wait on a |
660 | 282 | condition variable. It would just set THD::killed. But if we would not | 282 | condition variable. It would just set THD::killed. But if we would not |
661 | @@ -1123,13 +1123,13 @@ | |||
662 | 1123 | point decremented it to 0. In this case the following happened: | 1123 | point decremented it to 0. In this case the following happened: |
663 | 1124 | 1124 | ||
664 | 1125 | - an error message was reported with my_error() and | 1125 | - an error message was reported with my_error() and |
666 | 1126 | - the statement was killed with thd->killed= THD::KILL_QUERY. | 1126 | - the statement was killed with thd->get_killed()= THD::KILL_QUERY. |
667 | 1127 | 1127 | ||
668 | 1128 | If a statement reports an error, it must not call send_ok(). | 1128 | If a statement reports an error, it must not call send_ok(). |
669 | 1129 | The calling functions will not call send_ok(), if we return TRUE | 1129 | The calling functions will not call send_ok(), if we return TRUE |
670 | 1130 | from this function. | 1130 | from this function. |
671 | 1131 | 1131 | ||
673 | 1132 | thd->killed is also set if the wait is interrupted from a | 1132 | thd->get_killed() is also set if the wait is interrupted from a |
674 | 1133 | KILL or KILL QUERY statement. In this case, no error is reported | 1133 | KILL or KILL QUERY statement. In this case, no error is reported |
675 | 1134 | and shall not be reported as a result of SET DEBUG_SYNC. | 1134 | and shall not be reported as a result of SET DEBUG_SYNC. |
676 | 1135 | Hence, we check for the first condition above. | 1135 | Hence, we check for the first condition above. |
677 | @@ -1775,7 +1775,7 @@ | |||
678 | 1775 | the required dynamic memory allocated. | 1775 | the required dynamic memory allocated. |
679 | 1776 | */ | 1776 | */ |
680 | 1777 | while (stringcmp(&debug_sync_global.ds_signal, &action->wait_for) && | 1777 | while (stringcmp(&debug_sync_global.ds_signal, &action->wait_for) && |
682 | 1778 | !thd->killed && opt_debug_sync_timeout) | 1778 | !thd->get_killed() && opt_debug_sync_timeout) |
683 | 1779 | { | 1779 | { |
684 | 1780 | error= mysql_cond_timedwait(&debug_sync_global.ds_cond, | 1780 | error= mysql_cond_timedwait(&debug_sync_global.ds_cond, |
685 | 1781 | &debug_sync_global.ds_mutex, | 1781 | &debug_sync_global.ds_mutex, |
686 | @@ -1800,10 +1800,10 @@ | |||
687 | 1800 | error= 0; | 1800 | error= 0; |
688 | 1801 | } | 1801 | } |
689 | 1802 | DBUG_EXECUTE("debug_sync_exec", | 1802 | DBUG_EXECUTE("debug_sync_exec", |
691 | 1803 | if (thd->killed) | 1803 | if (thd->get_killed()) |
692 | 1804 | DBUG_PRINT("debug_sync_exec", | 1804 | DBUG_PRINT("debug_sync_exec", |
693 | 1805 | ("killed %d from '%s' at: '%s'", | 1805 | ("killed %d from '%s' at: '%s'", |
695 | 1806 | thd->killed, sig_wait, dsp_name)); | 1806 | thd->get_killed(), sig_wait, dsp_name)); |
696 | 1807 | else | 1807 | else |
697 | 1808 | DBUG_PRINT("debug_sync_exec", | 1808 | DBUG_PRINT("debug_sync_exec", |
698 | 1809 | ("%s from '%s' at: '%s'", | 1809 | ("%s from '%s' at: '%s'", |
699 | @@ -1842,7 +1842,7 @@ | |||
700 | 1842 | { | 1842 | { |
701 | 1843 | if (!--action->hit_limit) | 1843 | if (!--action->hit_limit) |
702 | 1844 | { | 1844 | { |
704 | 1845 | thd->killed= THD::KILL_QUERY; | 1845 | thd->set_killed(THD::KILL_QUERY); |
705 | 1846 | my_error(ER_DEBUG_SYNC_HIT_LIMIT, MYF(0)); | 1846 | my_error(ER_DEBUG_SYNC_HIT_LIMIT, MYF(0)); |
706 | 1847 | } | 1847 | } |
707 | 1848 | DBUG_PRINT("debug_sync_exec", ("hit_limit: %lu at: '%s'", | 1848 | DBUG_PRINT("debug_sync_exec", ("hit_limit: %lu at: '%s'", |
708 | 1849 | 1849 | ||
709 | === modified file 'Percona-Server/sql/event_queue.cc' | |||
710 | --- Percona-Server/sql/event_queue.cc 2011-09-07 10:08:09 +0000 | |||
711 | +++ Percona-Server/sql/event_queue.cc 2013-01-09 13:41:38 +0000 | |||
712 | @@ -575,9 +575,9 @@ | |||
713 | 575 | Event_queue_element *top= NULL; | 575 | Event_queue_element *top= NULL; |
714 | 576 | 576 | ||
715 | 577 | /* Break loop if thd has been killed */ | 577 | /* Break loop if thd has been killed */ |
717 | 578 | if (thd->killed) | 578 | if (thd->get_killed()) |
718 | 579 | { | 579 | { |
720 | 580 | DBUG_PRINT("info", ("thd->killed=%d", thd->killed)); | 580 | DBUG_PRINT("info", ("thd->get_killed()=%d", thd->get_killed())); |
721 | 581 | goto end; | 581 | goto end; |
722 | 582 | } | 582 | } |
723 | 583 | 583 | ||
724 | @@ -754,7 +754,7 @@ | |||
725 | 754 | 754 | ||
726 | 755 | thd->enter_cond(&COND_queue_state, &LOCK_event_queue, stage, NULL, src_func, src_file, src_line); | 755 | thd->enter_cond(&COND_queue_state, &LOCK_event_queue, stage, NULL, src_func, src_file, src_line); |
727 | 756 | 756 | ||
729 | 757 | if (!thd->killed) | 757 | if (!thd->get_killed()) |
730 | 758 | { | 758 | { |
731 | 759 | if (!abstime) | 759 | if (!abstime) |
732 | 760 | mysql_cond_wait(&COND_queue_state, &LOCK_event_queue); | 760 | mysql_cond_wait(&COND_queue_state, &LOCK_event_queue); |
733 | 761 | 761 | ||
734 | === modified file 'Percona-Server/sql/event_scheduler.cc' | |||
735 | --- Percona-Server/sql/event_scheduler.cc 2012-08-22 01:40:20 +0000 | |||
736 | +++ Percona-Server/sql/event_scheduler.cc 2013-01-09 13:41:38 +0000 | |||
737 | @@ -495,7 +495,7 @@ | |||
738 | 495 | } | 495 | } |
739 | 496 | else | 496 | else |
740 | 497 | { | 497 | { |
742 | 498 | DBUG_ASSERT(thd->killed); | 498 | DBUG_ASSERT(thd->get_killed()); |
743 | 499 | DBUG_PRINT("info", ("job_data is NULL, the thread was killed")); | 499 | DBUG_PRINT("info", ("job_data is NULL, the thread was killed")); |
744 | 500 | } | 500 | } |
745 | 501 | DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str)); | 501 | DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str)); |
746 | 502 | 502 | ||
747 | === modified file 'Percona-Server/sql/filesort.cc' | |||
748 | --- Percona-Server/sql/filesort.cc 2012-12-04 08:24:59 +0000 | |||
749 | +++ Percona-Server/sql/filesort.cc 2013-01-09 13:41:38 +0000 | |||
750 | @@ -684,7 +684,6 @@ | |||
751 | 684 | my_off_t record; | 684 | my_off_t record; |
752 | 685 | TABLE *sort_form; | 685 | TABLE *sort_form; |
753 | 686 | THD *thd= current_thd; | 686 | THD *thd= current_thd; |
754 | 687 | volatile THD::killed_state *killed= &thd->killed; | ||
755 | 688 | handler *file; | 687 | handler *file; |
756 | 689 | MY_BITMAP *save_read_set, *save_write_set; | 688 | MY_BITMAP *save_read_set, *save_write_set; |
757 | 690 | bool skip_record; | 689 | bool skip_record; |
758 | @@ -774,7 +773,7 @@ | |||
759 | 774 | break; | 773 | break; |
760 | 775 | } | 774 | } |
761 | 776 | 775 | ||
763 | 777 | if (*killed) | 776 | if (thd->get_killed()) |
764 | 778 | { | 777 | { |
765 | 779 | DBUG_PRINT("info",("Sort killed by user")); | 778 | DBUG_PRINT("info",("Sort killed by user")); |
766 | 780 | if (!quick_select) | 779 | if (!quick_select) |
767 | @@ -1567,15 +1566,13 @@ | |||
768 | 1567 | QUEUE queue; | 1566 | QUEUE queue; |
769 | 1568 | qsort2_cmp cmp; | 1567 | qsort2_cmp cmp; |
770 | 1569 | void *first_cmp_arg; | 1568 | void *first_cmp_arg; |
773 | 1570 | volatile THD::killed_state *killed= ¤t_thd->killed; | 1569 | THD::killed_state killed= current_thd->get_killed(); |
772 | 1571 | THD::killed_state not_killable; | ||
774 | 1572 | DBUG_ENTER("merge_buffers"); | 1570 | DBUG_ENTER("merge_buffers"); |
775 | 1573 | 1571 | ||
776 | 1574 | current_thd->inc_status_sort_merge_passes(); | 1572 | current_thd->inc_status_sort_merge_passes(); |
777 | 1575 | if (param->not_killable) | 1573 | if (param->not_killable) |
778 | 1576 | { | 1574 | { |
781 | 1577 | killed= ¬_killable; | 1575 | killed= THD::NOT_KILLED; |
780 | 1578 | not_killable= THD::NOT_KILLED; | ||
782 | 1579 | } | 1576 | } |
783 | 1580 | 1577 | ||
784 | 1581 | error=0; | 1578 | error=0; |
785 | @@ -1646,7 +1643,7 @@ | |||
786 | 1646 | 1643 | ||
787 | 1647 | while (queue.elements > 1) | 1644 | while (queue.elements > 1) |
788 | 1648 | { | 1645 | { |
790 | 1649 | if (*killed) | 1646 | if (killed) |
791 | 1650 | { | 1647 | { |
792 | 1651 | error= 1; goto err; /* purecov: inspected */ | 1648 | error= 1; goto err; /* purecov: inspected */ |
793 | 1652 | } | 1649 | } |
794 | 1653 | 1650 | ||
795 | === modified file 'Percona-Server/sql/ha_ndbcluster.cc' | |||
796 | --- Percona-Server/sql/ha_ndbcluster.cc 2012-08-22 01:40:20 +0000 | |||
797 | +++ Percona-Server/sql/ha_ndbcluster.cc 2013-01-09 13:41:38 +0000 | |||
798 | @@ -4971,7 +4971,7 @@ | |||
799 | 4971 | Ndb_tuple_id_range_guard g(m_share); | 4971 | Ndb_tuple_id_range_guard g(m_share); |
800 | 4972 | if (ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1000) == -1) | 4972 | if (ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1000) == -1) |
801 | 4973 | { | 4973 | { |
803 | 4974 | if (--retries && !thd->killed && | 4974 | if (--retries && !thd->get_killed() && |
804 | 4975 | ndb->getNdbError().status == NdbError::TemporaryError) | 4975 | ndb->getNdbError().status == NdbError::TemporaryError) |
805 | 4976 | { | 4976 | { |
806 | 4977 | do_retry_sleep(retry_sleep); | 4977 | do_retry_sleep(retry_sleep); |
807 | @@ -8998,7 +8998,7 @@ | |||
808 | 8998 | Ndb_tuple_id_range_guard g(m_share); | 8998 | Ndb_tuple_id_range_guard g(m_share); |
809 | 8999 | if (ndb->readAutoIncrementValue(ndbtab, g.range, auto_value)) | 8999 | if (ndb->readAutoIncrementValue(ndbtab, g.range, auto_value)) |
810 | 9000 | { | 9000 | { |
812 | 9001 | if (--retries && !thd->killed && | 9001 | if (--retries && !thd->get_killed() && |
813 | 9002 | ndb->getNdbError().status == NdbError::TemporaryError) | 9002 | ndb->getNdbError().status == NdbError::TemporaryError) |
814 | 9003 | { | 9003 | { |
815 | 9004 | do_retry_sleep(retry_sleep); | 9004 | do_retry_sleep(retry_sleep); |
816 | @@ -9628,7 +9628,7 @@ | |||
817 | 9628 | Failed to create an index, | 9628 | Failed to create an index, |
818 | 9629 | drop the table (and all it's indexes) | 9629 | drop the table (and all it's indexes) |
819 | 9630 | */ | 9630 | */ |
821 | 9631 | while (!thd->killed) | 9631 | while (!thd->get_killed()) |
822 | 9632 | { | 9632 | { |
823 | 9633 | if (dict->beginSchemaTrans() == -1) | 9633 | if (dict->beginSchemaTrans() == -1) |
824 | 9634 | goto cleanup_failed; | 9634 | goto cleanup_failed; |
825 | @@ -9637,7 +9637,7 @@ | |||
826 | 9637 | switch (dict->getNdbError().status) | 9637 | switch (dict->getNdbError().status) |
827 | 9638 | { | 9638 | { |
828 | 9639 | case NdbError::TemporaryError: | 9639 | case NdbError::TemporaryError: |
830 | 9640 | if (!thd->killed) | 9640 | if (!thd->get_killed()) |
831 | 9641 | { | 9641 | { |
832 | 9642 | if (dict->endSchemaTrans(NdbDictionary::Dictionary::SchemaTransAbort) | 9642 | if (dict->endSchemaTrans(NdbDictionary::Dictionary::SchemaTransAbort) |
833 | 9643 | == -1) | 9643 | == -1) |
834 | @@ -10238,7 +10238,7 @@ | |||
835 | 10238 | switch (dict->getNdbError().status) | 10238 | switch (dict->getNdbError().status) |
836 | 10239 | { | 10239 | { |
837 | 10240 | case NdbError::TemporaryError: | 10240 | case NdbError::TemporaryError: |
839 | 10241 | if (!thd->killed) | 10241 | if (!thd->get_killed()) |
840 | 10242 | goto retry_temporary_error1; // retry indefinitly | 10242 | goto retry_temporary_error1; // retry indefinitly |
841 | 10243 | break; | 10243 | break; |
842 | 10244 | default: | 10244 | default: |
843 | @@ -10270,7 +10270,7 @@ | |||
844 | 10270 | switch (dict->getNdbError().status) | 10270 | switch (dict->getNdbError().status) |
845 | 10271 | { | 10271 | { |
846 | 10272 | case NdbError::TemporaryError: | 10272 | case NdbError::TemporaryError: |
848 | 10273 | if (!thd->killed) | 10273 | if (!thd->get_killed()) |
849 | 10274 | goto retry_temporary_error2; // retry indefinitly | 10274 | goto retry_temporary_error2; // retry indefinitly |
850 | 10275 | break; | 10275 | break; |
851 | 10276 | default: | 10276 | default: |
852 | @@ -10426,7 +10426,7 @@ | |||
853 | 10426 | Uint32(m_autoincrement_prefetch), | 10426 | Uint32(m_autoincrement_prefetch), |
854 | 10427 | increment, offset)) | 10427 | increment, offset)) |
855 | 10428 | { | 10428 | { |
857 | 10429 | if (--retries && !thd->killed && | 10429 | if (--retries && !thd->get_killed() && |
858 | 10430 | ndb->getNdbError().status == NdbError::TemporaryError) | 10430 | ndb->getNdbError().status == NdbError::TemporaryError) |
859 | 10431 | { | 10431 | { |
860 | 10432 | do_retry_sleep(retry_sleep); | 10432 | do_retry_sleep(retry_sleep); |
861 | @@ -10734,7 +10734,7 @@ | |||
862 | 10734 | } | 10734 | } |
863 | 10735 | while((result= th.next()) == 1) | 10735 | while((result= th.next()) == 1) |
864 | 10736 | { | 10736 | { |
866 | 10737 | if (thd->killed) | 10737 | if (thd->get_killed()) |
867 | 10738 | DBUG_RETURN(-1); | 10738 | DBUG_RETURN(-1); |
868 | 10739 | my_sleep(1000*delay); | 10739 | my_sleep(1000*delay); |
869 | 10740 | } | 10740 | } |
870 | @@ -10746,7 +10746,7 @@ | |||
871 | 10746 | }; | 10746 | }; |
872 | 10747 | for (i= 0; i < MAX_KEY; i++) | 10747 | for (i= 0; i < MAX_KEY; i++) |
873 | 10748 | { | 10748 | { |
875 | 10749 | if (thd->killed) | 10749 | if (thd->get_killed()) |
876 | 10750 | DBUG_RETURN(-1); | 10750 | DBUG_RETURN(-1); |
877 | 10751 | if (m_index[i].status == ACTIVE) | 10751 | if (m_index[i].status == ACTIVE) |
878 | 10752 | { | 10752 | { |
879 | @@ -10765,7 +10765,7 @@ | |||
880 | 10765 | } | 10765 | } |
881 | 10766 | while((result= ih.next()) == 1) | 10766 | while((result= ih.next()) == 1) |
882 | 10767 | { | 10767 | { |
884 | 10768 | if (thd->killed) | 10768 | if (thd->get_killed()) |
885 | 10769 | DBUG_RETURN(-1); | 10769 | DBUG_RETURN(-1); |
886 | 10770 | my_sleep(1000*delay); | 10770 | my_sleep(1000*delay); |
887 | 10771 | } | 10771 | } |
888 | @@ -10787,7 +10787,7 @@ | |||
889 | 10787 | } | 10787 | } |
890 | 10788 | while((result= ih.next()) == 1) | 10788 | while((result= ih.next()) == 1) |
891 | 10789 | { | 10789 | { |
893 | 10790 | if (thd->killed) | 10790 | if (thd->get_killed()) |
894 | 10791 | DBUG_RETURN(-1); | 10791 | DBUG_RETURN(-1); |
895 | 10792 | my_sleep(1000*delay); | 10792 | my_sleep(1000*delay); |
896 | 10793 | } | 10793 | } |
897 | @@ -13451,7 +13451,7 @@ | |||
898 | 13451 | pTrans= NULL; | 13451 | pTrans= NULL; |
899 | 13452 | } | 13452 | } |
900 | 13453 | if (error.status == NdbError::TemporaryError && | 13453 | if (error.status == NdbError::TemporaryError && |
902 | 13454 | retries-- && !thd->killed) | 13454 | retries-- && !thd->get_killed()) |
903 | 13455 | { | 13455 | { |
904 | 13456 | do_retry_sleep(retry_sleep); | 13456 | do_retry_sleep(retry_sleep); |
905 | 13457 | continue; | 13457 | continue; |
906 | 13458 | 13458 | ||
907 | === modified file 'Percona-Server/sql/ha_ndbcluster_binlog.cc' | |||
908 | --- Percona-Server/sql/ha_ndbcluster_binlog.cc 2012-12-04 08:24:59 +0000 | |||
909 | +++ Percona-Server/sql/ha_ndbcluster_binlog.cc 2013-01-09 13:41:38 +0000 | |||
910 | @@ -485,7 +485,7 @@ | |||
911 | 485 | thd->proc_info= "Waiting for ndbcluster binlog update to " | 485 | thd->proc_info= "Waiting for ndbcluster binlog update to " |
912 | 486 | "reach current position"; | 486 | "reach current position"; |
913 | 487 | pthread_mutex_lock(&injector_mutex); | 487 | pthread_mutex_lock(&injector_mutex); |
915 | 488 | while (!(thd && thd->killed) && count && ndb_binlog_running && | 488 | while (!(thd && thd->get_killed()) && count && ndb_binlog_running && |
916 | 489 | (ndb_latest_handled_binlog_epoch == 0 || | 489 | (ndb_latest_handled_binlog_epoch == 0 || |
917 | 490 | ndb_latest_handled_binlog_epoch < wait_epoch)) | 490 | ndb_latest_handled_binlog_epoch < wait_epoch)) |
918 | 491 | { | 491 | { |
919 | @@ -1291,7 +1291,7 @@ | |||
920 | 1291 | ndb->closeTransaction(trans); | 1291 | ndb->closeTransaction(trans); |
921 | 1292 | trans= NULL; | 1292 | trans= NULL; |
922 | 1293 | } | 1293 | } |
924 | 1294 | if (ndb_error.status == NdbError::TemporaryError && !thd->killed) | 1294 | if (ndb_error.status == NdbError::TemporaryError && !thd->get_killed()) |
925 | 1295 | { | 1295 | { |
926 | 1296 | if (retries--) | 1296 | if (retries--) |
927 | 1297 | { | 1297 | { |
928 | @@ -1302,7 +1302,7 @@ | |||
929 | 1302 | continue; // retry | 1302 | continue; // retry |
930 | 1303 | } | 1303 | } |
931 | 1304 | } | 1304 | } |
933 | 1305 | if (!thd->killed) | 1305 | if (!thd->get_killed()) |
934 | 1306 | { | 1306 | { |
935 | 1307 | sql_print_error("NDB: ndbcluster_find_all_databases fail: %u - %s", | 1307 | sql_print_error("NDB: ndbcluster_find_all_databases fail: %u - %s", |
936 | 1308 | ndb_error.code, | 1308 | ndb_error.code, |
937 | @@ -1663,7 +1663,7 @@ | |||
938 | 1663 | err: | 1663 | err: |
939 | 1664 | const NdbError *this_error= trans ? | 1664 | const NdbError *this_error= trans ? |
940 | 1665 | &trans->getNdbError() : &ndb->getNdbError(); | 1665 | &trans->getNdbError() : &ndb->getNdbError(); |
942 | 1666 | if (this_error->status == NdbError::TemporaryError && !thd->killed) | 1666 | if (this_error->status == NdbError::TemporaryError && !thd->get_killed()) |
943 | 1667 | { | 1667 | { |
944 | 1668 | if (retries--) | 1668 | if (retries--) |
945 | 1669 | { | 1669 | { |
946 | @@ -2128,7 +2128,7 @@ | |||
947 | 2128 | err: | 2128 | err: |
948 | 2129 | const NdbError *this_error= trans ? | 2129 | const NdbError *this_error= trans ? |
949 | 2130 | &trans->getNdbError() : &ndb->getNdbError(); | 2130 | &trans->getNdbError() : &ndb->getNdbError(); |
951 | 2131 | if (this_error->status == NdbError::TemporaryError && !thd->killed) | 2131 | if (this_error->status == NdbError::TemporaryError && !thd->get_killed()) |
952 | 2132 | { | 2132 | { |
953 | 2133 | if (retries--) | 2133 | if (retries--) |
954 | 2134 | { | 2134 | { |
955 | @@ -2183,7 +2183,7 @@ | |||
956 | 2183 | int ret= pthread_cond_timedwait(&injector_cond, | 2183 | int ret= pthread_cond_timedwait(&injector_cond, |
957 | 2184 | &ndb_schema_object->mutex, | 2184 | &ndb_schema_object->mutex, |
958 | 2185 | &abstime); | 2185 | &abstime); |
960 | 2186 | if (thd->killed) | 2186 | if (thd->get_killed()) |
961 | 2187 | break; | 2187 | break; |
962 | 2188 | 2188 | ||
963 | 2189 | /* begin protect ndb_schema_share */ | 2189 | /* begin protect ndb_schema_share */ |
964 | @@ -2424,7 +2424,7 @@ | |||
965 | 2424 | char *thd_db_save= thd->db; | 2424 | char *thd_db_save= thd->db; |
966 | 2425 | thd->server_id = loggedServerId; | 2425 | thd->server_id = loggedServerId; |
967 | 2426 | thd->db= schema->db; | 2426 | thd->db= schema->db; |
969 | 2427 | int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED); | 2427 | int errcode = query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
970 | 2428 | thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query, | 2428 | thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query, |
971 | 2429 | schema->query_length, FALSE, | 2429 | schema->query_length, FALSE, |
972 | 2430 | #ifdef NDB_THD_BINLOG_QUERY_HAS_DIRECT | 2430 | #ifdef NDB_THD_BINLOG_QUERY_HAS_DIRECT |
973 | @@ -3253,7 +3253,7 @@ | |||
974 | 3253 | MYSQL_LOCK_IGNORE_TIMEOUT; /* Wait for lock "infinitely" */ | 3253 | MYSQL_LOCK_IGNORE_TIMEOUT; /* Wait for lock "infinitely" */ |
975 | 3254 | if (open_and_lock_tables(thd, &tables, derived, flags)) | 3254 | if (open_and_lock_tables(thd, &tables, derived, flags)) |
976 | 3255 | { | 3255 | { |
978 | 3256 | if (thd->killed) | 3256 | if (thd->get_killed()) |
979 | 3257 | sql_print_error("NDB Binlog: Opening ndb_binlog_index: killed"); | 3257 | sql_print_error("NDB Binlog: Opening ndb_binlog_index: killed"); |
980 | 3258 | else | 3258 | else |
981 | 3259 | sql_print_error("NDB Binlog: Opening ndb_binlog_index: %d, '%s'", | 3259 | sql_print_error("NDB Binlog: Opening ndb_binlog_index: %d, '%s'", |
982 | @@ -5392,7 +5392,7 @@ | |||
983 | 5392 | share->event_data= event_data; | 5392 | share->event_data= event_data; |
984 | 5393 | op->setCustomData(NULL); | 5393 | op->setCustomData(NULL); |
985 | 5394 | ndb->dropEventOperation(op); | 5394 | ndb->dropEventOperation(op); |
987 | 5395 | if (retries && !thd->killed) | 5395 | if (retries && !thd->get_killed()) |
988 | 5396 | { | 5396 | { |
989 | 5397 | do_retry_sleep(retry_sleep); | 5397 | do_retry_sleep(retry_sleep); |
990 | 5398 | continue; | 5398 | continue; |
991 | @@ -5530,7 +5530,7 @@ | |||
992 | 5530 | int ret= pthread_cond_timedwait(&injector_cond, | 5530 | int ret= pthread_cond_timedwait(&injector_cond, |
993 | 5531 | &share->mutex, | 5531 | &share->mutex, |
994 | 5532 | &abstime); | 5532 | &abstime); |
996 | 5533 | if (thd->killed || | 5533 | if (thd->get_killed() || |
997 | 5534 | share->op == 0) | 5534 | share->op == 0) |
998 | 5535 | break; | 5535 | break; |
999 | 5536 | if (ret) | 5536 | if (ret) |
1000 | @@ -7206,15 +7206,15 @@ | |||
1001 | 7206 | Writing to ndb_binlog_index failed, check if we are | 7206 | Writing to ndb_binlog_index failed, check if we are |
1002 | 7207 | being killed and retry | 7207 | being killed and retry |
1003 | 7208 | */ | 7208 | */ |
1005 | 7209 | if (thd->killed) | 7209 | if (thd->get_killed()) |
1006 | 7210 | { | 7210 | { |
1007 | 7211 | (void) mysql_mutex_lock(&LOCK_thread_count); | 7211 | (void) mysql_mutex_lock(&LOCK_thread_count); |
1009 | 7212 | volatile THD::killed_state killed= thd->killed; | 7212 | volatile THD::killed_state killed= thd->get_killed(); |
1010 | 7213 | /* We are cleaning up, allow for flushing last epoch */ | 7213 | /* We are cleaning up, allow for flushing last epoch */ |
1012 | 7214 | thd->killed= THD::NOT_KILLED; | 7214 | thd->set_killed(THD::NOT_KILLED); |
1013 | 7215 | ndb_binlog_index_table__write_rows(thd, rows); | 7215 | ndb_binlog_index_table__write_rows(thd, rows); |
1014 | 7216 | /* Restore kill flag */ | 7216 | /* Restore kill flag */ |
1016 | 7217 | thd->killed= killed; | 7217 | thd->set_killed(killed); |
1017 | 7218 | (void) mysql_mutex_unlock(&LOCK_thread_count); | 7218 | (void) mysql_mutex_unlock(&LOCK_thread_count); |
1018 | 7219 | } | 7219 | } |
1019 | 7220 | } | 7220 | } |
1020 | 7221 | 7221 | ||
1021 | === modified file 'Percona-Server/sql/handler.cc' | |||
1022 | --- Percona-Server/sql/handler.cc 2012-12-04 08:24:59 +0000 | |||
1023 | +++ Percona-Server/sql/handler.cc 2013-01-09 13:41:38 +0000 | |||
1024 | @@ -1603,7 +1603,7 @@ | |||
1025 | 1603 | #endif | 1603 | #endif |
1026 | 1604 | if ((all || thd->transaction.stmt.ha_list == 0) && | 1604 | if ((all || thd->transaction.stmt.ha_list == 0) && |
1027 | 1605 | thd->transaction.all.cannot_safely_rollback() && | 1605 | thd->transaction.all.cannot_safely_rollback() && |
1029 | 1606 | !thd->slave_thread && thd->killed != THD::KILL_CONNECTION) | 1606 | !thd->slave_thread && thd->get_killed() != THD::KILL_CONNECTION) |
1030 | 1607 | thd->transaction.push_unsafe_rollback_warnings(thd); | 1607 | thd->transaction.push_unsafe_rollback_warnings(thd); |
1031 | 1608 | DBUG_RETURN(error); | 1608 | DBUG_RETURN(error); |
1032 | 1609 | } | 1609 | } |
1033 | @@ -3210,7 +3210,7 @@ | |||
1034 | 3210 | /* | 3210 | /* |
1035 | 3211 | first test if the query was aborted due to strict mode constraints | 3211 | first test if the query was aborted due to strict mode constraints |
1036 | 3212 | */ | 3212 | */ |
1038 | 3213 | if (thd->killed == THD::KILL_BAD_DATA) | 3213 | if (thd->get_killed() == THD::KILL_BAD_DATA) |
1039 | 3214 | DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); | 3214 | DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); |
1040 | 3215 | 3215 | ||
1041 | 3216 | /* | 3216 | /* |
1042 | @@ -5452,7 +5452,7 @@ | |||
1043 | 5452 | 5452 | ||
1044 | 5453 | @note | 5453 | @note |
1045 | 5454 | This method (or an overriding one in a derived class) must check for | 5454 | This method (or an overriding one in a derived class) must check for |
1047 | 5455 | thd->killed and return HA_POS_ERROR if it is not zero. This is required | 5455 | thd->get_killed() and return HA_POS_ERROR if it is not zero. This is required |
1048 | 5456 | for a user to be able to interrupt the calculation by killing the | 5456 | for a user to be able to interrupt the calculation by killing the |
1049 | 5457 | connection/query. | 5457 | connection/query. |
1050 | 5458 | 5458 | ||
1051 | @@ -5479,12 +5479,12 @@ | |||
1052 | 5479 | /* Default MRR implementation doesn't need buffer */ | 5479 | /* Default MRR implementation doesn't need buffer */ |
1053 | 5480 | *bufsz= 0; | 5480 | *bufsz= 0; |
1054 | 5481 | 5481 | ||
1056 | 5482 | DBUG_EXECUTE_IF("bug13822652_2", thd->killed= THD::KILL_QUERY;); | 5482 | DBUG_EXECUTE_IF("bug13822652_2", thd->set_killed(THD::KILL_QUERY);); |
1057 | 5483 | 5483 | ||
1058 | 5484 | seq_it= seq->init(seq_init_param, n_ranges, *flags); | 5484 | seq_it= seq->init(seq_init_param, n_ranges, *flags); |
1059 | 5485 | while (!seq->next(seq_it, &range)) | 5485 | while (!seq->next(seq_it, &range)) |
1060 | 5486 | { | 5486 | { |
1062 | 5487 | if (unlikely(thd->killed != 0)) | 5487 | if (unlikely(thd->get_killed() != 0)) |
1063 | 5488 | return HA_POS_ERROR; | 5488 | return HA_POS_ERROR; |
1064 | 5489 | 5489 | ||
1065 | 5490 | n_ranges++; | 5490 | n_ranges++; |
1066 | 5491 | 5491 | ||
1067 | === modified file 'Percona-Server/sql/item_func.cc' | |||
1068 | --- Percona-Server/sql/item_func.cc 2012-12-04 08:24:59 +0000 | |||
1069 | +++ Percona-Server/sql/item_func.cc 2013-01-09 13:41:38 +0000 | |||
1070 | @@ -4215,6 +4215,11 @@ | |||
1071 | 4215 | error= mysql_cond_timedwait(cond, mutex, &timeout); | 4215 | error= mysql_cond_timedwait(cond, mutex, &timeout); |
1072 | 4216 | if (error == ETIMEDOUT || error == ETIME) | 4216 | if (error == ETIMEDOUT || error == ETIME) |
1073 | 4217 | { | 4217 | { |
1074 | 4218 | if (m_thd->get_killed()) | ||
1075 | 4219 | { | ||
1076 | 4220 | error= 0; | ||
1077 | 4221 | break; | ||
1078 | 4222 | } | ||
1079 | 4218 | /* Return error if timed out or connection is broken. */ | 4223 | /* Return error if timed out or connection is broken. */ |
1080 | 4219 | if (!cmp_timespec(timeout, m_abs_timeout) || !m_thd->is_connected()) | 4224 | if (!cmp_timespec(timeout, m_abs_timeout) || !m_thd->is_connected()) |
1081 | 4220 | break; | 4225 | break; |
1082 | @@ -4312,7 +4317,7 @@ | |||
1083 | 4312 | 4317 | ||
1084 | 4313 | error= 0; | 4318 | error= 0; |
1085 | 4314 | thd_wait_begin(thd, THD_WAIT_USER_LOCK); | 4319 | thd_wait_begin(thd, THD_WAIT_USER_LOCK); |
1087 | 4315 | while (ull->locked && !thd->killed) | 4320 | while (ull->locked && !thd->get_killed()) |
1088 | 4316 | { | 4321 | { |
1089 | 4317 | DBUG_PRINT("info", ("waiting on lock")); | 4322 | DBUG_PRINT("info", ("waiting on lock")); |
1090 | 4318 | error= timed_cond.wait(&ull->cond, &LOCK_user_locks); | 4323 | error= timed_cond.wait(&ull->cond, &LOCK_user_locks); |
1091 | @@ -4332,7 +4337,7 @@ | |||
1092 | 4332 | DBUG_ASSERT(0); | 4337 | DBUG_ASSERT(0); |
1093 | 4333 | delete ull; // Should never happen | 4338 | delete ull; // Should never happen |
1094 | 4334 | } | 4339 | } |
1096 | 4335 | if (!error) // Killed (thd->killed != 0) | 4340 | if (!error) // Killed (thd->get_killed() != 0) |
1097 | 4336 | { | 4341 | { |
1098 | 4337 | error=1; | 4342 | error=1; |
1099 | 4338 | null_value=1; // Return NULL | 4343 | null_value=1; // Return NULL |
1100 | @@ -4469,7 +4474,7 @@ | |||
1101 | 4469 | } | 4474 | } |
1102 | 4470 | 4475 | ||
1103 | 4471 | null_value=0; | 4476 | null_value=0; |
1105 | 4472 | for (ulonglong loop=0 ; loop < loop_count && !thd->killed; loop++) | 4477 | for (ulonglong loop=0 ; loop < loop_count && !thd->get_killed(); loop++) |
1106 | 4473 | { | 4478 | { |
1107 | 4474 | switch (args[1]->result_type()) { | 4479 | switch (args[1]->result_type()) { |
1108 | 4475 | case REAL_RESULT: | 4480 | case REAL_RESULT: |
1109 | @@ -4541,7 +4546,7 @@ | |||
1110 | 4541 | 4546 | ||
1111 | 4542 | error= 0; | 4547 | error= 0; |
1112 | 4543 | thd_wait_begin(thd, THD_WAIT_SLEEP); | 4548 | thd_wait_begin(thd, THD_WAIT_SLEEP); |
1114 | 4544 | while (!thd->killed) | 4549 | while (!thd->get_killed()) |
1115 | 4545 | { | 4550 | { |
1116 | 4546 | error= timed_cond.wait(&cond, &LOCK_user_locks); | 4551 | error= timed_cond.wait(&cond, &LOCK_user_locks); |
1117 | 4547 | if (error == ETIMEDOUT || error == ETIME) | 4552 | if (error == ETIMEDOUT || error == ETIME) |
1118 | @@ -6742,7 +6747,7 @@ | |||
1119 | 6742 | { | 6747 | { |
1120 | 6743 | null_value= 1; | 6748 | null_value= 1; |
1121 | 6744 | context->process_error(thd); | 6749 | context->process_error(thd); |
1123 | 6745 | if (thd->killed) | 6750 | if (thd->get_killed()) |
1124 | 6746 | thd->send_kill_message(); | 6751 | thd->send_kill_message(); |
1125 | 6747 | return TRUE; | 6752 | return TRUE; |
1126 | 6748 | } | 6753 | } |
1127 | 6749 | 6754 | ||
1128 | === modified file 'Percona-Server/sql/item_subselect.cc' | |||
1129 | --- Percona-Server/sql/item_subselect.cc 2012-12-04 08:24:59 +0000 | |||
1130 | +++ Percona-Server/sql/item_subselect.cc 2013-01-09 13:41:38 +0000 | |||
1131 | @@ -572,7 +572,7 @@ | |||
1132 | 572 | or if the query has been killed. | 572 | or if the query has been killed. |
1133 | 573 | */ | 573 | */ |
1134 | 574 | THD * const thd= unit->thd; | 574 | THD * const thd= unit->thd; |
1136 | 575 | if (thd->is_error() || thd->killed) | 575 | if (thd->is_error() || thd->get_killed()) |
1137 | 576 | DBUG_RETURN(true); | 576 | DBUG_RETURN(true); |
1138 | 577 | 577 | ||
1139 | 578 | DBUG_ASSERT(!thd->lex->context_analysis_only); | 578 | DBUG_ASSERT(!thd->lex->context_analysis_only); |
1140 | 579 | 579 | ||
1141 | === modified file 'Percona-Server/sql/lock.cc' | |||
1142 | --- Percona-Server/sql/lock.cc 2012-03-06 14:29:42 +0000 | |||
1143 | +++ Percona-Server/sql/lock.cc 2013-01-09 13:41:38 +0000 | |||
1144 | @@ -324,11 +324,11 @@ | |||
1145 | 324 | if (sql_lock->table_count) | 324 | if (sql_lock->table_count) |
1146 | 325 | (void) unlock_external(thd, sql_lock->table, sql_lock->table_count); | 325 | (void) unlock_external(thd, sql_lock->table, sql_lock->table_count); |
1147 | 326 | reset_lock_data_and_free(&sql_lock); | 326 | reset_lock_data_and_free(&sql_lock); |
1149 | 327 | if (! thd->killed) | 327 | if (! thd->get_killed()) |
1150 | 328 | my_error(rc, MYF(0)); | 328 | my_error(rc, MYF(0)); |
1151 | 329 | } | 329 | } |
1152 | 330 | end: | 330 | end: |
1154 | 331 | if (thd->killed) | 331 | if (thd->get_killed()) |
1155 | 332 | { | 332 | { |
1156 | 333 | thd->send_kill_message(); | 333 | thd->send_kill_message(); |
1157 | 334 | if (sql_lock) | 334 | if (sql_lock) |
1158 | 335 | 335 | ||
1159 | === modified file 'Percona-Server/sql/log.cc' | |||
1160 | --- Percona-Server/sql/log.cc 2012-12-04 08:24:59 +0000 | |||
1161 | +++ Percona-Server/sql/log.cc 2013-01-09 13:41:38 +0000 | |||
1162 | @@ -501,7 +501,7 @@ | |||
1163 | 501 | result= FALSE; | 501 | result= FALSE; |
1164 | 502 | 502 | ||
1165 | 503 | err: | 503 | err: |
1167 | 504 | if (result && !thd->killed) | 504 | if (result && !thd->get_killed()) |
1168 | 505 | sql_print_error("Failed to write to mysql.general_log: %s", | 505 | sql_print_error("Failed to write to mysql.general_log: %s", |
1169 | 506 | error_handler.message()); | 506 | error_handler.message()); |
1170 | 507 | 507 | ||
1171 | @@ -699,7 +699,7 @@ | |||
1172 | 699 | err: | 699 | err: |
1173 | 700 | thd->pop_internal_handler(); | 700 | thd->pop_internal_handler(); |
1174 | 701 | 701 | ||
1176 | 702 | if (result && !thd->killed) | 702 | if (result && !thd->get_killed()) |
1177 | 703 | sql_print_error("Failed to write to mysql.slow_log: %s", | 703 | sql_print_error("Failed to write to mysql.slow_log: %s", |
1178 | 704 | error_handler.message()); | 704 | error_handler.message()); |
1179 | 705 | 705 | ||
1180 | 706 | 706 | ||
1181 | === modified file 'Percona-Server/sql/log_event.cc' | |||
1182 | --- Percona-Server/sql/log_event.cc 2012-12-04 08:24:59 +0000 | |||
1183 | +++ Percona-Server/sql/log_event.cc 2013-01-09 13:41:38 +0000 | |||
1184 | @@ -4799,7 +4799,7 @@ | |||
1185 | 4799 | get_type_str(), thd->get_stmt_da()->message()); | 4799 | get_type_str(), thd->get_stmt_da()->message()); |
1186 | 4800 | } | 4800 | } |
1187 | 4801 | clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); | 4801 | clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); |
1189 | 4802 | thd->killed= THD::NOT_KILLED; | 4802 | thd->set_killed(THD::NOT_KILLED); |
1190 | 4803 | } | 4803 | } |
1191 | 4804 | /* | 4804 | /* |
1192 | 4805 | Other cases: mostly we expected no error and get one. | 4805 | Other cases: mostly we expected no error and get one. |
1193 | 4806 | 4806 | ||
1194 | === modified file 'Percona-Server/sql/mysqld.cc' | |||
1195 | --- Percona-Server/sql/mysqld.cc 2012-12-04 08:24:59 +0000 | |||
1196 | +++ Percona-Server/sql/mysqld.cc 2013-01-09 13:41:38 +0000 | |||
1197 | @@ -1376,7 +1376,7 @@ | |||
1198 | 1376 | if (tmp->slave_thread) | 1376 | if (tmp->slave_thread) |
1199 | 1377 | continue; | 1377 | continue; |
1200 | 1378 | 1378 | ||
1202 | 1379 | tmp->killed= THD::KILL_CONNECTION; | 1379 | tmp->set_killed(THD::KILL_CONNECTION); |
1203 | 1380 | MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp)); | 1380 | MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp)); |
1204 | 1381 | mysql_mutex_lock(&tmp->LOCK_thd_data); | 1381 | mysql_mutex_lock(&tmp->LOCK_thd_data); |
1205 | 1382 | if (tmp->mysys_var) | 1382 | if (tmp->mysys_var) |
1206 | @@ -5933,7 +5933,7 @@ | |||
1207 | 5933 | DBUG_PRINT("error", | 5933 | DBUG_PRINT("error", |
1208 | 5934 | ("Can't create thread to handle request (error %d)", | 5934 | ("Can't create thread to handle request (error %d)", |
1209 | 5935 | error)); | 5935 | error)); |
1211 | 5936 | thd->killed= THD::KILL_CONNECTION; // Safety | 5936 | thd->set_killed(THD::KILL_CONNECTION); // Safety |
1212 | 5937 | mysql_mutex_unlock(&LOCK_thread_count); | 5937 | mysql_mutex_unlock(&LOCK_thread_count); |
1213 | 5938 | 5938 | ||
1214 | 5939 | mysql_mutex_lock(&LOCK_connection_count); | 5939 | mysql_mutex_lock(&LOCK_connection_count); |
1215 | 5940 | 5940 | ||
1216 | === modified file 'Percona-Server/sql/opt_range.cc' | |||
1217 | --- Percona-Server/sql/opt_range.cc 2012-12-04 08:24:59 +0000 | |||
1218 | +++ Percona-Server/sql/opt_range.cc 2013-01-09 13:41:38 +0000 | |||
1219 | @@ -9866,7 +9866,7 @@ | |||
1220 | 9866 | break; | 9866 | break; |
1221 | 9867 | } | 9867 | } |
1222 | 9868 | 9868 | ||
1224 | 9869 | if (thd->killed) | 9869 | if (thd->get_killed()) |
1225 | 9870 | DBUG_RETURN(1); | 9870 | DBUG_RETURN(1); |
1226 | 9871 | 9871 | ||
1227 | 9872 | /* skip row if it will be retrieved by clustered PK scan */ | 9872 | /* skip row if it will be retrieved by clustered PK scan */ |
1228 | 9873 | 9873 | ||
1229 | === modified file 'Percona-Server/sql/records.cc' | |||
1230 | --- Percona-Server/sql/records.cc 2012-12-04 08:24:59 +0000 | |||
1231 | +++ Percona-Server/sql/records.cc 2013-01-09 13:41:38 +0000 | |||
1232 | @@ -340,7 +340,7 @@ | |||
1233 | 340 | 340 | ||
1234 | 341 | static int rr_handle_error(READ_RECORD *info, int error) | 341 | static int rr_handle_error(READ_RECORD *info, int error) |
1235 | 342 | { | 342 | { |
1237 | 343 | if (info->thd->killed) | 343 | if (info->thd->get_killed()) |
1238 | 344 | { | 344 | { |
1239 | 345 | info->thd->send_kill_message(); | 345 | info->thd->send_kill_message(); |
1240 | 346 | return 1; | 346 | return 1; |
1241 | @@ -366,7 +366,7 @@ | |||
1242 | 366 | int tmp; | 366 | int tmp; |
1243 | 367 | while ((tmp= info->select->quick->get_next())) | 367 | while ((tmp= info->select->quick->get_next())) |
1244 | 368 | { | 368 | { |
1246 | 369 | if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED)) | 369 | if (info->thd->get_killed() || (tmp != HA_ERR_RECORD_DELETED)) |
1247 | 370 | { | 370 | { |
1248 | 371 | tmp= rr_handle_error(info, tmp); | 371 | tmp= rr_handle_error(info, tmp); |
1249 | 372 | break; | 372 | break; |
1250 | @@ -481,7 +481,7 @@ | |||
1251 | 481 | ha_rnd_next can return RECORD_DELETED for MyISAM when one thread is | 481 | ha_rnd_next can return RECORD_DELETED for MyISAM when one thread is |
1252 | 482 | reading and another deleting without locks. | 482 | reading and another deleting without locks. |
1253 | 483 | */ | 483 | */ |
1255 | 484 | if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED)) | 484 | if (info->thd->get_killed() || (tmp != HA_ERR_RECORD_DELETED)) |
1256 | 485 | { | 485 | { |
1257 | 486 | tmp= rr_handle_error(info, tmp); | 486 | tmp= rr_handle_error(info, tmp); |
1258 | 487 | break; | 487 | break; |
1259 | 488 | 488 | ||
1260 | === modified file 'Percona-Server/sql/rpl_gtid_execution.cc' | |||
1261 | --- Percona-Server/sql/rpl_gtid_execution.cc 2012-09-17 18:49:38 +0000 | |||
1262 | +++ Percona-Server/sql/rpl_gtid_execution.cc 2013-01-09 13:41:38 +0000 | |||
1263 | @@ -78,7 +78,7 @@ | |||
1264 | 78 | // global_sid_lock and mutex are now released | 78 | // global_sid_lock and mutex are now released |
1265 | 79 | 79 | ||
1266 | 80 | // Check if thread was killed. | 80 | // Check if thread was killed. |
1268 | 81 | if (thd->killed || abort_loop) | 81 | if (thd->get_killed() || abort_loop) |
1269 | 82 | DBUG_RETURN(1); | 82 | DBUG_RETURN(1); |
1270 | 83 | #ifdef HAVE_REPLICATION | 83 | #ifdef HAVE_REPLICATION |
1271 | 84 | // If this thread is a slave SQL thread or slave SQL worker | 84 | // If this thread is a slave SQL thread or slave SQL worker |
1272 | @@ -159,7 +159,7 @@ | |||
1273 | 159 | 159 | ||
1274 | 160 | // at this point, we don't hold any locks. re-acquire the global | 160 | // at this point, we don't hold any locks. re-acquire the global |
1275 | 161 | // read lock that was held when this function was invoked | 161 | // read lock that was held when this function was invoked |
1277 | 162 | if (thd->killed || abort_loop) | 162 | if (thd->get_killed() || abort_loop) |
1278 | 163 | DBUG_RETURN(1); | 163 | DBUG_RETURN(1); |
1279 | 164 | #ifdef HAVE_REPLICATION | 164 | #ifdef HAVE_REPLICATION |
1280 | 165 | // If this thread is a slave SQL thread or slave SQL worker | 165 | // If this thread is a slave SQL thread or slave SQL worker |
1281 | 166 | 166 | ||
1282 | === modified file 'Percona-Server/sql/rpl_gtid_state.cc' | |||
1283 | --- Percona-Server/sql/rpl_gtid_state.cc 2012-09-17 18:49:38 +0000 | |||
1284 | +++ Percona-Server/sql/rpl_gtid_state.cc 2013-01-09 13:41:38 +0000 | |||
1285 | @@ -262,7 +262,7 @@ | |||
1286 | 262 | sid_locks.enter_cond(thd, gtid.sidno, | 262 | sid_locks.enter_cond(thd, gtid.sidno, |
1287 | 263 | &stage_waiting_for_gtid_to_be_written_to_binary_log, | 263 | &stage_waiting_for_gtid_to_be_written_to_binary_log, |
1288 | 264 | &old_stage); | 264 | &old_stage); |
1290 | 265 | //while (get_owner(g.sidno, g.gno) != 0 && !thd->killed && !abort_loop) | 265 | //while (get_owner(g.sidno, g.gno) != 0 && !thd->get_killed() && !abort_loop) |
1291 | 266 | sid_locks.wait(gtid.sidno); | 266 | sid_locks.wait(gtid.sidno); |
1292 | 267 | thd->EXIT_COND(&old_stage); | 267 | thd->EXIT_COND(&old_stage); |
1293 | 268 | 268 | ||
1294 | 269 | 269 | ||
1295 | === modified file 'Percona-Server/sql/rpl_master.cc' | |||
1296 | --- Percona-Server/sql/rpl_master.cc 2012-10-16 06:21:51 +0000 | |||
1297 | +++ Percona-Server/sql/rpl_master.cc 2013-01-09 13:41:38 +0000 | |||
1298 | @@ -1090,7 +1090,7 @@ | |||
1299 | 1090 | /* seek to the requested position, to start the requested dump */ | 1090 | /* seek to the requested position, to start the requested dump */ |
1300 | 1091 | my_b_seek(&log, pos); // Seek will done on next read | 1091 | my_b_seek(&log, pos); // Seek will done on next read |
1301 | 1092 | 1092 | ||
1303 | 1093 | while (!net->error && net->vio != 0 && !thd->killed) | 1093 | while (!net->error && net->vio != 0 && !thd->get_killed()) |
1304 | 1094 | { | 1094 | { |
1305 | 1095 | Log_event_type event_type= UNKNOWN_EVENT; | 1095 | Log_event_type event_type= UNKNOWN_EVENT; |
1306 | 1096 | 1096 | ||
1307 | @@ -1430,7 +1430,7 @@ | |||
1308 | 1430 | { | 1430 | { |
1309 | 1431 | DBUG_PRINT("wait",("binary log received update or a broadcast signal caught")); | 1431 | DBUG_PRINT("wait",("binary log received update or a broadcast signal caught")); |
1310 | 1432 | } | 1432 | } |
1312 | 1433 | } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed); | 1433 | } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->get_killed()); |
1313 | 1434 | thd->EXIT_COND(&old_stage); | 1434 | thd->EXIT_COND(&old_stage); |
1314 | 1435 | } | 1435 | } |
1315 | 1436 | break; | 1436 | break; |
1316 | 1437 | 1437 | ||
1317 | === modified file 'Percona-Server/sql/rpl_rli.cc' | |||
1318 | --- Percona-Server/sql/rpl_rli.cc 2012-12-04 08:24:59 +0000 | |||
1319 | +++ Percona-Server/sql/rpl_rli.cc 2013-01-09 13:41:38 +0000 | |||
1320 | @@ -675,7 +675,7 @@ | |||
1321 | 675 | } | 675 | } |
1322 | 676 | 676 | ||
1323 | 677 | /* The "compare and wait" main loop */ | 677 | /* The "compare and wait" main loop */ |
1325 | 678 | while (!thd->killed && | 678 | while (!thd->get_killed() && |
1326 | 679 | init_abort_pos_wait == abort_pos_wait && | 679 | init_abort_pos_wait == abort_pos_wait && |
1327 | 680 | slave_running) | 680 | slave_running) |
1328 | 681 | { | 681 | { |
1329 | @@ -727,7 +727,7 @@ | |||
1330 | 727 | 727 | ||
1331 | 728 | pos_reached= ((!cmp_result && group_master_log_pos >= (ulonglong)log_pos) || | 728 | pos_reached= ((!cmp_result && group_master_log_pos >= (ulonglong)log_pos) || |
1332 | 729 | cmp_result > 0); | 729 | cmp_result > 0); |
1334 | 730 | if (pos_reached || thd->killed) | 730 | if (pos_reached || thd->get_killed()) |
1335 | 731 | break; | 731 | break; |
1336 | 732 | } | 732 | } |
1337 | 733 | 733 | ||
1338 | @@ -785,7 +785,7 @@ | |||
1339 | 785 | (int) slave_running, | 785 | (int) slave_running, |
1340 | 786 | (int) (error == -2), | 786 | (int) (error == -2), |
1341 | 787 | (int) (error == -1))); | 787 | (int) (error == -1))); |
1343 | 788 | if (thd->killed || init_abort_pos_wait != abort_pos_wait || | 788 | if (thd->get_killed() || init_abort_pos_wait != abort_pos_wait || |
1344 | 789 | !slave_running) | 789 | !slave_running) |
1345 | 790 | { | 790 | { |
1346 | 791 | error= -2; | 791 | error= -2; |
1347 | @@ -845,7 +845,7 @@ | |||
1348 | 845 | global_sid_lock->unlock(); | 845 | global_sid_lock->unlock(); |
1349 | 846 | 846 | ||
1350 | 847 | /* The "compare and wait" main loop */ | 847 | /* The "compare and wait" main loop */ |
1352 | 848 | while (!thd->killed && | 848 | while (!thd->get_killed() && |
1353 | 849 | init_abort_pos_wait == abort_pos_wait && | 849 | init_abort_pos_wait == abort_pos_wait && |
1354 | 850 | slave_running) | 850 | slave_running) |
1355 | 851 | { | 851 | { |
1356 | @@ -931,7 +931,7 @@ | |||
1357 | 931 | (int) slave_running, | 931 | (int) slave_running, |
1358 | 932 | (int) (error == -2), | 932 | (int) (error == -2), |
1359 | 933 | (int) (error == -1))); | 933 | (int) (error == -1))); |
1361 | 934 | if (thd->killed || init_abort_pos_wait != abort_pos_wait || | 934 | if (thd->get_killed() || init_abort_pos_wait != abort_pos_wait || |
1362 | 935 | !slave_running) | 935 | !slave_running) |
1363 | 936 | { | 936 | { |
1364 | 937 | error= -2; | 937 | error= -2; |
1365 | 938 | 938 | ||
1366 | === modified file 'Percona-Server/sql/rpl_rli_pdb.cc' | |||
1367 | --- Percona-Server/sql/rpl_rli_pdb.cc 2012-12-04 08:24:59 +0000 | |||
1368 | +++ Percona-Server/sql/rpl_rli_pdb.cc 2013-01-09 13:41:38 +0000 | |||
1369 | @@ -887,10 +887,10 @@ | |||
1370 | 887 | &stage_slave_waiting_worker_to_release_partition, | 887 | &stage_slave_waiting_worker_to_release_partition, |
1371 | 888 | &old_stage); | 888 | &old_stage); |
1372 | 889 | mysql_cond_wait(&slave_worker_hash_cond, &slave_worker_hash_lock); | 889 | mysql_cond_wait(&slave_worker_hash_cond, &slave_worker_hash_lock); |
1374 | 890 | } while (entry->usage != 0 && !thd->killed); | 890 | } while (entry->usage != 0 && !thd->get_killed()); |
1375 | 891 | 891 | ||
1376 | 892 | thd->EXIT_COND(&old_stage); | 892 | thd->EXIT_COND(&old_stage); |
1378 | 893 | if (thd->killed) | 893 | if (thd->get_killed()) |
1379 | 894 | { | 894 | { |
1380 | 895 | entry= NULL; | 895 | entry= NULL; |
1381 | 896 | goto err; | 896 | goto err; |
1382 | @@ -1500,7 +1500,7 @@ | |||
1383 | 1500 | continue; | 1500 | continue; |
1384 | 1501 | } | 1501 | } |
1385 | 1502 | 1502 | ||
1387 | 1503 | if (entry->usage > 0 && !thd->killed) | 1503 | if (entry->usage > 0 && !thd->get_killed()) |
1388 | 1504 | { | 1504 | { |
1389 | 1505 | PSI_stage_info old_stage; | 1505 | PSI_stage_info old_stage; |
1390 | 1506 | Slave_worker *w_entry= entry->worker; | 1506 | Slave_worker *w_entry= entry->worker; |
1391 | @@ -1517,7 +1517,7 @@ | |||
1392 | 1517 | ("Either got awakened of notified: " | 1517 | ("Either got awakened of notified: " |
1393 | 1518 | "entry %p, usage %lu, worker %lu", | 1518 | "entry %p, usage %lu, worker %lu", |
1394 | 1519 | entry, entry->usage, w_entry->id)); | 1519 | entry, entry->usage, w_entry->id)); |
1396 | 1520 | } while (entry->usage != 0 && !thd->killed); | 1520 | } while (entry->usage != 0 && !thd->get_killed()); |
1397 | 1521 | entry->worker= w_entry; // restoring last association, needed only for assert | 1521 | entry->worker= w_entry; // restoring last association, needed only for assert |
1398 | 1522 | thd->EXIT_COND(&old_stage); | 1522 | thd->EXIT_COND(&old_stage); |
1399 | 1523 | ret++; | 1523 | ret++; |
1400 | @@ -1659,7 +1659,7 @@ | |||
1401 | 1659 | &stage_slave_waiting_worker_to_free_events, &old_stage); | 1659 | &stage_slave_waiting_worker_to_free_events, &old_stage); |
1402 | 1660 | mysql_cond_wait(&rli->pending_jobs_cond, &rli->pending_jobs_lock); | 1660 | mysql_cond_wait(&rli->pending_jobs_cond, &rli->pending_jobs_lock); |
1403 | 1661 | thd->EXIT_COND(&old_stage); | 1661 | thd->EXIT_COND(&old_stage); |
1405 | 1662 | if (thd->killed) | 1662 | if (thd->get_killed()) |
1406 | 1663 | return true; | 1663 | return true; |
1407 | 1664 | if (log_warnings > 1 && (rli->wq_size_waits_cnt % 10 == 1)) | 1664 | if (log_warnings > 1 && (rli->wq_size_waits_cnt % 10 == 1)) |
1408 | 1665 | sql_print_information("Multi-threaded slave: Coordinator has waited " | 1665 | sql_print_information("Multi-threaded slave: Coordinator has waited " |
1409 | @@ -1701,7 +1701,7 @@ | |||
1410 | 1701 | mysql_mutex_lock(&worker->jobs_lock); | 1701 | mysql_mutex_lock(&worker->jobs_lock); |
1411 | 1702 | 1702 | ||
1412 | 1703 | // possible WQ overfill | 1703 | // possible WQ overfill |
1414 | 1704 | while (worker->running_status == Slave_worker::RUNNING && !thd->killed && | 1704 | while (worker->running_status == Slave_worker::RUNNING && !thd->get_killed() && |
1415 | 1705 | (ret= en_queue(&worker->jobs, job_item)) == -1) | 1705 | (ret= en_queue(&worker->jobs, job_item)) == -1) |
1416 | 1706 | { | 1706 | { |
1417 | 1707 | thd->ENTER_COND(&worker->jobs_cond, &worker->jobs_lock, | 1707 | thd->ENTER_COND(&worker->jobs_cond, &worker->jobs_lock, |
1418 | @@ -1752,7 +1752,7 @@ | |||
1419 | 1752 | 1752 | ||
1420 | 1753 | mysql_mutex_lock(&worker->jobs_lock); | 1753 | mysql_mutex_lock(&worker->jobs_lock); |
1421 | 1754 | 1754 | ||
1423 | 1755 | while (!job_item->data && !thd->killed && | 1755 | while (!job_item->data && !thd->get_killed() && |
1424 | 1756 | worker->running_status == Slave_worker::RUNNING) | 1756 | worker->running_status == Slave_worker::RUNNING) |
1425 | 1757 | { | 1757 | { |
1426 | 1758 | PSI_stage_info old_stage; | 1758 | PSI_stage_info old_stage; |
1427 | @@ -1805,7 +1805,7 @@ | |||
1428 | 1805 | DBUG_ENTER("slave_worker_exec_job"); | 1805 | DBUG_ENTER("slave_worker_exec_job"); |
1429 | 1806 | 1806 | ||
1430 | 1807 | job_item= pop_jobs_item(worker, job_item); | 1807 | job_item= pop_jobs_item(worker, job_item); |
1432 | 1808 | if (thd->killed || worker->running_status != Slave_worker::RUNNING) | 1808 | if (thd->get_killed() || worker->running_status != Slave_worker::RUNNING) |
1433 | 1809 | { | 1809 | { |
1434 | 1810 | // de-queueing and decrement counters is in the caller's exit branch | 1810 | // de-queueing and decrement counters is in the caller's exit branch |
1435 | 1811 | error= -1; | 1811 | error= -1; |
1436 | @@ -1978,7 +1978,7 @@ | |||
1437 | 1978 | if (log_warnings > 1) | 1978 | if (log_warnings > 1) |
1438 | 1979 | sql_print_information("Worker %lu is exiting: killed %i, error %i, " | 1979 | sql_print_information("Worker %lu is exiting: killed %i, error %i, " |
1439 | 1980 | "running_status %d", | 1980 | "running_status %d", |
1441 | 1981 | worker->id, thd->killed, thd->is_error(), | 1981 | worker->id, thd->get_killed(), thd->is_error(), |
1442 | 1982 | worker->running_status); | 1982 | worker->running_status); |
1443 | 1983 | worker->slave_worker_ends_group(ev, error); | 1983 | worker->slave_worker_ends_group(ev, error); |
1444 | 1984 | } | 1984 | } |
1445 | 1985 | 1985 | ||
1446 | === modified file 'Percona-Server/sql/rpl_slave.cc' | |||
1447 | --- Percona-Server/sql/rpl_slave.cc 2012-12-04 08:24:59 +0000 | |||
1448 | +++ Percona-Server/sql/rpl_slave.cc 2013-01-09 13:41:38 +0000 | |||
1449 | @@ -1034,15 +1034,15 @@ | |||
1450 | 1034 | /* | 1034 | /* |
1451 | 1035 | It is not sufficient to test this at loop bottom. We must test | 1035 | It is not sufficient to test this at loop bottom. We must test |
1452 | 1036 | it after registering the mutex in enter_cond(). If the kill | 1036 | it after registering the mutex in enter_cond(). If the kill |
1455 | 1037 | happens after testing of thd->killed and before the mutex is | 1037 | happens after testing of thd->get_killed() and before the mutex is |
1456 | 1038 | registered, we could otherwise go waiting though thd->killed is | 1038 | registered, we could otherwise go waiting though thd->get_killed() is |
1457 | 1039 | set. | 1039 | set. |
1458 | 1040 | */ | 1040 | */ |
1460 | 1041 | if (!thd->killed) | 1041 | if (!thd->get_killed()) |
1461 | 1042 | mysql_cond_wait(start_cond, cond_lock); | 1042 | mysql_cond_wait(start_cond, cond_lock); |
1462 | 1043 | thd->EXIT_COND(& saved_stage); | 1043 | thd->EXIT_COND(& saved_stage); |
1463 | 1044 | mysql_mutex_lock(cond_lock); // re-acquire it as exit_cond() released | 1044 | mysql_mutex_lock(cond_lock); // re-acquire it as exit_cond() released |
1465 | 1045 | if (thd->killed) | 1045 | if (thd->get_killed()) |
1466 | 1046 | { | 1046 | { |
1467 | 1047 | if (start_lock) | 1047 | if (start_lock) |
1468 | 1048 | mysql_mutex_unlock(start_lock); | 1048 | mysql_mutex_unlock(start_lock); |
1469 | @@ -1192,7 +1192,7 @@ | |||
1470 | 1192 | 1192 | ||
1471 | 1193 | DBUG_ASSERT(mi->info_thd == thd); | 1193 | DBUG_ASSERT(mi->info_thd == thd); |
1472 | 1194 | DBUG_ASSERT(mi->slave_running); // tracking buffer overrun | 1194 | DBUG_ASSERT(mi->slave_running); // tracking buffer overrun |
1474 | 1195 | DBUG_RETURN(mi->abort_slave || abort_loop || thd->killed); | 1195 | DBUG_RETURN(mi->abort_slave || abort_loop || thd->get_killed()); |
1475 | 1196 | } | 1196 | } |
1476 | 1197 | 1197 | ||
1477 | 1198 | /** | 1198 | /** |
1478 | @@ -1223,10 +1223,10 @@ | |||
1479 | 1223 | 1223 | ||
1480 | 1224 | DBUG_ASSERT(rli->info_thd == thd); | 1224 | DBUG_ASSERT(rli->info_thd == thd); |
1481 | 1225 | DBUG_ASSERT(rli->slave_running == 1); | 1225 | DBUG_ASSERT(rli->slave_running == 1); |
1483 | 1226 | if (abort_loop || thd->killed || rli->abort_slave) | 1226 | if (abort_loop || thd->get_killed() || rli->abort_slave) |
1484 | 1227 | { | 1227 | { |
1485 | 1228 | is_parallel_warn= (rli->is_parallel_exec() && | 1228 | is_parallel_warn= (rli->is_parallel_exec() && |
1487 | 1229 | (rli->is_mts_in_group() || thd->killed)); | 1229 | (rli->is_mts_in_group() || thd->get_killed())); |
1488 | 1230 | /* | 1230 | /* |
1489 | 1231 | Slave can execute stop being in one of two MTS or Single-Threaded mode. | 1231 | Slave can execute stop being in one of two MTS or Single-Threaded mode. |
1490 | 1232 | The modes define different criteria to accept the stop. | 1232 | The modes define different criteria to accept the stop. |
1491 | @@ -5153,7 +5153,7 @@ | |||
1492 | 5153 | commit-events of last assigned groups. | 5153 | commit-events of last assigned groups. |
1493 | 5154 | */ | 5154 | */ |
1494 | 5155 | if (rli->mts_group_status != Relay_log_info::MTS_KILLED_GROUP && | 5155 | if (rli->mts_group_status != Relay_log_info::MTS_KILLED_GROUP && |
1496 | 5156 | thd->killed == THD::NOT_KILLED) | 5156 | thd->get_killed() == THD::NOT_KILLED) |
1497 | 5157 | { | 5157 | { |
1498 | 5158 | DBUG_ASSERT(rli->mts_group_status != Relay_log_info::MTS_IN_GROUP || | 5158 | DBUG_ASSERT(rli->mts_group_status != Relay_log_info::MTS_IN_GROUP || |
1499 | 5159 | thd->is_error()); | 5159 | thd->is_error()); |
1500 | @@ -7166,7 +7166,7 @@ | |||
1501 | 7166 | set_timespec_nsec(waittime, period); | 7166 | set_timespec_nsec(waittime, period); |
1502 | 7167 | ret= rli->relay_log.wait_for_update_relay_log(thd, &waittime); | 7167 | ret= rli->relay_log.wait_for_update_relay_log(thd, &waittime); |
1503 | 7168 | } while ((ret == ETIMEDOUT || ret == ETIME) /* todo:remove */ && | 7168 | } while ((ret == ETIMEDOUT || ret == ETIME) /* todo:remove */ && |
1505 | 7169 | signal_cnt == rli->relay_log.signal_cnt && !thd->killed); | 7169 | signal_cnt == rli->relay_log.signal_cnt && !thd->get_killed()); |
1506 | 7170 | } | 7170 | } |
1507 | 7171 | else | 7171 | else |
1508 | 7172 | { | 7172 | { |
1509 | 7173 | 7173 | ||
1510 | === modified file 'Percona-Server/sql/signal_handler.cc' | |||
1511 | --- Percona-Server/sql/signal_handler.cc 2012-08-22 01:40:20 +0000 | |||
1512 | +++ Percona-Server/sql/signal_handler.cc 2013-01-09 13:41:38 +0000 | |||
1513 | @@ -165,7 +165,7 @@ | |||
1514 | 165 | if (thd) | 165 | if (thd) |
1515 | 166 | { | 166 | { |
1516 | 167 | const char *kreason= "UNKNOWN"; | 167 | const char *kreason= "UNKNOWN"; |
1518 | 168 | switch (thd->killed) { | 168 | switch (thd->get_killed()) { |
1519 | 169 | case THD::NOT_KILLED: | 169 | case THD::NOT_KILLED: |
1520 | 170 | kreason= "NOT_KILLED"; | 170 | kreason= "NOT_KILLED"; |
1521 | 171 | break; | 171 | break; |
1522 | 172 | 172 | ||
1523 | === modified file 'Percona-Server/sql/sp.cc' | |||
1524 | --- Percona-Server/sql/sp.cc 2012-12-04 08:24:59 +0000 | |||
1525 | +++ Percona-Server/sql/sp.cc 2013-01-09 13:41:38 +0000 | |||
1526 | @@ -1484,7 +1484,7 @@ | |||
1527 | 1484 | or is outdated. We therefore only abort mysql_rm_db() if we | 1484 | or is outdated. We therefore only abort mysql_rm_db() if we |
1528 | 1485 | have errors not handled by the error handler. | 1485 | have errors not handled by the error handler. |
1529 | 1486 | */ | 1486 | */ |
1531 | 1487 | DBUG_RETURN(thd->is_error() || thd->killed); | 1487 | DBUG_RETURN(thd->is_error() || thd->get_killed()); |
1532 | 1488 | } | 1488 | } |
1533 | 1489 | 1489 | ||
1534 | 1490 | table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info); | 1490 | table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info); |
1535 | @@ -2077,7 +2077,7 @@ | |||
1536 | 2077 | break; | 2077 | break; |
1537 | 2078 | default: | 2078 | default: |
1538 | 2079 | /* Query might have been killed, don't set error. */ | 2079 | /* Query might have been killed, don't set error. */ |
1540 | 2080 | if (thd->killed) | 2080 | if (thd->get_killed()) |
1541 | 2081 | break; | 2081 | break; |
1542 | 2082 | /* | 2082 | /* |
1543 | 2083 | Any error when loading an existing routine is either some problem | 2083 | Any error when loading an existing routine is either some problem |
1544 | 2084 | 2084 | ||
1545 | === modified file 'Percona-Server/sql/sp_head.cc' | |||
1546 | --- Percona-Server/sql/sp_head.cc 2012-10-16 06:21:51 +0000 | |||
1547 | +++ Percona-Server/sql/sp_head.cc 2013-01-09 13:41:38 +0000 | |||
1548 | @@ -675,7 +675,7 @@ | |||
1549 | 675 | /* Reset sp_rcontext::end_partial_result_set flag. */ | 675 | /* Reset sp_rcontext::end_partial_result_set flag. */ |
1550 | 676 | thd->sp_runtime_ctx->end_partial_result_set= FALSE; | 676 | thd->sp_runtime_ctx->end_partial_result_set= FALSE; |
1551 | 677 | 677 | ||
1553 | 678 | } while (!err_status && !thd->killed && !thd->is_fatal_error); | 678 | } while (!err_status && !thd->get_killed() && !thd->is_fatal_error); |
1554 | 679 | 679 | ||
1555 | 680 | #if defined(ENABLED_PROFILING) | 680 | #if defined(ENABLED_PROFILING) |
1556 | 681 | thd->profiling.finish_current_query(); | 681 | thd->profiling.finish_current_query(); |
1557 | @@ -751,16 +751,16 @@ | |||
1558 | 751 | 751 | ||
1559 | 752 | done: | 752 | done: |
1560 | 753 | DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d", | 753 | DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d", |
1562 | 754 | err_status, thd->killed, thd->is_slave_error, | 754 | err_status, thd->get_killed(), thd->is_slave_error, |
1563 | 755 | thd->is_error())); | 755 | thd->is_error())); |
1564 | 756 | 756 | ||
1566 | 757 | if (thd->killed) | 757 | if (thd->get_killed()) |
1567 | 758 | err_status= TRUE; | 758 | err_status= TRUE; |
1568 | 759 | /* | 759 | /* |
1569 | 760 | If the DB has changed, the pointer has changed too, but the | 760 | If the DB has changed, the pointer has changed too, but the |
1570 | 761 | original thd->db will then have been freed | 761 | original thd->db will then have been freed |
1571 | 762 | */ | 762 | */ |
1573 | 763 | if (cur_db_changed && thd->killed != THD::KILL_CONNECTION) | 763 | if (cur_db_changed && thd->get_killed() != THD::KILL_CONNECTION) |
1574 | 764 | { | 764 | { |
1575 | 765 | /* | 765 | /* |
1576 | 766 | Force switching back to the saved current database, because it may be | 766 | Force switching back to the saved current database, because it may be |
1577 | @@ -901,7 +901,7 @@ | |||
1578 | 901 | free_root(&call_mem_root, MYF(0)); | 901 | free_root(&call_mem_root, MYF(0)); |
1579 | 902 | thd->sp_runtime_ctx= parent_sp_runtime_ctx; | 902 | thd->sp_runtime_ctx= parent_sp_runtime_ctx; |
1580 | 903 | 903 | ||
1582 | 904 | if (thd->killed) | 904 | if (thd->get_killed()) |
1583 | 905 | thd->send_kill_message(); | 905 | thd->send_kill_message(); |
1584 | 906 | 906 | ||
1585 | 907 | DBUG_RETURN(err_status); | 907 | DBUG_RETURN(err_status); |
1586 | @@ -1096,7 +1096,7 @@ | |||
1587 | 1096 | thd->variables.option_bits= binlog_save_options; | 1096 | thd->variables.option_bits= binlog_save_options; |
1588 | 1097 | if (thd->binlog_evt_union.unioned_events) | 1097 | if (thd->binlog_evt_union.unioned_events) |
1589 | 1098 | { | 1098 | { |
1591 | 1099 | int errcode = query_error_code(thd, thd->killed == THD::NOT_KILLED); | 1099 | int errcode = query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
1592 | 1100 | Query_log_event qinfo(thd, binlog_buf.ptr(), binlog_buf.length(), | 1100 | Query_log_event qinfo(thd, binlog_buf.ptr(), binlog_buf.length(), |
1593 | 1101 | thd->binlog_evt_union.unioned_events_trans, FALSE, FALSE, errcode); | 1101 | thd->binlog_evt_union.unioned_events_trans, FALSE, FALSE, errcode); |
1594 | 1102 | if (mysql_bin_log.write_event(&qinfo) && | 1102 | if (mysql_bin_log.write_event(&qinfo) && |
1595 | 1103 | 1103 | ||
1596 | === modified file 'Percona-Server/sql/sp_instr.cc' | |||
1597 | --- Percona-Server/sql/sp_instr.cc 2012-07-16 15:43:41 +0000 | |||
1598 | +++ Percona-Server/sql/sp_instr.cc 2013-01-09 13:41:38 +0000 | |||
1599 | @@ -630,7 +630,7 @@ | |||
1600 | 630 | */ | 630 | */ |
1601 | 631 | if (stmt_reprepare_observer && | 631 | if (stmt_reprepare_observer && |
1602 | 632 | !thd->is_fatal_error && | 632 | !thd->is_fatal_error && |
1604 | 633 | !thd->killed && | 633 | !thd->get_killed() && |
1605 | 634 | thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE && | 634 | thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE && |
1606 | 635 | reprepare_attempt++ < 3) | 635 | reprepare_attempt++ < 3) |
1607 | 636 | { | 636 | { |
1608 | 637 | 637 | ||
1609 | === modified file 'Percona-Server/sql/sp_rcontext.cc' | |||
1610 | --- Percona-Server/sql/sp_rcontext.cc 2012-12-04 08:24:59 +0000 | |||
1611 | +++ Percona-Server/sql/sp_rcontext.cc 2013-01-09 13:41:38 +0000 | |||
1612 | @@ -353,7 +353,7 @@ | |||
1613 | 353 | 353 | ||
1614 | 354 | /* Reset error state. */ | 354 | /* Reset error state. */ |
1615 | 355 | thd->clear_error(); | 355 | thd->clear_error(); |
1617 | 356 | thd->killed= THD::NOT_KILLED; // Some errors set thd->killed | 356 | thd->set_killed(THD::NOT_KILLED); // Some errors set thd->get_killed() |
1618 | 357 | // (e.g. "bad data"). | 357 | // (e.g. "bad data"). |
1619 | 358 | 358 | ||
1620 | 359 | /* Add a frame to handler-call-stack. */ | 359 | /* Add a frame to handler-call-stack. */ |
1621 | 360 | 360 | ||
1622 | === modified file 'Percona-Server/sql/sql_admin.cc' | |||
1623 | --- Percona-Server/sql/sql_admin.cc 2012-10-16 06:21:51 +0000 | |||
1624 | +++ Percona-Server/sql/sql_admin.cc 2013-01-09 13:41:38 +0000 | |||
1625 | @@ -804,7 +804,7 @@ | |||
1626 | 804 | protocol->store(operator_name, system_charset_info); | 804 | protocol->store(operator_name, system_charset_info); |
1627 | 805 | if (result_code) // either mysql_recreate_table or analyze failed | 805 | if (result_code) // either mysql_recreate_table or analyze failed |
1628 | 806 | { | 806 | { |
1630 | 807 | DBUG_ASSERT(thd->is_error() || thd->killed); | 807 | DBUG_ASSERT(thd->is_error() || thd->get_killed()); |
1631 | 808 | if (thd->is_error()) | 808 | if (thd->is_error()) |
1632 | 809 | { | 809 | { |
1633 | 810 | const char *err_msg= thd->get_stmt_da()->message(); | 810 | const char *err_msg= thd->get_stmt_da()->message(); |
1634 | 811 | 811 | ||
1635 | === modified file 'Percona-Server/sql/sql_base.cc' | |||
1636 | --- Percona-Server/sql/sql_base.cc 2012-12-04 08:24:59 +0000 | |||
1637 | +++ Percona-Server/sql/sql_base.cc 2013-01-09 13:41:38 +0000 | |||
1638 | @@ -850,9 +850,9 @@ | |||
1639 | 850 | THD *in_use= tab->in_use; | 850 | THD *in_use= tab->in_use; |
1640 | 851 | 851 | ||
1641 | 852 | if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && | 852 | if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && |
1643 | 853 | ! in_use->killed) | 853 | ! in_use->get_killed()) |
1644 | 854 | { | 854 | { |
1646 | 855 | in_use->killed= THD::KILL_CONNECTION; | 855 | in_use->set_killed(THD::KILL_CONNECTION); |
1647 | 856 | mysql_mutex_lock(&in_use->mysys_var->mutex); | 856 | mysql_mutex_lock(&in_use->mysys_var->mutex); |
1648 | 857 | if (in_use->mysys_var->current_cond) | 857 | if (in_use->mysys_var->current_cond) |
1649 | 858 | { | 858 | { |
1650 | @@ -983,7 +983,7 @@ | |||
1651 | 983 | /* Wait until all threads have closed all the tables we are flushing. */ | 983 | /* Wait until all threads have closed all the tables we are flushing. */ |
1652 | 984 | DBUG_PRINT("info", ("Waiting for other threads to close their open tables")); | 984 | DBUG_PRINT("info", ("Waiting for other threads to close their open tables")); |
1653 | 985 | 985 | ||
1655 | 986 | while (found && ! thd->killed) | 986 | while (found && ! thd->get_killed()) |
1656 | 987 | { | 987 | { |
1657 | 988 | TABLE_SHARE *share; | 988 | TABLE_SHARE *share; |
1658 | 989 | found= FALSE; | 989 | found= FALSE; |
1659 | @@ -2594,7 +2594,7 @@ | |||
1660 | 2594 | if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias)) | 2594 | if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias)) |
1661 | 2595 | DBUG_RETURN(TRUE); | 2595 | DBUG_RETURN(TRUE); |
1662 | 2596 | 2596 | ||
1664 | 2597 | if (thd->killed) | 2597 | if (thd->get_killed()) |
1665 | 2598 | DBUG_RETURN(TRUE); | 2598 | DBUG_RETURN(TRUE); |
1666 | 2599 | 2599 | ||
1667 | 2600 | key_length= get_table_def_key(table_list, &key); | 2600 | key_length= get_table_def_key(table_list, &key); |
1668 | @@ -3530,7 +3530,7 @@ | |||
1669 | 3530 | mysql_lock_merge(thd->lock, lock)) == NULL) | 3530 | mysql_lock_merge(thd->lock, lock)) == NULL) |
1670 | 3531 | { | 3531 | { |
1671 | 3532 | unlink_all_closed_tables(thd, lock, reopen_count); | 3532 | unlink_all_closed_tables(thd, lock, reopen_count); |
1673 | 3533 | if (! thd->killed) | 3533 | if (! thd->get_killed()) |
1674 | 3534 | my_error(ER_LOCK_DEADLOCK, MYF(0)); | 3534 | my_error(ER_LOCK_DEADLOCK, MYF(0)); |
1675 | 3535 | return TRUE; | 3535 | return TRUE; |
1676 | 3536 | } | 3536 | } |
1677 | 3537 | 3537 | ||
1678 | === modified file 'Percona-Server/sql/sql_cache.cc' | |||
1679 | --- Percona-Server/sql/sql_cache.cc 2012-10-03 12:51:45 +0000 | |||
1680 | +++ Percona-Server/sql/sql_cache.cc 2013-01-09 13:41:38 +0000 | |||
1681 | @@ -1001,7 +1001,7 @@ | |||
1682 | 1001 | if (query_cache_tls->first_query_block == NULL) | 1001 | if (query_cache_tls->first_query_block == NULL) |
1683 | 1002 | DBUG_VOID_RETURN; | 1002 | DBUG_VOID_RETURN; |
1684 | 1003 | 1003 | ||
1686 | 1004 | if (thd->killed || thd->is_error()) | 1004 | if (thd->get_killed() || thd->is_error()) |
1687 | 1005 | { | 1005 | { |
1688 | 1006 | query_cache_abort(&thd->query_cache_tls); | 1006 | query_cache_abort(&thd->query_cache_tls); |
1689 | 1007 | DBUG_VOID_RETURN; | 1007 | DBUG_VOID_RETURN; |
1690 | @@ -4239,7 +4239,7 @@ | |||
1691 | 4239 | DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line)); | 4239 | DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line)); |
1692 | 4240 | DBUG_PRINT("warning", ("==================================")); | 4240 | DBUG_PRINT("warning", ("==================================")); |
1693 | 4241 | if (thd) | 4241 | if (thd) |
1695 | 4242 | thd->killed= THD::KILL_CONNECTION; | 4242 | thd->set_killed(THD::KILL_CONNECTION); |
1696 | 4243 | cache_dump(); | 4243 | cache_dump(); |
1697 | 4244 | /* check_integrity(0); */ /* Can't call it here because of locks */ | 4244 | /* check_integrity(0); */ /* Can't call it here because of locks */ |
1698 | 4245 | bins_dump(); | 4245 | bins_dump(); |
1699 | 4246 | 4246 | ||
1700 | === modified file 'Percona-Server/sql/sql_class.cc' | |||
1701 | --- Percona-Server/sql/sql_class.cc 2012-12-04 08:24:59 +0000 | |||
1702 | +++ Percona-Server/sql/sql_class.cc 2013-01-09 13:41:38 +0000 | |||
1703 | @@ -273,7 +273,7 @@ | |||
1704 | 273 | */ | 273 | */ |
1705 | 274 | void thd_set_killed(THD *thd) | 274 | void thd_set_killed(THD *thd) |
1706 | 275 | { | 275 | { |
1708 | 276 | thd->killed= THD::KILL_CONNECTION; | 276 | thd->set_killed(THD::KILL_CONNECTION); |
1709 | 277 | } | 277 | } |
1710 | 278 | 278 | ||
1711 | 279 | /** | 279 | /** |
1712 | @@ -928,7 +928,7 @@ | |||
1713 | 928 | password= 0; | 928 | password= 0; |
1714 | 929 | query_start_used= query_start_usec_used= 0; | 929 | query_start_used= query_start_usec_used= 0; |
1715 | 930 | count_cuted_fields= CHECK_FIELD_IGNORE; | 930 | count_cuted_fields= CHECK_FIELD_IGNORE; |
1717 | 931 | killed= NOT_KILLED; | 931 | set_killed(NOT_KILLED); |
1718 | 932 | col_access=0; | 932 | col_access=0; |
1719 | 933 | is_slave_error= thread_specific_used= FALSE; | 933 | is_slave_error= thread_specific_used= FALSE; |
1720 | 934 | my_hash_clear(&handler_tables_hash); | 934 | my_hash_clear(&handler_tables_hash); |
1721 | @@ -945,6 +945,7 @@ | |||
1722 | 945 | start_time.tv_sec= 0; | 945 | start_time.tv_sec= 0; |
1723 | 946 | start_time.tv_usec= 0; | 946 | start_time.tv_usec= 0; |
1724 | 947 | start_utime= prior_thr_create_utime= 0L; | 947 | start_utime= prior_thr_create_utime= 0L; |
1725 | 948 | sql_timeout_expire= 0; | ||
1726 | 948 | utime_after_lock= 0L; | 949 | utime_after_lock= 0L; |
1727 | 949 | current_linfo = 0; | 950 | current_linfo = 0; |
1728 | 950 | slave_thread = 0; | 951 | slave_thread = 0; |
1729 | @@ -1227,7 +1228,7 @@ | |||
1730 | 1227 | push_warning and strict SQL_MODE case. | 1228 | push_warning and strict SQL_MODE case. |
1731 | 1228 | */ | 1229 | */ |
1732 | 1229 | level= Sql_condition::WARN_LEVEL_ERROR; | 1230 | level= Sql_condition::WARN_LEVEL_ERROR; |
1734 | 1230 | killed= THD::KILL_BAD_DATA; | 1231 | set_killed(THD::KILL_BAD_DATA); |
1735 | 1231 | } | 1232 | } |
1736 | 1232 | 1233 | ||
1737 | 1233 | switch (level) | 1234 | switch (level) |
1738 | @@ -1433,7 +1434,7 @@ | |||
1739 | 1433 | mysql_mutex_unlock(&LOCK_status); | 1434 | mysql_mutex_unlock(&LOCK_status); |
1740 | 1434 | 1435 | ||
1741 | 1435 | cleanup(); | 1436 | cleanup(); |
1743 | 1436 | killed= NOT_KILLED; | 1437 | set_killed(NOT_KILLED); |
1744 | 1437 | cleanup_done= 0; | 1438 | cleanup_done= 0; |
1745 | 1438 | init(); | 1439 | init(); |
1746 | 1439 | stmt_map.reset(); | 1440 | stmt_map.reset(); |
1747 | @@ -1454,7 +1455,7 @@ | |||
1748 | 1454 | DBUG_ENTER("THD::cleanup"); | 1455 | DBUG_ENTER("THD::cleanup"); |
1749 | 1455 | DBUG_ASSERT(cleanup_done == 0); | 1456 | DBUG_ASSERT(cleanup_done == 0); |
1750 | 1456 | 1457 | ||
1752 | 1457 | killed= KILL_CONNECTION; | 1458 | set_killed(KILL_CONNECTION); |
1753 | 1458 | #ifdef ENABLE_WHEN_BINLOG_WILL_BE_ABLE_TO_PREPARE | 1459 | #ifdef ENABLE_WHEN_BINLOG_WILL_BE_ABLE_TO_PREPARE |
1754 | 1459 | if (transaction.xid_state.xa_state == XA_PREPARED) | 1460 | if (transaction.xid_state.xa_state == XA_PREPARED) |
1755 | 1460 | { | 1461 | { |
1756 | @@ -1692,7 +1693,7 @@ | |||
1757 | 1692 | mysql_mutex_assert_owner(&LOCK_thd_data); | 1693 | mysql_mutex_assert_owner(&LOCK_thd_data); |
1758 | 1693 | 1694 | ||
1759 | 1694 | /* Set the 'killed' flag of 'this', which is the target THD object. */ | 1695 | /* Set the 'killed' flag of 'this', which is the target THD object. */ |
1761 | 1695 | killed= state_to_set; | 1696 | set_killed(state_to_set); |
1762 | 1696 | 1697 | ||
1763 | 1697 | if (state_to_set != THD::KILL_QUERY) | 1698 | if (state_to_set != THD::KILL_QUERY) |
1764 | 1698 | { | 1699 | { |
1765 | @@ -1713,7 +1714,7 @@ | |||
1766 | 1713 | 1714 | ||
1767 | 1714 | On the other hand, without closing the socket we have a race | 1715 | On the other hand, without closing the socket we have a race |
1768 | 1715 | condition. If "this" target thread passes the check of | 1716 | condition. If "this" target thread passes the check of |
1770 | 1716 | thd->killed, and then the current thread runs through | 1717 | thd->get_killed(), and then the current thread runs through |
1771 | 1717 | THD::awake(), sets the 'killed' flag and completes the | 1718 | THD::awake(), sets the 'killed' flag and completes the |
1772 | 1718 | signaling, and then the target thread runs into read(), it will | 1719 | signaling, and then the target thread runs into read(), it will |
1773 | 1719 | block on the socket. As a result of the discussions around | 1720 | block on the socket. As a result of the discussions around |
1774 | @@ -1721,7 +1722,7 @@ | |||
1775 | 1721 | condition. A second KILL awakes the target from read(). | 1722 | condition. A second KILL awakes the target from read(). |
1776 | 1722 | 1723 | ||
1777 | 1723 | If we are killing ourselves, we know that we are not blocked. | 1724 | If we are killing ourselves, we know that we are not blocked. |
1779 | 1724 | We also know that we will check thd->killed before we go for | 1725 | We also know that we will check thd->get_killed() before we go for |
1780 | 1725 | reading the next statement. | 1726 | reading the next statement. |
1781 | 1726 | */ | 1727 | */ |
1782 | 1727 | 1728 | ||
1783 | @@ -1759,7 +1760,7 @@ | |||
1784 | 1759 | current_cond and current_mutex are 0), then the victim will not get | 1760 | current_cond and current_mutex are 0), then the victim will not get |
1785 | 1760 | a signal and it may wait "forever" on the cond (until | 1761 | a signal and it may wait "forever" on the cond (until |
1786 | 1761 | we issue a second KILL or the status it's waiting for happens). | 1762 | we issue a second KILL or the status it's waiting for happens). |
1788 | 1762 | It's true that we have set its thd->killed but it may not | 1763 | It's true that we have set its thd->get_killed() but it may not |
1789 | 1763 | see it immediately and so may have time to reach the cond_wait(). | 1764 | see it immediately and so may have time to reach the cond_wait(). |
1790 | 1764 | 1765 | ||
1791 | 1765 | However, where possible, we test for killed once again after | 1766 | However, where possible, we test for killed once again after |
1792 | @@ -1792,7 +1793,7 @@ | |||
1793 | 1792 | 1793 | ||
1794 | 1793 | mysql_mutex_lock(&LOCK_thd_data); | 1794 | mysql_mutex_lock(&LOCK_thd_data); |
1795 | 1794 | 1795 | ||
1797 | 1795 | killed= THD::KILL_CONNECTION; | 1796 | set_killed(THD::KILL_CONNECTION); |
1798 | 1796 | 1797 | ||
1799 | 1797 | #ifdef SIGNAL_WITH_VIO_CLOSE | 1798 | #ifdef SIGNAL_WITH_VIO_CLOSE |
1800 | 1798 | /* | 1799 | /* |
1801 | @@ -1820,9 +1821,9 @@ | |||
1802 | 1820 | THD *in_use= ctx_in_use->get_thd(); | 1821 | THD *in_use= ctx_in_use->get_thd(); |
1803 | 1821 | bool signalled= FALSE; | 1822 | bool signalled= FALSE; |
1804 | 1822 | if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && | 1823 | if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && |
1806 | 1823 | !in_use->killed) | 1824 | !in_use->get_killed()) |
1807 | 1824 | { | 1825 | { |
1809 | 1825 | in_use->killed= THD::KILL_CONNECTION; | 1826 | in_use->set_killed(THD::KILL_CONNECTION); |
1810 | 1826 | mysql_mutex_lock(&in_use->mysys_var->mutex); | 1827 | mysql_mutex_lock(&in_use->mysys_var->mutex); |
1811 | 1827 | if (in_use->mysys_var->current_cond) | 1828 | if (in_use->mysys_var->current_cond) |
1812 | 1828 | mysql_cond_broadcast(in_use->mysys_var->current_cond); | 1829 | mysql_cond_broadcast(in_use->mysys_var->current_cond); |
1813 | @@ -2185,7 +2186,7 @@ | |||
1814 | 2185 | { | 2186 | { |
1815 | 2186 | my_error(EE_OUTOFMEMORY, MYF(ME_BELL), | 2187 | my_error(EE_OUTOFMEMORY, MYF(ME_BELL), |
1816 | 2187 | ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1); | 2188 | ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1); |
1818 | 2188 | killed= KILL_CONNECTION; | 2189 | set_killed(KILL_CONNECTION); |
1819 | 2189 | return 0; | 2190 | return 0; |
1820 | 2190 | } | 2191 | } |
1821 | 2191 | 2192 | ||
1822 | @@ -3992,7 +3993,7 @@ | |||
1823 | 3992 | */ | 3993 | */ |
1824 | 3993 | extern "C" int thd_killed(const MYSQL_THD thd) | 3994 | extern "C" int thd_killed(const MYSQL_THD thd) |
1825 | 3994 | { | 3995 | { |
1827 | 3995 | return(thd->killed); | 3996 | return(thd->get_killed()); |
1828 | 3996 | } | 3997 | } |
1829 | 3997 | 3998 | ||
1830 | 3998 | /** | 3999 | /** |
1831 | 3999 | 4000 | ||
1832 | === modified file 'Percona-Server/sql/sql_class.h' | |||
1833 | --- Percona-Server/sql/sql_class.h 2012-12-04 08:24:59 +0000 | |||
1834 | +++ Percona-Server/sql/sql_class.h 2013-01-09 13:41:38 +0000 | |||
1835 | @@ -481,6 +481,7 @@ | |||
1836 | 481 | ulong trans_alloc_block_size; | 481 | ulong trans_alloc_block_size; |
1837 | 482 | ulong trans_prealloc_size; | 482 | ulong trans_prealloc_size; |
1838 | 483 | ulong group_concat_max_len; | 483 | ulong group_concat_max_len; |
1839 | 484 | ulong sql_timeout; | ||
1840 | 484 | 485 | ||
1841 | 485 | ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) | 486 | ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) |
1842 | 486 | my_bool binlog_direct_non_trans_update; | 487 | my_bool binlog_direct_non_trans_update; |
1843 | @@ -2124,6 +2125,12 @@ | |||
1844 | 2124 | uint16 peer_port; | 2125 | uint16 peer_port; |
1845 | 2125 | struct timeval start_time; | 2126 | struct timeval start_time; |
1846 | 2126 | struct timeval user_time; | 2127 | struct timeval user_time; |
1847 | 2128 | /* | ||
1848 | 2129 | Expire time in microseconds for sql_timeout monitor thread. The 0 value | ||
1849 | 2130 | means the current thread is not monitored by sql_timeout monitor. | ||
1850 | 2131 | */ | ||
1851 | 2132 | ulonglong sql_timeout_expire; | ||
1852 | 2133 | |||
1853 | 2127 | // track down slow pthread_create | 2134 | // track down slow pthread_create |
1854 | 2128 | ulonglong prior_thr_create_utime, thr_create_utime; | 2135 | ulonglong prior_thr_create_utime, thr_create_utime; |
1855 | 2129 | ulonglong start_utime, utime_after_lock; | 2136 | ulonglong start_utime, utime_after_lock; |
1856 | @@ -2807,7 +2814,27 @@ | |||
1857 | 2807 | KILL_QUERY=ER_QUERY_INTERRUPTED, | 2814 | KILL_QUERY=ER_QUERY_INTERRUPTED, |
1858 | 2808 | KILLED_NO_VALUE /* means neither of the states */ | 2815 | KILLED_NO_VALUE /* means neither of the states */ |
1859 | 2809 | }; | 2816 | }; |
1861 | 2810 | killed_state volatile killed; | 2817 | |
1862 | 2818 | private: | ||
1863 | 2819 | killed_state volatile killed_status; | ||
1864 | 2820 | |||
1865 | 2821 | public: | ||
1866 | 2822 | killed_state get_killed() const | ||
1867 | 2823 | { | ||
1868 | 2824 | if (killed_status) | ||
1869 | 2825 | return killed_status; | ||
1870 | 2826 | if (sql_timeout_expire && | ||
1871 | 2827 | (my_micro_time() >= sql_timeout_expire)) | ||
1872 | 2828 | { | ||
1873 | 2829 | return THD::KILL_QUERY; | ||
1874 | 2830 | } | ||
1875 | 2831 | return killed_status; | ||
1876 | 2832 | } | ||
1877 | 2833 | |||
1878 | 2834 | void set_killed(killed_state new_killed) | ||
1879 | 2835 | { | ||
1880 | 2836 | killed_status= new_killed; | ||
1881 | 2837 | } | ||
1882 | 2811 | 2838 | ||
1883 | 2812 | /* scramble - random string sent to client on handshake */ | 2839 | /* scramble - random string sent to client on handshake */ |
1884 | 2813 | char scramble[SCRAMBLE_LENGTH+1]; | 2840 | char scramble[SCRAMBLE_LENGTH+1]; |
1885 | @@ -3080,7 +3107,7 @@ | |||
1886 | 3080 | DBUG_VOID_RETURN; | 3107 | DBUG_VOID_RETURN; |
1887 | 3081 | } | 3108 | } |
1888 | 3082 | 3109 | ||
1890 | 3083 | virtual int is_killed() { return killed; } | 3110 | virtual int is_killed() { return get_killed(); } |
1891 | 3084 | virtual THD* get_thd() { return this; } | 3111 | virtual THD* get_thd() { return this; } |
1892 | 3085 | 3112 | ||
1893 | 3086 | /** | 3113 | /** |
1894 | @@ -3331,7 +3358,7 @@ | |||
1895 | 3331 | */ | 3358 | */ |
1896 | 3332 | inline void fatal_error() | 3359 | inline void fatal_error() |
1897 | 3333 | { | 3360 | { |
1899 | 3334 | DBUG_ASSERT(get_stmt_da()->is_error() || killed); | 3361 | DBUG_ASSERT(get_stmt_da()->is_error() || get_killed()); |
1900 | 3335 | is_fatal_error= 1; | 3362 | is_fatal_error= 1; |
1901 | 3336 | DBUG_PRINT("error",("Fatal error set")); | 3363 | DBUG_PRINT("error",("Fatal error set")); |
1902 | 3337 | } | 3364 | } |
1903 | @@ -3420,7 +3447,7 @@ | |||
1904 | 3420 | inline int killed_errno() const | 3447 | inline int killed_errno() const |
1905 | 3421 | { | 3448 | { |
1906 | 3422 | killed_state killed_val; /* to cache the volatile 'killed' */ | 3449 | killed_state killed_val; /* to cache the volatile 'killed' */ |
1908 | 3423 | return (killed_val= killed) != KILL_BAD_DATA ? killed_val : 0; | 3450 | return (killed_val= get_killed()) != KILL_BAD_DATA ? killed_val : 0; |
1909 | 3424 | } | 3451 | } |
1910 | 3425 | inline void send_kill_message() const | 3452 | inline void send_kill_message() const |
1911 | 3426 | { | 3453 | { |
1912 | 3427 | 3454 | ||
1913 | === modified file 'Percona-Server/sql/sql_connect.cc' | |||
1914 | --- Percona-Server/sql/sql_connect.cc 2012-12-04 08:24:59 +0000 | |||
1915 | +++ Percona-Server/sql/sql_connect.cc 2013-01-09 13:41:38 +0000 | |||
1916 | @@ -768,14 +768,14 @@ | |||
1917 | 768 | */ | 768 | */ |
1918 | 769 | release_user_connection(thd); | 769 | release_user_connection(thd); |
1919 | 770 | 770 | ||
1921 | 771 | if (thd->killed || (net->error && net->vio != 0)) | 771 | if (thd->get_killed() || (net->error && net->vio != 0)) |
1922 | 772 | { | 772 | { |
1923 | 773 | statistic_increment(aborted_threads,&LOCK_status); | 773 | statistic_increment(aborted_threads,&LOCK_status); |
1924 | 774 | } | 774 | } |
1925 | 775 | 775 | ||
1926 | 776 | if (net->error && net->vio != 0) | 776 | if (net->error && net->vio != 0) |
1927 | 777 | { | 777 | { |
1929 | 778 | if (!thd->killed && log_warnings > 1) | 778 | if (!thd->get_killed() && log_warnings > 1) |
1930 | 779 | { | 779 | { |
1931 | 780 | Security_context *sctx= thd->security_ctx; | 780 | Security_context *sctx= thd->security_ctx; |
1932 | 781 | 781 | ||
1933 | @@ -846,7 +846,7 @@ | |||
1934 | 846 | 846 | ||
1935 | 847 | thd->server_status&= ~SERVER_STATUS_CLEAR_SET; | 847 | thd->server_status&= ~SERVER_STATUS_CLEAR_SET; |
1936 | 848 | thd->protocol->end_statement(); | 848 | thd->protocol->end_statement(); |
1938 | 849 | thd->killed = THD::KILL_CONNECTION; | 849 | thd->set_killed(THD::KILL_CONNECTION); |
1939 | 850 | errors.m_init_connect= 1; | 850 | errors.m_init_connect= 1; |
1940 | 851 | inc_host_errors(thd->main_security_ctx.ip, &errors); | 851 | inc_host_errors(thd->main_security_ctx.ip, &errors); |
1941 | 852 | return; | 852 | return; |
1942 | @@ -907,7 +907,7 @@ | |||
1943 | 907 | NET *net= &thd->net; | 907 | NET *net= &thd->net; |
1944 | 908 | if (!net->error && | 908 | if (!net->error && |
1945 | 909 | net->vio != 0 && | 909 | net->vio != 0 && |
1947 | 910 | !(thd->killed == THD::KILL_CONNECTION)) | 910 | !(thd->get_killed() == THD::KILL_CONNECTION)) |
1948 | 911 | return TRUE; | 911 | return TRUE; |
1949 | 912 | return FALSE; | 912 | return FALSE; |
1950 | 913 | } | 913 | } |
1951 | 914 | 914 | ||
1952 | === modified file 'Percona-Server/sql/sql_db.cc' | |||
1953 | --- Percona-Server/sql/sql_db.cc 2012-12-04 08:24:59 +0000 | |||
1954 | +++ Percona-Server/sql/sql_db.cc 2013-01-09 13:41:38 +0000 | |||
1955 | @@ -840,7 +840,7 @@ | |||
1956 | 840 | } | 840 | } |
1957 | 841 | 841 | ||
1958 | 842 | thd->push_internal_handler(&err_handler); | 842 | thd->push_internal_handler(&err_handler); |
1960 | 843 | if (!thd->killed && | 843 | if (!thd->get_killed() && |
1961 | 844 | !(tables && | 844 | !(tables && |
1962 | 845 | mysql_rm_table_no_locks(thd, tables, true, false, true, true))) | 845 | mysql_rm_table_no_locks(thd, tables, true, false, true, true))) |
1963 | 846 | { | 846 | { |
1964 | @@ -1025,7 +1025,7 @@ | |||
1965 | 1025 | tot_list_next_local= tot_list_next_global= &tot_list; | 1025 | tot_list_next_local= tot_list_next_global= &tot_list; |
1966 | 1026 | 1026 | ||
1967 | 1027 | for (uint idx=0 ; | 1027 | for (uint idx=0 ; |
1969 | 1028 | idx < (uint) dirp->number_off_files && !thd->killed ; | 1028 | idx < (uint) dirp->number_off_files && !thd->get_killed() ; |
1970 | 1029 | idx++) | 1029 | idx++) |
1971 | 1030 | { | 1030 | { |
1972 | 1031 | FILEINFO *file=dirp->dir_entry+idx; | 1031 | FILEINFO *file=dirp->dir_entry+idx; |
1973 | @@ -1206,7 +1206,7 @@ | |||
1974 | 1206 | DBUG_PRINT("enter", ("path: %s", org_path)); | 1206 | DBUG_PRINT("enter", ("path: %s", org_path)); |
1975 | 1207 | 1207 | ||
1976 | 1208 | for (uint idx=0 ; | 1208 | for (uint idx=0 ; |
1978 | 1209 | idx < (uint) dirp->number_off_files && !thd->killed ; | 1209 | idx < (uint) dirp->number_off_files && !thd->get_killed() ; |
1979 | 1210 | idx++) | 1210 | idx++) |
1980 | 1211 | { | 1211 | { |
1981 | 1212 | FILEINFO *file=dirp->dir_entry+idx; | 1212 | FILEINFO *file=dirp->dir_entry+idx; |
1982 | @@ -1241,7 +1241,7 @@ | |||
1983 | 1241 | } | 1241 | } |
1984 | 1242 | deleted++; | 1242 | deleted++; |
1985 | 1243 | } | 1243 | } |
1987 | 1244 | if (thd->killed) | 1244 | if (thd->get_killed()) |
1988 | 1245 | goto err; | 1245 | goto err; |
1989 | 1246 | 1246 | ||
1990 | 1247 | my_dirend(dirp); | 1247 | my_dirend(dirp); |
1991 | @@ -1710,7 +1710,7 @@ | |||
1992 | 1710 | if ((dirp = my_dir(path,MYF(MY_DONT_SORT)))) | 1710 | if ((dirp = my_dir(path,MYF(MY_DONT_SORT)))) |
1993 | 1711 | { | 1711 | { |
1994 | 1712 | uint nfiles= (uint) dirp->number_off_files; | 1712 | uint nfiles= (uint) dirp->number_off_files; |
1996 | 1713 | for (uint idx=0 ; idx < nfiles && !thd->killed ; idx++) | 1713 | for (uint idx=0 ; idx < nfiles && !thd->get_killed() ; idx++) |
1997 | 1714 | { | 1714 | { |
1998 | 1715 | FILEINFO *file= dirp->dir_entry + idx; | 1715 | FILEINFO *file= dirp->dir_entry + idx; |
1999 | 1716 | char *extension, tname[FN_REFLEN + 1]; | 1716 | char *extension, tname[FN_REFLEN + 1]; |
2000 | 1717 | 1717 | ||
2001 | === modified file 'Percona-Server/sql/sql_delete.cc' | |||
2002 | --- Percona-Server/sql/sql_delete.cc 2012-12-04 08:24:59 +0000 | |||
2003 | +++ Percona-Server/sql/sql_delete.cc 2013-01-09 13:41:38 +0000 | |||
2004 | @@ -350,7 +350,7 @@ | |||
2005 | 350 | select && select->quick && select->quick->index != MAX_KEY) | 350 | select && select->quick && select->quick->index != MAX_KEY) |
2006 | 351 | read_removal= table->check_read_removal(select->quick->index); | 351 | read_removal= table->check_read_removal(select->quick->index); |
2007 | 352 | 352 | ||
2009 | 353 | while (!(error=info.read_record(&info)) && !thd->killed && | 353 | while (!(error=info.read_record(&info)) && !thd->get_killed() && |
2010 | 354 | ! thd->is_error()) | 354 | ! thd->is_error()) |
2011 | 355 | { | 355 | { |
2012 | 356 | thd->inc_examined_row_count(1); | 356 | thd->inc_examined_row_count(1); |
2013 | @@ -406,7 +406,7 @@ | |||
2014 | 406 | else | 406 | else |
2015 | 407 | break; | 407 | break; |
2016 | 408 | } | 408 | } |
2018 | 409 | killed_status= thd->killed; | 409 | killed_status= thd->get_killed(); |
2019 | 410 | if (killed_status != THD::NOT_KILLED || thd->is_error()) | 410 | if (killed_status != THD::NOT_KILLED || thd->is_error()) |
2020 | 411 | error= 1; // Aborted | 411 | error= 1; // Aborted |
2021 | 412 | if (will_batch && (loc_error= table->file->end_bulk_delete())) | 412 | if (will_batch && (loc_error= table->file->end_bulk_delete())) |
2022 | @@ -479,7 +479,7 @@ | |||
2023 | 479 | my_ok(thd, deleted); | 479 | my_ok(thd, deleted); |
2024 | 480 | DBUG_PRINT("info",("%ld records deleted",(long) deleted)); | 480 | DBUG_PRINT("info",("%ld records deleted",(long) deleted)); |
2025 | 481 | } | 481 | } |
2027 | 482 | DBUG_RETURN(thd->is_error() || thd->killed); | 482 | DBUG_RETURN(thd->is_error() || thd->get_killed()); |
2028 | 483 | 483 | ||
2029 | 484 | #ifdef WITH_PARTITION_STORAGE_ENGINE | 484 | #ifdef WITH_PARTITION_STORAGE_ENGINE |
2030 | 485 | exit_all_parts_pruned_away: | 485 | exit_all_parts_pruned_away: |
2031 | @@ -496,7 +496,7 @@ | |||
2032 | 496 | delete select; | 496 | delete select; |
2033 | 497 | free_underlaid_joins(thd, select_lex); | 497 | free_underlaid_joins(thd, select_lex); |
2034 | 498 | table->set_keyread(false); | 498 | table->set_keyread(false); |
2036 | 499 | DBUG_RETURN((err || thd->is_error() || thd->killed) ? 1 : 0); | 499 | DBUG_RETURN((err || thd->is_error() || thd->get_killed()) ? 1 : 0); |
2037 | 500 | } | 500 | } |
2038 | 501 | 501 | ||
2039 | 502 | 502 | ||
2040 | @@ -893,7 +893,7 @@ | |||
2041 | 893 | */ | 893 | */ |
2042 | 894 | if (mysql_bin_log.is_open()) | 894 | if (mysql_bin_log.is_open()) |
2043 | 895 | { | 895 | { |
2045 | 896 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 896 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
2046 | 897 | /* possible error of writing binary log is ignored deliberately */ | 897 | /* possible error of writing binary log is ignored deliberately */ |
2047 | 898 | (void) thd->binlog_query(THD::ROW_QUERY_TYPE, | 898 | (void) thd->binlog_query(THD::ROW_QUERY_TYPE, |
2048 | 899 | thd->query(), thd->query_length(), | 899 | thd->query(), thd->query_length(), |
2049 | @@ -938,7 +938,7 @@ | |||
2050 | 938 | int local_error= | 938 | int local_error= |
2051 | 939 | do_table_deletes(table, thd->lex->current_select->no_error); | 939 | do_table_deletes(table, thd->lex->current_select->no_error); |
2052 | 940 | 940 | ||
2054 | 941 | if (thd->killed && !local_error) | 941 | if (thd->get_killed() && !local_error) |
2055 | 942 | DBUG_RETURN(1); | 942 | DBUG_RETURN(1); |
2056 | 943 | 943 | ||
2057 | 944 | if (local_error == -1) // End of file | 944 | if (local_error == -1) // End of file |
2058 | @@ -980,7 +980,7 @@ | |||
2059 | 980 | */ | 980 | */ |
2060 | 981 | info.ignore_not_found_rows= 1; | 981 | info.ignore_not_found_rows= 1; |
2061 | 982 | bool will_batch= !table->file->start_bulk_delete(); | 982 | bool will_batch= !table->file->start_bulk_delete(); |
2063 | 983 | while (!(local_error= info.read_record(&info)) && !thd->killed) | 983 | while (!(local_error= info.read_record(&info)) && !thd->get_killed()) |
2064 | 984 | { | 984 | { |
2065 | 985 | if (table->triggers && | 985 | if (table->triggers && |
2066 | 986 | table->triggers->process_triggers(thd, TRG_EVENT_DELETE, | 986 | table->triggers->process_triggers(thd, TRG_EVENT_DELETE, |
2067 | @@ -1048,7 +1048,7 @@ | |||
2068 | 1048 | 1048 | ||
2069 | 1049 | /* compute a total error to know if something failed */ | 1049 | /* compute a total error to know if something failed */ |
2070 | 1050 | local_error= local_error || error; | 1050 | local_error= local_error || error; |
2072 | 1051 | killed_status= (local_error == 0)? THD::NOT_KILLED : thd->killed; | 1051 | killed_status= (local_error == 0)? THD::NOT_KILLED : thd->get_killed(); |
2073 | 1052 | /* reset used flags */ | 1052 | /* reset used flags */ |
2074 | 1053 | THD_STAGE_INFO(thd, stage_end); | 1053 | THD_STAGE_INFO(thd, stage_end); |
2075 | 1054 | 1054 | ||
2076 | 1055 | 1055 | ||
2077 | === modified file 'Percona-Server/sql/sql_executor.cc' | |||
2078 | --- Percona-Server/sql/sql_executor.cc 2012-12-04 08:24:59 +0000 | |||
2079 | +++ Percona-Server/sql/sql_executor.cc 2013-01-09 13:41:38 +0000 | |||
2080 | @@ -1033,7 +1033,7 @@ | |||
2081 | 1033 | 1033 | ||
2082 | 1034 | DBUG_ENTER("sub_select_op"); | 1034 | DBUG_ENTER("sub_select_op"); |
2083 | 1035 | 1035 | ||
2085 | 1036 | if (join->thd->killed) | 1036 | if (join->thd->get_killed()) |
2086 | 1037 | { | 1037 | { |
2087 | 1038 | /* The user has aborted the execution of the query */ | 1038 | /* The user has aborted the execution of the query */ |
2088 | 1039 | join->thd->send_kill_message(); | 1039 | join->thd->send_kill_message(); |
2089 | @@ -1248,13 +1248,13 @@ | |||
2090 | 1248 | else | 1248 | else |
2091 | 1249 | error= info->read_record(info); | 1249 | error= info->read_record(info); |
2092 | 1250 | 1250 | ||
2094 | 1251 | DBUG_EXECUTE_IF("bug13822652_1", join->thd->killed= THD::KILL_QUERY;); | 1251 | DBUG_EXECUTE_IF("bug13822652_1", join->thd->set_killed(THD::KILL_QUERY);); |
2095 | 1252 | 1252 | ||
2096 | 1253 | if (error > 0 || (join->thd->is_error())) // Fatal error | 1253 | if (error > 0 || (join->thd->is_error())) // Fatal error |
2097 | 1254 | rc= NESTED_LOOP_ERROR; | 1254 | rc= NESTED_LOOP_ERROR; |
2098 | 1255 | else if (error < 0) | 1255 | else if (error < 0) |
2099 | 1256 | break; | 1256 | break; |
2101 | 1257 | else if (join->thd->killed) // Aborted by user | 1257 | else if (join->thd->get_killed()) // Aborted by user |
2102 | 1258 | { | 1258 | { |
2103 | 1259 | join->thd->send_kill_message(); | 1259 | join->thd->send_kill_message(); |
2104 | 1260 | rc= NESTED_LOOP_KILLED; | 1260 | rc= NESTED_LOOP_KILLED; |
2105 | @@ -1450,7 +1450,7 @@ | |||
2106 | 1450 | { | 1450 | { |
2107 | 1451 | found= test(condition->val_int()); | 1451 | found= test(condition->val_int()); |
2108 | 1452 | 1452 | ||
2110 | 1453 | if (join->thd->killed) | 1453 | if (join->thd->get_killed()) |
2111 | 1454 | { | 1454 | { |
2112 | 1455 | join->thd->send_kill_message(); | 1455 | join->thd->send_kill_message(); |
2113 | 1456 | DBUG_RETURN(NESTED_LOOP_KILLED); | 1456 | DBUG_RETURN(NESTED_LOOP_KILLED); |
2114 | @@ -1737,7 +1737,7 @@ | |||
2115 | 1737 | if (error != HA_ERR_LOCK_DEADLOCK && | 1737 | if (error != HA_ERR_LOCK_DEADLOCK && |
2116 | 1738 | error != HA_ERR_LOCK_WAIT_TIMEOUT && | 1738 | error != HA_ERR_LOCK_WAIT_TIMEOUT && |
2117 | 1739 | error != HA_ERR_TABLE_DEF_CHANGED && | 1739 | error != HA_ERR_TABLE_DEF_CHANGED && |
2119 | 1740 | !table->in_use->killed) | 1740 | !table->in_use->get_killed()) |
2120 | 1741 | sql_print_error("Got error %d when reading table '%s'", | 1741 | sql_print_error("Got error %d when reading table '%s'", |
2121 | 1742 | error, table->s->path.str); | 1742 | error, table->s->path.str); |
2122 | 1743 | table->file->print_error(error,MYF(0)); | 1743 | table->file->print_error(error,MYF(0)); |
2123 | @@ -2922,7 +2922,7 @@ | |||
2124 | 2922 | TABLE *const table= join_tab->table; | 2922 | TABLE *const table= join_tab->table; |
2125 | 2923 | DBUG_ENTER("end_write"); | 2923 | DBUG_ENTER("end_write"); |
2126 | 2924 | 2924 | ||
2128 | 2925 | if (join->thd->killed) // Aborted by user | 2925 | if (join->thd->get_killed()) // Aborted by user |
2129 | 2926 | { | 2926 | { |
2130 | 2927 | join->thd->send_kill_message(); | 2927 | join->thd->send_kill_message(); |
2131 | 2928 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ | 2928 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ |
2132 | @@ -2977,7 +2977,7 @@ | |||
2133 | 2977 | 2977 | ||
2134 | 2978 | if (end_of_records) | 2978 | if (end_of_records) |
2135 | 2979 | DBUG_RETURN(NESTED_LOOP_OK); | 2979 | DBUG_RETURN(NESTED_LOOP_OK); |
2137 | 2980 | if (join->thd->killed) // Aborted by user | 2980 | if (join->thd->get_killed()) // Aborted by user |
2138 | 2981 | { | 2981 | { |
2139 | 2982 | join->thd->send_kill_message(); | 2982 | join->thd->send_kill_message(); |
2140 | 2983 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ | 2983 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ |
2141 | @@ -3057,7 +3057,7 @@ | |||
2142 | 3057 | 3057 | ||
2143 | 3058 | if (end_of_records) | 3058 | if (end_of_records) |
2144 | 3059 | DBUG_RETURN(NESTED_LOOP_OK); | 3059 | DBUG_RETURN(NESTED_LOOP_OK); |
2146 | 3060 | if (join->thd->killed) // Aborted by user | 3060 | if (join->thd->get_killed()) // Aborted by user |
2147 | 3061 | { | 3061 | { |
2148 | 3062 | join->thd->send_kill_message(); | 3062 | join->thd->send_kill_message(); |
2149 | 3063 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ | 3063 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ |
2150 | @@ -3103,7 +3103,7 @@ | |||
2151 | 3103 | int idx= -1; | 3103 | int idx= -1; |
2152 | 3104 | DBUG_ENTER("end_write_group"); | 3104 | DBUG_ENTER("end_write_group"); |
2153 | 3105 | 3105 | ||
2155 | 3106 | if (join->thd->killed) | 3106 | if (join->thd->get_killed()) |
2156 | 3107 | { // Aborted by user | 3107 | { // Aborted by user |
2157 | 3108 | join->thd->send_kill_message(); | 3108 | join->thd->send_kill_message(); |
2158 | 3109 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ | 3109 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ |
2159 | @@ -3406,7 +3406,7 @@ | |||
2160 | 3406 | error=file->ha_rnd_next(record); | 3406 | error=file->ha_rnd_next(record); |
2161 | 3407 | for (;;) | 3407 | for (;;) |
2162 | 3408 | { | 3408 | { |
2164 | 3409 | if (thd->killed) | 3409 | if (thd->get_killed()) |
2165 | 3410 | { | 3410 | { |
2166 | 3411 | thd->send_kill_message(); | 3411 | thd->send_kill_message(); |
2167 | 3412 | error=0; | 3412 | error=0; |
2168 | @@ -3538,7 +3538,7 @@ | |||
2169 | 3538 | for (;;) | 3538 | for (;;) |
2170 | 3539 | { | 3539 | { |
2171 | 3540 | uchar *org_key_pos; | 3540 | uchar *org_key_pos; |
2173 | 3541 | if (thd->killed) | 3541 | if (thd->get_killed()) |
2174 | 3542 | { | 3542 | { |
2175 | 3543 | thd->send_kill_message(); | 3543 | thd->send_kill_message(); |
2176 | 3544 | error=0; | 3544 | error=0; |
2177 | @@ -4298,7 +4298,7 @@ | |||
2178 | 4298 | rc= NESTED_LOOP_ERROR; | 4298 | rc= NESTED_LOOP_ERROR; |
2179 | 4299 | else if (error < 0) | 4299 | else if (error < 0) |
2180 | 4300 | break; | 4300 | break; |
2182 | 4301 | else if (join->thd->killed) // Aborted by user | 4301 | else if (join->thd->get_killed()) // Aborted by user |
2183 | 4302 | { | 4302 | { |
2184 | 4303 | join->thd->send_kill_message(); | 4303 | join->thd->send_kill_message(); |
2185 | 4304 | rc= NESTED_LOOP_KILLED; | 4304 | rc= NESTED_LOOP_KILLED; |
2186 | 4305 | 4305 | ||
2187 | === modified file 'Percona-Server/sql/sql_insert.cc' | |||
2188 | --- Percona-Server/sql/sql_insert.cc 2012-12-04 08:24:59 +0000 | |||
2189 | +++ Percona-Server/sql/sql_insert.cc 2013-01-09 13:41:38 +0000 | |||
2190 | @@ -1106,7 +1106,7 @@ | |||
2191 | 1106 | thd->clear_error(); | 1106 | thd->clear_error(); |
2192 | 1107 | } | 1107 | } |
2193 | 1108 | else | 1108 | else |
2195 | 1109 | errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 1109 | errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
2196 | 1110 | 1110 | ||
2197 | 1111 | /* bug#22725: | 1111 | /* bug#22725: |
2198 | 1112 | 1112 | ||
2199 | @@ -1120,7 +1120,7 @@ | |||
2200 | 1120 | routines did not result in any error due to the KILLED. In | 1120 | routines did not result in any error due to the KILLED. In |
2201 | 1121 | such case the flag is ignored for constructing binlog event. | 1121 | such case the flag is ignored for constructing binlog event. |
2202 | 1122 | */ | 1122 | */ |
2204 | 1123 | DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0); | 1123 | DBUG_ASSERT(thd->get_killed() != THD::KILL_BAD_DATA || error > 0); |
2205 | 1124 | if (was_insert_delayed && table_list->lock_type == TL_WRITE) | 1124 | if (was_insert_delayed && table_list->lock_type == TL_WRITE) |
2206 | 1125 | { | 1125 | { |
2207 | 1126 | /* Binlog INSERT DELAYED as INSERT without DELAYED. */ | 1126 | /* Binlog INSERT DELAYED as INSERT without DELAYED. */ |
2208 | @@ -2201,7 +2201,7 @@ | |||
2209 | 2201 | if (!--locks_in_memory) | 2201 | if (!--locks_in_memory) |
2210 | 2202 | { | 2202 | { |
2211 | 2203 | mysql_mutex_lock(&mutex); | 2203 | mysql_mutex_lock(&mutex); |
2213 | 2204 | if (thd.killed && ! stacked_inserts && ! tables_in_use) | 2204 | if (thd.get_killed() && ! stacked_inserts && ! tables_in_use) |
2214 | 2205 | { | 2205 | { |
2215 | 2206 | mysql_cond_signal(&cond); | 2206 | mysql_cond_signal(&cond); |
2216 | 2207 | status=1; | 2207 | status=1; |
2217 | @@ -2370,18 +2370,18 @@ | |||
2218 | 2370 | */ | 2370 | */ |
2219 | 2371 | THD_STAGE_INFO(thd, stage_waiting_for_handler_open); | 2371 | THD_STAGE_INFO(thd, stage_waiting_for_handler_open); |
2220 | 2372 | while (!di->handler_thread_initialized || | 2372 | while (!di->handler_thread_initialized || |
2222 | 2373 | (!di->thd.killed && !di->table && !thd->killed)) | 2373 | (!di->thd.get_killed() && !di->table && !thd->get_killed())) |
2223 | 2374 | { | 2374 | { |
2224 | 2375 | mysql_cond_wait(&di->cond_client, &di->mutex); | 2375 | mysql_cond_wait(&di->cond_client, &di->mutex); |
2225 | 2376 | } | 2376 | } |
2226 | 2377 | mysql_mutex_unlock(&di->mutex); | 2377 | mysql_mutex_unlock(&di->mutex); |
2227 | 2378 | THD_STAGE_INFO(thd, stage_got_old_table); | 2378 | THD_STAGE_INFO(thd, stage_got_old_table); |
2229 | 2379 | if (thd->killed) | 2379 | if (thd->get_killed()) |
2230 | 2380 | { | 2380 | { |
2231 | 2381 | di->unlock(); | 2381 | di->unlock(); |
2232 | 2382 | goto end_create; | 2382 | goto end_create; |
2233 | 2383 | } | 2383 | } |
2235 | 2384 | if (di->thd.killed) | 2384 | if (di->thd.get_killed()) |
2236 | 2385 | { | 2385 | { |
2237 | 2386 | if (di->thd.is_error()) | 2386 | if (di->thd.is_error()) |
2238 | 2387 | { | 2387 | { |
2239 | @@ -2459,14 +2459,14 @@ | |||
2240 | 2459 | { | 2459 | { |
2241 | 2460 | THD_STAGE_INFO(client_thd, stage_waiting_for_handler_lock); | 2460 | THD_STAGE_INFO(client_thd, stage_waiting_for_handler_lock); |
2242 | 2461 | mysql_cond_signal(&cond); // Tell handler to lock table | 2461 | mysql_cond_signal(&cond); // Tell handler to lock table |
2244 | 2462 | while (!thd.killed && !thd.lock && ! client_thd->killed) | 2462 | while (!thd.get_killed() && !thd.lock && ! client_thd->get_killed()) |
2245 | 2463 | { | 2463 | { |
2246 | 2464 | mysql_cond_wait(&cond_client, &mutex); | 2464 | mysql_cond_wait(&cond_client, &mutex); |
2247 | 2465 | } | 2465 | } |
2248 | 2466 | THD_STAGE_INFO(client_thd, stage_got_handler_lock); | 2466 | THD_STAGE_INFO(client_thd, stage_got_handler_lock); |
2250 | 2467 | if (client_thd->killed) | 2467 | if (client_thd->get_killed()) |
2251 | 2468 | goto error; | 2468 | goto error; |
2253 | 2469 | if (thd.killed) | 2469 | if (thd.get_killed()) |
2254 | 2470 | { | 2470 | { |
2255 | 2471 | /* | 2471 | /* |
2256 | 2472 | Copy the error message. Note that we don't treat fatal | 2472 | Copy the error message. Note that we don't treat fatal |
2257 | @@ -2598,11 +2598,11 @@ | |||
2258 | 2598 | 2598 | ||
2259 | 2599 | THD_STAGE_INFO(thd, stage_waiting_for_handler_insert); | 2599 | THD_STAGE_INFO(thd, stage_waiting_for_handler_insert); |
2260 | 2600 | mysql_mutex_lock(&di->mutex); | 2600 | mysql_mutex_lock(&di->mutex); |
2262 | 2601 | while (di->stacked_inserts >= delayed_queue_size && !thd->killed) | 2601 | while (di->stacked_inserts >= delayed_queue_size && !thd->get_killed()) |
2263 | 2602 | mysql_cond_wait(&di->cond_client, &di->mutex); | 2602 | mysql_cond_wait(&di->cond_client, &di->mutex); |
2264 | 2603 | THD_STAGE_INFO(thd, stage_storing_row_into_queue); | 2603 | THD_STAGE_INFO(thd, stage_storing_row_into_queue); |
2265 | 2604 | 2604 | ||
2267 | 2605 | if (thd->killed) | 2605 | if (thd->get_killed()) |
2268 | 2606 | goto err; | 2606 | goto err; |
2269 | 2607 | 2607 | ||
2270 | 2608 | /* | 2608 | /* |
2271 | @@ -2652,7 +2652,7 @@ | |||
2272 | 2652 | Delayed_insert *di=thd->di; | 2652 | Delayed_insert *di=thd->di; |
2273 | 2653 | mysql_mutex_lock(&di->mutex); | 2653 | mysql_mutex_lock(&di->mutex); |
2274 | 2654 | DBUG_PRINT("info",("tables in use: %d",di->tables_in_use)); | 2654 | DBUG_PRINT("info",("tables in use: %d",di->tables_in_use)); |
2276 | 2655 | if (!--di->tables_in_use || di->thd.killed) | 2655 | if (!--di->tables_in_use || di->thd.get_killed()) |
2277 | 2656 | { // Unlock table | 2656 | { // Unlock table |
2278 | 2657 | di->status=1; | 2657 | di->status=1; |
2279 | 2658 | mysql_cond_signal(&di->cond); | 2658 | mysql_cond_signal(&di->cond); |
2280 | @@ -2672,7 +2672,7 @@ | |||
2281 | 2672 | Delayed_insert *di; | 2672 | Delayed_insert *di; |
2282 | 2673 | while ((di= it++)) | 2673 | while ((di= it++)) |
2283 | 2674 | { | 2674 | { |
2285 | 2675 | di->thd.killed= THD::KILL_CONNECTION; | 2675 | di->thd.set_killed(THD::KILL_CONNECTION); |
2286 | 2676 | if (di->thd.mysys_var) | 2676 | if (di->thd.mysys_var) |
2287 | 2677 | { | 2677 | { |
2288 | 2678 | mysql_mutex_lock(&di->thd.mysys_var->mutex); | 2678 | mysql_mutex_lock(&di->thd.mysys_var->mutex); |
2289 | @@ -2809,7 +2809,7 @@ | |||
2290 | 2809 | thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; | 2809 | thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; |
2291 | 2810 | thd->set_current_time(); | 2810 | thd->set_current_time(); |
2292 | 2811 | add_global_thread(thd); | 2811 | add_global_thread(thd); |
2294 | 2812 | thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED; | 2812 | thd->set_killed(abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED); |
2295 | 2813 | mysql_mutex_unlock(&LOCK_thread_count); | 2813 | mysql_mutex_unlock(&LOCK_thread_count); |
2296 | 2814 | 2814 | ||
2297 | 2815 | mysql_thread_set_psi_id(thd->thread_id); | 2815 | mysql_thread_set_psi_id(thd->thread_id); |
2298 | @@ -2882,7 +2882,7 @@ | |||
2299 | 2882 | 2882 | ||
2300 | 2883 | for (;;) | 2883 | for (;;) |
2301 | 2884 | { | 2884 | { |
2303 | 2885 | if (thd->killed) | 2885 | if (thd->get_killed()) |
2304 | 2886 | { | 2886 | { |
2305 | 2887 | uint lock_count; | 2887 | uint lock_count; |
2306 | 2888 | /* | 2888 | /* |
2307 | @@ -2900,7 +2900,7 @@ | |||
2308 | 2900 | } | 2900 | } |
2309 | 2901 | 2901 | ||
2310 | 2902 | /* Shouldn't wait if killed or an insert is waiting. */ | 2902 | /* Shouldn't wait if killed or an insert is waiting. */ |
2312 | 2903 | if (!thd->killed && !di->status && !di->stacked_inserts) | 2903 | if (!thd->get_killed() && !di->status && !di->stacked_inserts) |
2313 | 2904 | { | 2904 | { |
2314 | 2905 | struct timespec abstime; | 2905 | struct timespec abstime; |
2315 | 2906 | set_timespec(abstime, delayed_insert_timeout); | 2906 | set_timespec(abstime, delayed_insert_timeout); |
2316 | @@ -2911,7 +2911,7 @@ | |||
2317 | 2911 | THD_STAGE_INFO(&(di->thd), stage_waiting_for_insert); | 2911 | THD_STAGE_INFO(&(di->thd), stage_waiting_for_insert); |
2318 | 2912 | 2912 | ||
2319 | 2913 | DBUG_PRINT("info",("Waiting for someone to insert rows")); | 2913 | DBUG_PRINT("info",("Waiting for someone to insert rows")); |
2321 | 2914 | while (!thd->killed && !di->status) | 2914 | while (!thd->get_killed() && !di->status) |
2322 | 2915 | { | 2915 | { |
2323 | 2916 | int error; | 2916 | int error; |
2324 | 2917 | mysql_audit_release(thd); | 2917 | mysql_audit_release(thd); |
2325 | @@ -2929,7 +2929,7 @@ | |||
2326 | 2929 | #endif | 2929 | #endif |
2327 | 2930 | #endif | 2930 | #endif |
2328 | 2931 | if (error == ETIMEDOUT || error == ETIME) | 2931 | if (error == ETIMEDOUT || error == ETIME) |
2330 | 2932 | thd->killed= THD::KILL_CONNECTION; | 2932 | thd->set_killed(THD::KILL_CONNECTION); |
2331 | 2933 | } | 2933 | } |
2332 | 2934 | /* We can't lock di->mutex and mysys_var->mutex at the same time */ | 2934 | /* We can't lock di->mutex and mysys_var->mutex at the same time */ |
2333 | 2935 | mysql_mutex_unlock(&di->mutex); | 2935 | mysql_mutex_unlock(&di->mutex); |
2334 | @@ -2940,7 +2940,7 @@ | |||
2335 | 2940 | mysql_mutex_lock(&di->mutex); | 2940 | mysql_mutex_lock(&di->mutex); |
2336 | 2941 | } | 2941 | } |
2337 | 2942 | 2942 | ||
2339 | 2943 | if (di->tables_in_use && ! thd->lock && !thd->killed) | 2943 | if (di->tables_in_use && ! thd->lock && !thd->get_killed()) |
2340 | 2944 | { | 2944 | { |
2341 | 2945 | /* | 2945 | /* |
2342 | 2946 | Request for new delayed insert. | 2946 | Request for new delayed insert. |
2343 | @@ -2955,7 +2955,7 @@ | |||
2344 | 2955 | if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1, 0))) | 2955 | if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1, 0))) |
2345 | 2956 | { | 2956 | { |
2346 | 2957 | /* Fatal error */ | 2957 | /* Fatal error */ |
2348 | 2958 | thd->killed= THD::KILL_CONNECTION; | 2958 | thd->set_killed(THD::KILL_CONNECTION); |
2349 | 2959 | } | 2959 | } |
2350 | 2960 | mysql_cond_broadcast(&di->cond_client); | 2960 | mysql_cond_broadcast(&di->cond_client); |
2351 | 2961 | } | 2961 | } |
2352 | @@ -2964,7 +2964,7 @@ | |||
2353 | 2964 | if (di->handle_inserts()) | 2964 | if (di->handle_inserts()) |
2354 | 2965 | { | 2965 | { |
2355 | 2966 | /* Some fatal error */ | 2966 | /* Some fatal error */ |
2357 | 2967 | thd->killed= THD::KILL_CONNECTION; | 2967 | thd->set_killed(THD::KILL_CONNECTION); |
2358 | 2968 | } | 2968 | } |
2359 | 2969 | } | 2969 | } |
2360 | 2970 | di->status=0; | 2970 | di->status=0; |
2361 | @@ -2999,7 +2999,7 @@ | |||
2362 | 2999 | close_thread_tables(thd); // Free the table | 2999 | close_thread_tables(thd); // Free the table |
2363 | 3000 | thd->mdl_context.release_transactional_locks(); | 3000 | thd->mdl_context.release_transactional_locks(); |
2364 | 3001 | di->table=0; | 3001 | di->table=0; |
2366 | 3002 | thd->killed= THD::KILL_CONNECTION; // If error | 3002 | thd->set_killed(THD::KILL_CONNECTION); // If error |
2367 | 3003 | mysql_cond_broadcast(&di->cond_client); // Safety | 3003 | mysql_cond_broadcast(&di->cond_client); // Safety |
2368 | 3004 | mysql_mutex_unlock(&di->mutex); | 3004 | mysql_mutex_unlock(&di->mutex); |
2369 | 3005 | 3005 | ||
2370 | @@ -3079,9 +3079,9 @@ | |||
2371 | 3079 | 3079 | ||
2372 | 3080 | THD_STAGE_INFO(&thd, stage_insert); | 3080 | THD_STAGE_INFO(&thd, stage_insert); |
2373 | 3081 | max_rows= delayed_insert_limit; | 3081 | max_rows= delayed_insert_limit; |
2375 | 3082 | if (thd.killed || table->s->has_old_version()) | 3082 | if (thd.get_killed() || table->s->has_old_version()) |
2376 | 3083 | { | 3083 | { |
2378 | 3084 | thd.killed= THD::KILL_CONNECTION; | 3084 | thd.set_killed(THD::KILL_CONNECTION); |
2379 | 3085 | max_rows= ULONG_MAX; // Do as much as possible | 3085 | max_rows= ULONG_MAX; // Do as much as possible |
2380 | 3086 | } | 3086 | } |
2381 | 3087 | 3087 | ||
2382 | @@ -3691,7 +3691,7 @@ | |||
2383 | 3691 | bool const trans_table= table->file->has_transactions(); | 3691 | bool const trans_table= table->file->has_transactions(); |
2384 | 3692 | ulonglong id, row_count; | 3692 | ulonglong id, row_count; |
2385 | 3693 | bool changed; | 3693 | bool changed; |
2387 | 3694 | THD::killed_state killed_status= thd->killed; | 3694 | THD::killed_state killed_status= thd->get_killed(); |
2388 | 3695 | DBUG_ENTER("select_insert::send_eof"); | 3695 | DBUG_ENTER("select_insert::send_eof"); |
2389 | 3696 | DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'", | 3696 | DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'", |
2390 | 3697 | trans_table, table->file->table_type())); | 3697 | trans_table, table->file->table_type())); |
2391 | @@ -3812,7 +3812,7 @@ | |||
2392 | 3812 | { | 3812 | { |
2393 | 3813 | if (mysql_bin_log.is_open()) | 3813 | if (mysql_bin_log.is_open()) |
2394 | 3814 | { | 3814 | { |
2396 | 3815 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 3815 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
2397 | 3816 | /* error of writing binary log is ignored */ | 3816 | /* error of writing binary log is ignored */ |
2398 | 3817 | (void) thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(), | 3817 | (void) thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(), |
2399 | 3818 | thd->query_length(), | 3818 | thd->query_length(), |
2400 | @@ -4221,7 +4221,7 @@ | |||
2401 | 4221 | 4221 | ||
2402 | 4222 | if (mysql_bin_log.is_open()) | 4222 | if (mysql_bin_log.is_open()) |
2403 | 4223 | { | 4223 | { |
2405 | 4224 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 4224 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
2406 | 4225 | result= thd->binlog_query(THD::STMT_QUERY_TYPE, | 4225 | result= thd->binlog_query(THD::STMT_QUERY_TYPE, |
2407 | 4226 | query.ptr(), query.length(), | 4226 | query.ptr(), query.length(), |
2408 | 4227 | /* is_trans */ TRUE, | 4227 | /* is_trans */ TRUE, |
2409 | 4228 | 4228 | ||
2410 | === modified file 'Percona-Server/sql/sql_join_buffer.cc' | |||
2411 | --- Percona-Server/sql/sql_join_buffer.cc 2012-10-16 06:21:51 +0000 | |||
2412 | +++ Percona-Server/sql/sql_join_buffer.cc 2013-01-09 13:41:38 +0000 | |||
2413 | @@ -1839,7 +1839,7 @@ | |||
2414 | 1839 | if (join_tab->keep_current_rowid) | 1839 | if (join_tab->keep_current_rowid) |
2415 | 1840 | join_tab->table->file->position(join_tab->table->record[0]); | 1840 | join_tab->table->file->position(join_tab->table->record[0]); |
2416 | 1841 | 1841 | ||
2418 | 1842 | if (join->thd->killed) | 1842 | if (join->thd->get_killed()) |
2419 | 1843 | { | 1843 | { |
2420 | 1844 | /* The user has aborted the execution of the query */ | 1844 | /* The user has aborted the execution of the query */ |
2421 | 1845 | join->thd->send_kill_message(); | 1845 | join->thd->send_kill_message(); |
2422 | @@ -2121,7 +2121,7 @@ | |||
2423 | 2121 | 2121 | ||
2424 | 2122 | for ( ; cnt; cnt--) | 2122 | for ( ; cnt; cnt--) |
2425 | 2123 | { | 2123 | { |
2427 | 2124 | if (join->thd->killed) | 2124 | if (join->thd->get_killed()) |
2428 | 2125 | { | 2125 | { |
2429 | 2126 | /* The user has aborted the execution of the query */ | 2126 | /* The user has aborted the execution of the query */ |
2430 | 2127 | join->thd->send_kill_message(); | 2127 | join->thd->send_kill_message(); |
2431 | @@ -2331,7 +2331,7 @@ | |||
2432 | 2331 | 2331 | ||
2433 | 2332 | while (!(error= file->multi_range_read_next((char **) &rec_ptr))) | 2332 | while (!(error= file->multi_range_read_next((char **) &rec_ptr))) |
2434 | 2333 | { | 2333 | { |
2436 | 2334 | if (join->thd->killed) | 2334 | if (join->thd->get_killed()) |
2437 | 2335 | { | 2335 | { |
2438 | 2336 | /* The user has aborted the execution of the query */ | 2336 | /* The user has aborted the execution of the query */ |
2439 | 2337 | join->thd->send_kill_message(); | 2337 | join->thd->send_kill_message(); |
2440 | @@ -3261,7 +3261,7 @@ | |||
2441 | 3261 | next_rec_ref_ptr= get_next_rec_ref(next_rec_ref_ptr); | 3261 | next_rec_ref_ptr= get_next_rec_ref(next_rec_ref_ptr); |
2442 | 3262 | uchar *rec_ptr= next_rec_ref_ptr+rec_fields_offset; | 3262 | uchar *rec_ptr= next_rec_ref_ptr+rec_fields_offset; |
2443 | 3263 | 3263 | ||
2445 | 3264 | if (join->thd->killed) | 3264 | if (join->thd->get_killed()) |
2446 | 3265 | { | 3265 | { |
2447 | 3266 | /* The user has aborted the execution of the query */ | 3266 | /* The user has aborted the execution of the query */ |
2448 | 3267 | join->thd->send_kill_message(); | 3267 | join->thd->send_kill_message(); |
2449 | 3268 | 3268 | ||
2450 | === modified file 'Percona-Server/sql/sql_load.cc' | |||
2451 | --- Percona-Server/sql/sql_load.cc 2012-12-04 08:24:59 +0000 | |||
2452 | +++ Percona-Server/sql/sql_load.cc 2013-01-09 13:41:38 +0000 | |||
2453 | @@ -526,11 +526,11 @@ | |||
2454 | 526 | DBUG_EXECUTE_IF("simulate_kill_bug27571", | 526 | DBUG_EXECUTE_IF("simulate_kill_bug27571", |
2455 | 527 | { | 527 | { |
2456 | 528 | error=1; | 528 | error=1; |
2458 | 529 | thd->killed= THD::KILL_QUERY; | 529 | thd->set_killed(THD::KILL_QUERY); |
2459 | 530 | };); | 530 | };); |
2460 | 531 | 531 | ||
2461 | 532 | #ifndef EMBEDDED_LIBRARY | 532 | #ifndef EMBEDDED_LIBRARY |
2463 | 533 | killed_status= (error == 0) ? THD::NOT_KILLED : thd->killed; | 533 | killed_status= (error == 0) ? THD::NOT_KILLED : thd->get_killed(); |
2464 | 534 | #endif | 534 | #endif |
2465 | 535 | 535 | ||
2466 | 536 | /* | 536 | /* |
2467 | @@ -795,7 +795,7 @@ | |||
2468 | 795 | 795 | ||
2469 | 796 | while (!read_info.read_fixed_length()) | 796 | while (!read_info.read_fixed_length()) |
2470 | 797 | { | 797 | { |
2472 | 798 | if (thd->killed) | 798 | if (thd->get_killed()) |
2473 | 799 | { | 799 | { |
2474 | 800 | thd->send_kill_message(); | 800 | thd->send_kill_message(); |
2475 | 801 | DBUG_RETURN(1); | 801 | DBUG_RETURN(1); |
2476 | @@ -870,7 +870,7 @@ | |||
2477 | 870 | thd->get_stmt_da()->current_row_for_warning()); | 870 | thd->get_stmt_da()->current_row_for_warning()); |
2478 | 871 | } | 871 | } |
2479 | 872 | 872 | ||
2481 | 873 | if (thd->killed || | 873 | if (thd->get_killed() || |
2482 | 874 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, | 874 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, |
2483 | 875 | ignore_check_option_errors, | 875 | ignore_check_option_errors, |
2484 | 876 | table->triggers, | 876 | table->triggers, |
2485 | @@ -931,7 +931,7 @@ | |||
2486 | 931 | 931 | ||
2487 | 932 | for (;;it.rewind()) | 932 | for (;;it.rewind()) |
2488 | 933 | { | 933 | { |
2490 | 934 | if (thd->killed) | 934 | if (thd->get_killed()) |
2491 | 935 | { | 935 | { |
2492 | 936 | thd->send_kill_message(); | 936 | thd->send_kill_message(); |
2493 | 937 | DBUG_RETURN(1); | 937 | DBUG_RETURN(1); |
2494 | @@ -1080,7 +1080,7 @@ | |||
2495 | 1080 | } | 1080 | } |
2496 | 1081 | } | 1081 | } |
2497 | 1082 | 1082 | ||
2499 | 1083 | if (thd->killed || | 1083 | if (thd->get_killed() || |
2500 | 1084 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, | 1084 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, |
2501 | 1085 | ignore_check_option_errors, | 1085 | ignore_check_option_errors, |
2502 | 1086 | table->triggers, | 1086 | table->triggers, |
2503 | @@ -1112,7 +1112,7 @@ | |||
2504 | 1112 | push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, | 1112 | push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
2505 | 1113 | ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS), | 1113 | ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS), |
2506 | 1114 | thd->get_stmt_da()->current_row_for_warning()); | 1114 | thd->get_stmt_da()->current_row_for_warning()); |
2508 | 1115 | if (thd->killed) | 1115 | if (thd->get_killed()) |
2509 | 1116 | DBUG_RETURN(1); | 1116 | DBUG_RETURN(1); |
2510 | 1117 | } | 1117 | } |
2511 | 1118 | thd->get_stmt_da()->inc_current_row_for_warning(); | 1118 | thd->get_stmt_da()->inc_current_row_for_warning(); |
2512 | @@ -1140,7 +1140,7 @@ | |||
2513 | 1140 | 1140 | ||
2514 | 1141 | for ( ; ; it.rewind()) | 1141 | for ( ; ; it.rewind()) |
2515 | 1142 | { | 1142 | { |
2517 | 1143 | if (thd->killed) | 1143 | if (thd->get_killed()) |
2518 | 1144 | { | 1144 | { |
2519 | 1145 | thd->send_kill_message(); | 1145 | thd->send_kill_message(); |
2520 | 1146 | DBUG_RETURN(1); | 1146 | DBUG_RETURN(1); |
2521 | @@ -1254,7 +1254,7 @@ | |||
2522 | 1254 | } | 1254 | } |
2523 | 1255 | } | 1255 | } |
2524 | 1256 | 1256 | ||
2526 | 1257 | if (thd->killed || | 1257 | if (thd->get_killed() || |
2527 | 1258 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, | 1258 | fill_record_n_invoke_before_triggers(thd, set_fields, set_values, |
2528 | 1259 | ignore_check_option_errors, | 1259 | ignore_check_option_errors, |
2529 | 1260 | table->triggers, | 1260 | table->triggers, |
2530 | 1261 | 1261 | ||
2531 | === modified file 'Percona-Server/sql/sql_optimizer.cc' | |||
2532 | --- Percona-Server/sql/sql_optimizer.cc 2012-12-04 08:24:59 +0000 | |||
2533 | +++ Percona-Server/sql/sql_optimizer.cc 2013-01-09 13:41:38 +0000 | |||
2534 | @@ -3730,8 +3730,8 @@ | |||
2535 | 3730 | if (Optimize_table_order(thd, join, NULL).choose_table_order()) | 3730 | if (Optimize_table_order(thd, join, NULL).choose_table_order()) |
2536 | 3731 | DBUG_RETURN(true); | 3731 | DBUG_RETURN(true); |
2537 | 3732 | 3732 | ||
2540 | 3733 | DBUG_EXECUTE_IF("bug13820776_1", thd->killed= THD::KILL_QUERY;); | 3733 | DBUG_EXECUTE_IF("bug13820776_1", thd->set_killed(THD::KILL_QUERY);); |
2541 | 3734 | if (thd->killed || thd->is_error()) | 3734 | if (thd->get_killed() || thd->is_error()) |
2542 | 3735 | DBUG_RETURN(true); | 3735 | DBUG_RETURN(true); |
2543 | 3736 | 3736 | ||
2544 | 3737 | if (join->decide_subquery_strategy()) | 3737 | if (join->decide_subquery_strategy()) |
2545 | 3738 | 3738 | ||
2546 | === modified file 'Percona-Server/sql/sql_parse.cc' | |||
2547 | --- Percona-Server/sql/sql_parse.cc 2012-12-04 08:24:59 +0000 | |||
2548 | +++ Percona-Server/sql/sql_parse.cc 2013-01-09 13:41:38 +0000 | |||
2549 | @@ -942,7 +942,7 @@ | |||
2550 | 942 | /* | 942 | /* |
2551 | 943 | Synchronization point for testing of KILL_CONNECTION. | 943 | Synchronization point for testing of KILL_CONNECTION. |
2552 | 944 | This sync point can wait here, to simulate slow code execution | 944 | This sync point can wait here, to simulate slow code execution |
2554 | 945 | between the last test of thd->killed and blocking in read(). | 945 | between the last test of thd->get_killed() and blocking in read(). |
2555 | 946 | 946 | ||
2556 | 947 | The goal of this test is to verify that a connection does not | 947 | The goal of this test is to verify that a connection does not |
2557 | 948 | hang, if it is killed at this point of execution. | 948 | hang, if it is killed at this point of execution. |
2558 | @@ -1311,7 +1311,7 @@ | |||
2559 | 1311 | 1311 | ||
2560 | 1312 | mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); | 1312 | mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); |
2561 | 1313 | 1313 | ||
2563 | 1314 | while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) && | 1314 | while (!thd->get_killed() && (parser_state.m_lip.found_semicolon != NULL) && |
2564 | 1315 | ! thd->is_error()) | 1315 | ! thd->is_error()) |
2565 | 1316 | { | 1316 | { |
2566 | 1317 | /* | 1317 | /* |
2567 | @@ -1690,7 +1690,7 @@ | |||
2568 | 1690 | 1690 | ||
2569 | 1691 | /* Finalize server status flags after executing a command. */ | 1691 | /* Finalize server status flags after executing a command. */ |
2570 | 1692 | thd->update_server_status(); | 1692 | thd->update_server_status(); |
2572 | 1693 | if (thd->killed) | 1693 | if (thd->get_killed()) |
2573 | 1694 | thd->send_kill_message(); | 1694 | thd->send_kill_message(); |
2574 | 1695 | thd->protocol->end_statement(); | 1695 | thd->protocol->end_statement(); |
2575 | 1696 | query_cache_end_of_result(thd); | 1696 | query_cache_end_of_result(thd); |
2576 | @@ -4179,7 +4179,7 @@ | |||
2577 | 4179 | } | 4179 | } |
2578 | 4180 | /* Disconnect the current client connection. */ | 4180 | /* Disconnect the current client connection. */ |
2579 | 4181 | if (tx_release) | 4181 | if (tx_release) |
2581 | 4182 | thd->killed= THD::KILL_CONNECTION; | 4182 | thd->set_killed(THD::KILL_CONNECTION); |
2582 | 4183 | my_ok(thd); | 4183 | my_ok(thd); |
2583 | 4184 | break; | 4184 | break; |
2584 | 4185 | } | 4185 | } |
2585 | @@ -4210,7 +4210,7 @@ | |||
2586 | 4210 | } | 4210 | } |
2587 | 4211 | /* Disconnect the current client connection. */ | 4211 | /* Disconnect the current client connection. */ |
2588 | 4212 | if (tx_release) | 4212 | if (tx_release) |
2590 | 4213 | thd->killed= THD::KILL_CONNECTION; | 4213 | thd->set_killed(THD::KILL_CONNECTION); |
2591 | 4214 | my_ok(thd); | 4214 | my_ok(thd); |
2592 | 4215 | break; | 4215 | break; |
2593 | 4216 | } | 4216 | } |
2594 | @@ -4469,7 +4469,7 @@ | |||
2595 | 4469 | } | 4469 | } |
2596 | 4470 | else | 4470 | else |
2597 | 4471 | { | 4471 | { |
2599 | 4472 | DBUG_ASSERT(thd->is_error() || thd->killed); | 4472 | DBUG_ASSERT(thd->is_error() || thd->get_killed()); |
2600 | 4473 | goto error; // Substatement should already have sent error | 4473 | goto error; // Substatement should already have sent error |
2601 | 4474 | } | 4474 | } |
2602 | 4475 | } | 4475 | } |
2603 | @@ -4495,7 +4495,7 @@ | |||
2604 | 4495 | /* Conditionally writes to binlog */ | 4495 | /* Conditionally writes to binlog */ |
2605 | 4496 | int sp_result= sp_update_routine(thd, sp_type, lex->spname, | 4496 | int sp_result= sp_update_routine(thd, sp_type, lex->spname, |
2606 | 4497 | &lex->sp_chistics); | 4497 | &lex->sp_chistics); |
2608 | 4498 | if (thd->killed) | 4498 | if (thd->get_killed()) |
2609 | 4499 | goto error; | 4499 | goto error; |
2610 | 4500 | switch (sp_result) | 4500 | switch (sp_result) |
2611 | 4501 | { | 4501 | { |
2612 | @@ -4808,7 +4808,7 @@ | |||
2613 | 4808 | drop_server() can fail without reporting an error | 4808 | drop_server() can fail without reporting an error |
2614 | 4809 | due to IF EXISTS clause. In this case, call my_ok(). | 4809 | due to IF EXISTS clause. In this case, call my_ok(). |
2615 | 4810 | */ | 4810 | */ |
2617 | 4811 | if (thd->is_error() || thd->killed) | 4811 | if (thd->is_error() || thd->get_killed()) |
2618 | 4812 | goto error; | 4812 | goto error; |
2619 | 4813 | DBUG_ASSERT(lex->drop_if_exists); | 4813 | DBUG_ASSERT(lex->drop_if_exists); |
2620 | 4814 | my_ok(thd, 0); | 4814 | my_ok(thd, 0); |
2621 | @@ -4883,9 +4883,9 @@ | |||
2622 | 4883 | /* report error issued during command execution */ | 4883 | /* report error issued during command execution */ |
2623 | 4884 | if (thd->killed_errno()) | 4884 | if (thd->killed_errno()) |
2624 | 4885 | thd->send_kill_message(); | 4885 | thd->send_kill_message(); |
2626 | 4886 | if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA) | 4886 | if (thd->get_killed() == THD::KILL_QUERY || thd->get_killed() == THD::KILL_BAD_DATA) |
2627 | 4887 | { | 4887 | { |
2629 | 4888 | thd->killed= THD::NOT_KILLED; | 4888 | thd->set_killed(THD::NOT_KILLED); |
2630 | 4889 | thd->mysys_var->abort= 0; | 4889 | thd->mysys_var->abort= 0; |
2631 | 4890 | } | 4890 | } |
2632 | 4891 | if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR)) | 4891 | if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR)) |
2633 | @@ -6096,7 +6096,15 @@ | |||
2634 | 6096 | error= 1; | 6096 | error= 1; |
2635 | 6097 | } | 6097 | } |
2636 | 6098 | else | 6098 | else |
2638 | 6099 | error= mysql_execute_command(thd); | 6099 | { |
2639 | 6100 | if (thd->variables.sql_timeout) | ||
2640 | 6101 | thd->sql_timeout_expire= my_micro_time() + | ||
2641 | 6102 | (ulonglong)thd->variables.sql_timeout*1000000; | ||
2642 | 6103 | |||
2643 | 6104 | error= mysql_execute_command(thd); | ||
2644 | 6105 | |||
2645 | 6106 | thd->sql_timeout_expire= 0; | ||
2646 | 6107 | } | ||
2647 | 6100 | if (error == 0 && | 6108 | if (error == 0 && |
2648 | 6101 | thd->variables.gtid_next.type == GTID_GROUP && | 6109 | thd->variables.gtid_next.type == GTID_GROUP && |
2649 | 6102 | thd->owned_gtid.sidno != 0 && | 6110 | thd->owned_gtid.sidno != 0 && |
2650 | @@ -7009,7 +7017,7 @@ | |||
2651 | 7009 | uint error; | 7017 | uint error; |
2652 | 7010 | if (!(error= kill_one_thread(thd, id, only_kill_query))) | 7018 | if (!(error= kill_one_thread(thd, id, only_kill_query))) |
2653 | 7011 | { | 7019 | { |
2655 | 7012 | if (! thd->killed) | 7020 | if (! thd->get_killed()) |
2656 | 7013 | my_ok(thd); | 7021 | my_ok(thd); |
2657 | 7014 | } | 7022 | } |
2658 | 7015 | else | 7023 | else |
2659 | 7016 | 7024 | ||
2660 | === modified file 'Percona-Server/sql/sql_planner.cc' | |||
2661 | --- Percona-Server/sql/sql_planner.cc 2012-10-16 06:21:51 +0000 | |||
2662 | +++ Percona-Server/sql/sql_planner.cc 2013-01-09 13:41:38 +0000 | |||
2663 | @@ -1768,8 +1768,8 @@ | |||
2664 | 1768 | { | 1768 | { |
2665 | 1769 | DBUG_ENTER("Optimize_table_order::best_extension_by_limited_search"); | 1769 | DBUG_ENTER("Optimize_table_order::best_extension_by_limited_search"); |
2666 | 1770 | 1770 | ||
2669 | 1771 | DBUG_EXECUTE_IF("bug13820776_2", thd->killed= THD::KILL_QUERY;); | 1771 | DBUG_EXECUTE_IF("bug13820776_2", thd->set_killed(THD::KILL_QUERY);); |
2670 | 1772 | if (thd->killed) // Abort | 1772 | if (thd->get_killed()) // Abort |
2671 | 1773 | DBUG_RETURN(true); | 1773 | DBUG_RETURN(true); |
2672 | 1774 | Opt_trace_context * const trace= &thd->opt_trace; | 1774 | Opt_trace_context * const trace= &thd->opt_trace; |
2673 | 1775 | 1775 | ||
2674 | 1776 | 1776 | ||
2675 | === modified file 'Percona-Server/sql/sql_prepare.cc' | |||
2676 | --- Percona-Server/sql/sql_prepare.cc 2012-12-04 08:24:59 +0000 | |||
2677 | +++ Percona-Server/sql/sql_prepare.cc 2013-01-09 13:41:38 +0000 | |||
2678 | @@ -3553,7 +3553,7 @@ | |||
2679 | 3553 | thd->pop_reprepare_observer(); | 3553 | thd->pop_reprepare_observer(); |
2680 | 3554 | 3554 | ||
2681 | 3555 | if ((sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) && | 3555 | if ((sql_command_flags[lex->sql_command] & CF_REEXECUTION_FRAGILE) && |
2683 | 3556 | error && !thd->is_fatal_error && !thd->killed && | 3556 | error && !thd->is_fatal_error && !thd->get_killed() && |
2684 | 3557 | reprepare_observer.is_invalidated() && | 3557 | reprepare_observer.is_invalidated() && |
2685 | 3558 | reprepare_attempt++ < MAX_REPREPARE_ATTEMPTS) | 3558 | reprepare_attempt++ < MAX_REPREPARE_ATTEMPTS) |
2686 | 3559 | { | 3559 | { |
2687 | 3560 | 3560 | ||
2688 | === modified file 'Percona-Server/sql/sql_reload.cc' | |||
2689 | --- Percona-Server/sql/sql_reload.cc 2012-08-22 01:40:20 +0000 | |||
2690 | +++ Percona-Server/sql/sql_reload.cc 2013-01-09 13:41:38 +0000 | |||
2691 | @@ -50,7 +50,7 @@ | |||
2692 | 50 | 50 | ||
2693 | 51 | @return Error status code | 51 | @return Error status code |
2694 | 52 | @retval 0 Ok | 52 | @retval 0 Ok |
2696 | 53 | @retval !=0 Error; thd->killed is set or thd->is_error() is true | 53 | @retval !=0 Error; thd->get_killed() is set or thd->is_error() is true |
2697 | 54 | */ | 54 | */ |
2698 | 55 | 55 | ||
2699 | 56 | bool reload_acl_and_cache(THD *thd, unsigned long options, | 56 | bool reload_acl_and_cache(THD *thd, unsigned long options, |
2700 | @@ -340,7 +340,7 @@ | |||
2701 | 340 | /* | 340 | /* |
2702 | 341 | If the query was killed then this function must fail. | 341 | If the query was killed then this function must fail. |
2703 | 342 | */ | 342 | */ |
2705 | 343 | return result || (thd ? thd->killed : 0); | 343 | return result || (thd ? thd->get_killed() : 0); |
2706 | 344 | } | 344 | } |
2707 | 345 | 345 | ||
2708 | 346 | 346 | ||
2709 | 347 | 347 | ||
2710 | === modified file 'Percona-Server/sql/sql_servers.cc' | |||
2711 | --- Percona-Server/sql/sql_servers.cc 2012-07-30 13:28:51 +0000 | |||
2712 | +++ Percona-Server/sql/sql_servers.cc 2013-01-09 13:41:38 +0000 | |||
2713 | @@ -607,7 +607,7 @@ | |||
2714 | 607 | } | 607 | } |
2715 | 608 | 608 | ||
2716 | 609 | mysql_rwlock_unlock(&THR_LOCK_servers); | 609 | mysql_rwlock_unlock(&THR_LOCK_servers); |
2718 | 610 | DBUG_RETURN(error || thd->killed); | 610 | DBUG_RETURN(error || thd->get_killed()); |
2719 | 611 | } | 611 | } |
2720 | 612 | 612 | ||
2721 | 613 | 613 | ||
2722 | @@ -936,7 +936,7 @@ | |||
2723 | 936 | 936 | ||
2724 | 937 | end: | 937 | end: |
2725 | 938 | mysql_rwlock_unlock(&THR_LOCK_servers); | 938 | mysql_rwlock_unlock(&THR_LOCK_servers); |
2727 | 939 | DBUG_RETURN(error || thd->killed); | 939 | DBUG_RETURN(error || thd->get_killed()); |
2728 | 940 | } | 940 | } |
2729 | 941 | 941 | ||
2730 | 942 | 942 | ||
2731 | @@ -984,7 +984,7 @@ | |||
2732 | 984 | 984 | ||
2733 | 985 | end: | 985 | end: |
2734 | 986 | mysql_rwlock_unlock(&THR_LOCK_servers); | 986 | mysql_rwlock_unlock(&THR_LOCK_servers); |
2736 | 987 | DBUG_RETURN(error || thd->killed); | 987 | DBUG_RETURN(error || thd->get_killed()); |
2737 | 988 | } | 988 | } |
2738 | 989 | 989 | ||
2739 | 990 | 990 | ||
2740 | 991 | 991 | ||
2741 | === modified file 'Percona-Server/sql/sql_show.cc' | |||
2742 | --- Percona-Server/sql/sql_show.cc 2012-12-04 08:24:59 +0000 | |||
2743 | +++ Percona-Server/sql/sql_show.cc 2013-01-09 13:41:38 +0000 | |||
2744 | @@ -859,7 +859,7 @@ | |||
2745 | 859 | MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) || | 859 | MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) || |
2746 | 860 | mysql_handle_derived(thd->lex, &mysql_derived_prepare); | 860 | mysql_handle_derived(thd->lex, &mysql_derived_prepare); |
2747 | 861 | thd->pop_internal_handler(); | 861 | thd->pop_internal_handler(); |
2749 | 862 | if (open_error && (thd->killed || thd->is_error())) | 862 | if (open_error && (thd->get_killed() || thd->is_error())) |
2750 | 863 | goto exit; | 863 | goto exit; |
2751 | 864 | } | 864 | } |
2752 | 865 | 865 | ||
2753 | @@ -2040,7 +2040,7 @@ | |||
2754 | 2040 | Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) | 2040 | Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) |
2755 | 2041 | DBUG_VOID_RETURN; | 2041 | DBUG_VOID_RETURN; |
2756 | 2042 | 2042 | ||
2758 | 2043 | if (!thd->killed) | 2043 | if (!thd->get_killed()) |
2759 | 2044 | { | 2044 | { |
2760 | 2045 | mysql_mutex_lock(&LOCK_thread_count); | 2045 | mysql_mutex_lock(&LOCK_thread_count); |
2761 | 2046 | Thread_iterator it= global_thread_list_begin(); | 2046 | Thread_iterator it= global_thread_list_begin(); |
2762 | @@ -2076,7 +2076,7 @@ | |||
2763 | 2076 | mysql_mutex_lock(&tmp->LOCK_thd_data); | 2076 | mysql_mutex_lock(&tmp->LOCK_thd_data); |
2764 | 2077 | if ((mysys_var= tmp->mysys_var)) | 2077 | if ((mysys_var= tmp->mysys_var)) |
2765 | 2078 | mysql_mutex_lock(&mysys_var->mutex); | 2078 | mysql_mutex_lock(&mysys_var->mutex); |
2767 | 2079 | thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0); | 2079 | thd_info->proc_info= (char*) (tmp->get_killed() == THD::KILL_CONNECTION? "Killed" : 0); |
2768 | 2080 | thd_info->state_info= thread_state_info(tmp); | 2080 | thd_info->state_info= thread_state_info(tmp); |
2769 | 2081 | if (mysys_var) | 2081 | if (mysys_var) |
2770 | 2082 | mysql_mutex_unlock(&mysys_var->mutex); | 2082 | mysql_mutex_unlock(&mysys_var->mutex); |
2771 | @@ -2137,7 +2137,7 @@ | |||
2772 | 2137 | user= thd->security_ctx->master_access & PROCESS_ACL ? | 2137 | user= thd->security_ctx->master_access & PROCESS_ACL ? |
2773 | 2138 | NullS : thd->security_ctx->priv_user; | 2138 | NullS : thd->security_ctx->priv_user; |
2774 | 2139 | 2139 | ||
2776 | 2140 | if (!thd->killed) | 2140 | if (!thd->get_killed()) |
2777 | 2141 | { | 2141 | { |
2778 | 2142 | mysql_mutex_lock(&LOCK_thread_count); | 2142 | mysql_mutex_lock(&LOCK_thread_count); |
2779 | 2143 | Thread_iterator it= global_thread_list_begin(); | 2143 | Thread_iterator it= global_thread_list_begin(); |
2780 | @@ -2183,7 +2183,7 @@ | |||
2781 | 2183 | if ((mysys_var= tmp->mysys_var)) | 2183 | if ((mysys_var= tmp->mysys_var)) |
2782 | 2184 | mysql_mutex_lock(&mysys_var->mutex); | 2184 | mysql_mutex_lock(&mysys_var->mutex); |
2783 | 2185 | /* COMMAND */ | 2185 | /* COMMAND */ |
2785 | 2186 | if ((val= (char *) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0))) | 2186 | if ((val= (char *) (tmp->get_killed() == THD::KILL_CONNECTION? "Killed" : 0))) |
2786 | 2187 | table->field[4]->store(val, strlen(val), cs); | 2187 | table->field[4]->store(val, strlen(val), cs); |
2787 | 2188 | else | 2188 | else |
2788 | 2189 | table->field[4]->store(command_name[tmp->get_command()].str, | 2189 | table->field[4]->store(command_name[tmp->get_command()].str, |
2789 | 2190 | 2190 | ||
2790 | === modified file 'Percona-Server/sql/sql_table.cc' | |||
2791 | --- Percona-Server/sql/sql_table.cc 2012-12-04 08:24:59 +0000 | |||
2792 | +++ Percona-Server/sql/sql_table.cc 2013-01-09 13:41:38 +0000 | |||
2793 | @@ -2335,7 +2335,7 @@ | |||
2794 | 2335 | DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, | 2335 | DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db, |
2795 | 2336 | table->table_name, | 2336 | table->table_name, |
2796 | 2337 | MDL_EXCLUSIVE)); | 2337 | MDL_EXCLUSIVE)); |
2798 | 2338 | if (thd->killed) | 2338 | if (thd->get_killed()) |
2799 | 2339 | { | 2339 | { |
2800 | 2340 | error= -1; | 2340 | error= -1; |
2801 | 2341 | goto err; | 2341 | goto err; |
2802 | @@ -8513,7 +8513,7 @@ | |||
2803 | 8513 | restore_record(to, s->default_values); // Create empty record | 8513 | restore_record(to, s->default_values); // Create empty record |
2804 | 8514 | while (!(error=info.read_record(&info))) | 8514 | while (!(error=info.read_record(&info))) |
2805 | 8515 | { | 8515 | { |
2807 | 8516 | if (thd->killed) | 8516 | if (thd->get_killed()) |
2808 | 8517 | { | 8517 | { |
2809 | 8518 | thd->send_kill_message(); | 8518 | thd->send_kill_message(); |
2810 | 8519 | error= 1; | 8519 | error= 1; |
2811 | @@ -8760,7 +8760,7 @@ | |||
2812 | 8760 | { | 8760 | { |
2813 | 8761 | for (;;) | 8761 | for (;;) |
2814 | 8762 | { | 8762 | { |
2816 | 8763 | if (thd->killed) | 8763 | if (thd->get_killed()) |
2817 | 8764 | { | 8764 | { |
2818 | 8765 | /* | 8765 | /* |
2819 | 8766 | we've been killed; let handler clean up, and remove the | 8766 | we've been killed; let handler clean up, and remove the |
2820 | 8767 | 8767 | ||
2821 | === modified file 'Percona-Server/sql/sql_update.cc' | |||
2822 | --- Percona-Server/sql/sql_update.cc 2012-12-04 08:24:59 +0000 | |||
2823 | +++ Percona-Server/sql/sql_update.cc 2013-01-09 13:41:38 +0000 | |||
2824 | @@ -622,7 +622,7 @@ | |||
2825 | 622 | THD_STAGE_INFO(thd, stage_searching_rows_for_update); | 622 | THD_STAGE_INFO(thd, stage_searching_rows_for_update); |
2826 | 623 | ha_rows tmp_limit= limit; | 623 | ha_rows tmp_limit= limit; |
2827 | 624 | 624 | ||
2829 | 625 | while (!(error=info.read_record(&info)) && !thd->killed) | 625 | while (!(error=info.read_record(&info)) && !thd->get_killed()) |
2830 | 626 | { | 626 | { |
2831 | 627 | thd->inc_examined_row_count(1); | 627 | thd->inc_examined_row_count(1); |
2832 | 628 | bool skip_record= FALSE; | 628 | bool skip_record= FALSE; |
2833 | @@ -653,7 +653,7 @@ | |||
2834 | 653 | else | 653 | else |
2835 | 654 | table->file->unlock_row(); | 654 | table->file->unlock_row(); |
2836 | 655 | } | 655 | } |
2838 | 656 | if (thd->killed && !error) | 656 | if (thd->get_killed() && !error) |
2839 | 657 | error= 1; // Aborted | 657 | error= 1; // Aborted |
2840 | 658 | limit= tmp_limit; | 658 | limit= tmp_limit; |
2841 | 659 | table->file->try_semi_consistent_read(0); | 659 | table->file->try_semi_consistent_read(0); |
2842 | @@ -724,7 +724,7 @@ | |||
2843 | 724 | check_constant_expressions(values)) | 724 | check_constant_expressions(values)) |
2844 | 725 | read_removal= table->check_read_removal(select->quick->index); | 725 | read_removal= table->check_read_removal(select->quick->index); |
2845 | 726 | 726 | ||
2847 | 727 | while (!(error=info.read_record(&info)) && !thd->killed) | 727 | while (!(error=info.read_record(&info)) && !thd->get_killed()) |
2848 | 728 | { | 728 | { |
2849 | 729 | thd->inc_examined_row_count(1); | 729 | thd->inc_examined_row_count(1); |
2850 | 730 | bool skip_record; | 730 | bool skip_record; |
2851 | @@ -897,11 +897,11 @@ | |||
2852 | 897 | It's assumed that if an error was set in combination with an effective | 897 | It's assumed that if an error was set in combination with an effective |
2853 | 898 | killed status then the error is due to killing. | 898 | killed status then the error is due to killing. |
2854 | 899 | */ | 899 | */ |
2856 | 900 | killed_status= thd->killed; // get the status of the volatile | 900 | killed_status= thd->get_killed(); // get the status of the volatile |
2857 | 901 | // simulated killing after the loop must be ineffective for binlogging | 901 | // simulated killing after the loop must be ineffective for binlogging |
2858 | 902 | DBUG_EXECUTE_IF("simulate_kill_bug27571", | 902 | DBUG_EXECUTE_IF("simulate_kill_bug27571", |
2859 | 903 | { | 903 | { |
2861 | 904 | thd->killed= THD::KILL_QUERY; | 904 | thd->set_killed(THD::KILL_QUERY); |
2862 | 905 | };); | 905 | };); |
2863 | 906 | error= (killed_status == THD::NOT_KILLED)? error : 1; | 906 | error= (killed_status == THD::NOT_KILLED)? error : 1; |
2864 | 907 | 907 | ||
2865 | @@ -2185,7 +2185,7 @@ | |||
2866 | 2185 | got caught and if happens later the killed error is written | 2185 | got caught and if happens later the killed error is written |
2867 | 2186 | into repl event. | 2186 | into repl event. |
2868 | 2187 | */ | 2187 | */ |
2870 | 2188 | int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); | 2188 | int errcode= query_error_code(thd, thd->get_killed() == THD::NOT_KILLED); |
2871 | 2189 | /* the error of binary logging is ignored */ | 2189 | /* the error of binary logging is ignored */ |
2872 | 2190 | (void)thd->binlog_query(THD::ROW_QUERY_TYPE, | 2190 | (void)thd->binlog_query(THD::ROW_QUERY_TYPE, |
2873 | 2191 | thd->query(), thd->query_length(), | 2191 | thd->query(), thd->query_length(), |
2874 | @@ -2249,7 +2249,7 @@ | |||
2875 | 2249 | 2249 | ||
2876 | 2250 | for (;;) | 2250 | for (;;) |
2877 | 2251 | { | 2251 | { |
2879 | 2252 | if (thd->killed && trans_safe) | 2252 | if (thd->get_killed() && trans_safe) |
2880 | 2253 | goto err; | 2253 | goto err; |
2881 | 2254 | if ((local_error=tmp_table->file->ha_rnd_next(tmp_table->record[0]))) | 2254 | if ((local_error=tmp_table->file->ha_rnd_next(tmp_table->record[0]))) |
2882 | 2255 | { | 2255 | { |
2883 | @@ -2389,7 +2389,7 @@ | |||
2884 | 2389 | if local_error is not set ON until after do_updates() then | 2389 | if local_error is not set ON until after do_updates() then |
2885 | 2390 | later carried out killing should not affect binlogging. | 2390 | later carried out killing should not affect binlogging. |
2886 | 2391 | */ | 2391 | */ |
2888 | 2392 | killed_status= (local_error == 0)? THD::NOT_KILLED : thd->killed; | 2392 | killed_status= (local_error == 0)? THD::NOT_KILLED : thd->get_killed(); |
2889 | 2393 | THD_STAGE_INFO(thd, stage_end); | 2393 | THD_STAGE_INFO(thd, stage_end); |
2890 | 2394 | 2394 | ||
2891 | 2395 | /* We must invalidate the query cache before binlog writing and | 2395 | /* We must invalidate the query cache before binlog writing and |
2892 | 2396 | 2396 | ||
2893 | === modified file 'Percona-Server/sql/sys_vars.cc' | |||
2894 | --- Percona-Server/sql/sys_vars.cc 2012-12-04 08:24:59 +0000 | |||
2895 | +++ Percona-Server/sql/sys_vars.cc 2013-01-09 13:41:38 +0000 | |||
2896 | @@ -3519,6 +3519,12 @@ | |||
2897 | 3519 | SESSION_VAR(group_concat_max_len), CMD_LINE(REQUIRED_ARG), | 3519 | SESSION_VAR(group_concat_max_len), CMD_LINE(REQUIRED_ARG), |
2898 | 3520 | VALID_RANGE(4, ULONG_MAX), DEFAULT(1024), BLOCK_SIZE(1)); | 3520 | VALID_RANGE(4, ULONG_MAX), DEFAULT(1024), BLOCK_SIZE(1)); |
2899 | 3521 | 3521 | ||
2900 | 3522 | static Sys_var_ulong Sys_sql_timeout( | ||
2901 | 3523 | "sql_timeout", | ||
2902 | 3524 | "Timeout in seconds to wait before killing query.", | ||
2903 | 3525 | SESSION_VAR(sql_timeout), CMD_LINE(REQUIRED_ARG), | ||
2904 | 3526 | VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1)); | ||
2905 | 3527 | |||
2906 | 3522 | static char *glob_hostname_ptr; | 3528 | static char *glob_hostname_ptr; |
2907 | 3523 | static Sys_var_charptr Sys_hostname( | 3529 | static Sys_var_charptr Sys_hostname( |
2908 | 3524 | "hostname", "Server host name", | 3530 | "hostname", "Server host name", |
2909 | 3525 | 3531 | ||
2910 | === modified file 'Percona-Server/sql/table.cc' | |||
2911 | --- Percona-Server/sql/table.cc 2012-12-04 08:24:59 +0000 | |||
2912 | +++ Percona-Server/sql/table.cc 2013-01-09 13:41:38 +0000 | |||
2913 | @@ -3941,7 +3941,7 @@ | |||
2914 | 3941 | 3941 | ||
2915 | 3942 | void TABLE_LIST::hide_view_error(THD *thd) | 3942 | void TABLE_LIST::hide_view_error(THD *thd) |
2916 | 3943 | { | 3943 | { |
2918 | 3944 | if (thd->killed || thd->get_internal_handler()) | 3944 | if (thd->get_killed() || thd->get_internal_handler()) |
2919 | 3945 | return; | 3945 | return; |
2920 | 3946 | /* Hide "Unknown column" or "Unknown function" error */ | 3946 | /* Hide "Unknown column" or "Unknown function" error */ |
2921 | 3947 | DBUG_ASSERT(thd->is_error()); | 3947 | DBUG_ASSERT(thd->is_error()); |
2922 | 3948 | 3948 | ||
2923 | === modified file 'Percona-Server/storage/innobase/row/row0mysql.cc' | |||
2924 | --- Percona-Server/storage/innobase/row/row0mysql.cc 2012-12-17 22:22:38 +0000 | |||
2925 | +++ Percona-Server/storage/innobase/row/row0mysql.cc 2013-01-09 13:41:38 +0000 | |||
2926 | @@ -5062,7 +5062,7 @@ | |||
2927 | 5062 | 5062 | ||
2928 | 5063 | ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0); | 5063 | ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0); |
2929 | 5064 | loop: | 5064 | loop: |
2931 | 5065 | /* Check thd->killed every 1,000 scanned rows */ | 5065 | /* Check thd->get_killed() every 1,000 scanned rows */ |
2932 | 5066 | if (--cnt == 0) { | 5066 | if (--cnt == 0) { |
2933 | 5067 | if (trx_is_interrupted(prebuilt->trx)) { | 5067 | if (trx_is_interrupted(prebuilt->trx)) { |
2934 | 5068 | goto func_exit; | 5068 | goto func_exit; |
2935 | 5069 | 5069 | ||
2936 | === modified file 'Percona-Server/storage/myisam/ha_myisam.cc' | |||
2937 | --- Percona-Server/storage/myisam/ha_myisam.cc 2012-10-16 06:21:51 +0000 | |||
2938 | +++ Percona-Server/storage/myisam/ha_myisam.cc 2013-01-09 13:41:38 +0000 | |||
2939 | @@ -118,7 +118,7 @@ | |||
2940 | 118 | THD *thd; | 118 | THD *thd; |
2941 | 119 | thd= current_thd; | 119 | thd= current_thd; |
2942 | 120 | prev_info= thd_proc_info(thd, info); | 120 | prev_info= thd_proc_info(thd, info); |
2944 | 121 | while(!thd->killed) | 121 | while(!thd->get_killed()) |
2945 | 122 | my_sleep(1000); | 122 | my_sleep(1000); |
2946 | 123 | DBUG_PRINT("info", ("Exit debug_wait_for_kill")); | 123 | DBUG_PRINT("info", ("Exit debug_wait_for_kill")); |
2947 | 124 | thd_proc_info(thd, prev_info); | 124 | thd_proc_info(thd, prev_info); |
2948 | @@ -562,10 +562,10 @@ | |||
2949 | 562 | 562 | ||
2950 | 563 | extern "C" { | 563 | extern "C" { |
2951 | 564 | 564 | ||
2953 | 565 | volatile int *killed_ptr(MI_CHECK *param) | 565 | int killed_status(MI_CHECK *param) |
2954 | 566 | { | 566 | { |
2955 | 567 | /* In theory Unsafe conversion, but should be ok for now */ | 567 | /* In theory Unsafe conversion, but should be ok for now */ |
2957 | 568 | return (int*) &(((THD *)(param->thd))->killed); | 568 | return (int) (((THD *)(param->thd))->get_killed()); |
2958 | 569 | } | 569 | } |
2959 | 570 | 570 | ||
2960 | 571 | void mi_check_print_error(MI_CHECK *param, const char *fmt,...) | 571 | void mi_check_print_error(MI_CHECK *param, const char *fmt,...) |
2961 | @@ -902,7 +902,7 @@ | |||
2962 | 902 | HA_STATUS_CONST); | 902 | HA_STATUS_CONST); |
2963 | 903 | } | 903 | } |
2964 | 904 | } | 904 | } |
2966 | 905 | else if (!mi_is_crashed(file) && !thd->killed) | 905 | else if (!mi_is_crashed(file) && !thd->get_killed()) |
2967 | 906 | { | 906 | { |
2968 | 907 | mi_mark_crashed(file); | 907 | mi_mark_crashed(file); |
2969 | 908 | file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; | 908 | file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; |
2970 | @@ -945,7 +945,7 @@ | |||
2971 | 945 | error=update_state_info(¶m,file,UPDATE_STAT); | 945 | error=update_state_info(¶m,file,UPDATE_STAT); |
2972 | 946 | mysql_mutex_unlock(&share->intern_lock); | 946 | mysql_mutex_unlock(&share->intern_lock); |
2973 | 947 | } | 947 | } |
2975 | 948 | else if (!mi_is_crashed(file) && !thd->killed) | 948 | else if (!mi_is_crashed(file) && !thd->get_killed()) |
2976 | 949 | mi_mark_crashed(file); | 949 | mi_mark_crashed(file); |
2977 | 950 | return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; | 950 | return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; |
2978 | 951 | } | 951 | } |
2979 | @@ -1537,7 +1537,7 @@ | |||
2980 | 1537 | */ | 1537 | */ |
2981 | 1538 | 1538 | ||
2982 | 1539 | if (((err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) && | 1539 | if (((err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) && |
2984 | 1540 | current_thd->killed) | 1540 | current_thd->get_killed()) |
2985 | 1541 | { | 1541 | { |
2986 | 1542 | delete_all_rows(); | 1542 | delete_all_rows(); |
2987 | 1543 | /* not crashed, despite being killed during repair */ | 1543 | /* not crashed, despite being killed during repair */ |
2988 | 1544 | 1544 | ||
2989 | === modified file 'Percona-Server/storage/myisam/mi_check.c' | |||
2990 | --- Percona-Server/storage/myisam/mi_check.c 2012-09-12 14:19:10 +0000 | |||
2991 | +++ Percona-Server/storage/myisam/mi_check.c 2013-01-09 13:41:38 +0000 | |||
2992 | @@ -164,7 +164,7 @@ | |||
2993 | 164 | empty=0; | 164 | empty=0; |
2994 | 165 | for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--) | 165 | for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--) |
2995 | 166 | { | 166 | { |
2997 | 167 | if (*killed_ptr(param)) | 167 | if (killed_status(param)) |
2998 | 168 | DBUG_RETURN(1); | 168 | DBUG_RETURN(1); |
2999 | 169 | if (test_flag & T_VERBOSE) | 169 | if (test_flag & T_VERBOSE) |
3000 | 170 | printf(" %9s",llstr(next_link,buff)); | 170 | printf(" %9s",llstr(next_link,buff)); |
3001 | @@ -259,7 +259,7 @@ | |||
3002 | 259 | records= (ha_rows) (info->state->key_file_length / block_size); | 259 | records= (ha_rows) (info->state->key_file_length / block_size); |
3003 | 260 | while (next_link != HA_OFFSET_ERROR && records > 0) | 260 | while (next_link != HA_OFFSET_ERROR && records > 0) |
3004 | 261 | { | 261 | { |
3006 | 262 | if (*killed_ptr(param)) | 262 | if (killed_status(param)) |
3007 | 263 | DBUG_RETURN(1); | 263 | DBUG_RETURN(1); |
3008 | 264 | if (param->testflag & T_VERBOSE) | 264 | if (param->testflag & T_VERBOSE) |
3009 | 265 | printf("%16s",llstr(next_link,llbuff)); | 265 | printf("%16s",llstr(next_link,llbuff)); |
3010 | @@ -773,7 +773,7 @@ | |||
3011 | 773 | } | 773 | } |
3012 | 774 | for ( ;; ) | 774 | for ( ;; ) |
3013 | 775 | { | 775 | { |
3015 | 776 | if (*killed_ptr(param)) | 776 | if (killed_status(param)) |
3016 | 777 | goto err; | 777 | goto err; |
3017 | 778 | memcpy((char*) info->lastkey,(char*) key,key_length); | 778 | memcpy((char*) info->lastkey,(char*) key,key_length); |
3018 | 779 | info->lastkey_length=key_length; | 779 | info->lastkey_length=key_length; |
3019 | @@ -985,7 +985,7 @@ | |||
3020 | 985 | memset(key_checksum, 0, info->s->base.keys * sizeof(key_checksum[0])); | 985 | memset(key_checksum, 0, info->s->base.keys * sizeof(key_checksum[0])); |
3021 | 986 | while (pos < info->state->data_file_length) | 986 | while (pos < info->state->data_file_length) |
3022 | 987 | { | 987 | { |
3024 | 988 | if (*killed_ptr(param)) | 988 | if (killed_status(param)) |
3025 | 989 | goto err2; | 989 | goto err2; |
3026 | 990 | switch (info->s->data_file_type) { | 990 | switch (info->s->data_file_type) { |
3027 | 991 | case STATIC_RECORD: | 991 | case STATIC_RECORD: |
3028 | @@ -3253,7 +3253,7 @@ | |||
3029 | 3253 | char llbuff[22],llbuff2[22]; | 3253 | char llbuff[22],llbuff2[22]; |
3030 | 3254 | DBUG_ENTER("sort_get_next_record"); | 3254 | DBUG_ENTER("sort_get_next_record"); |
3031 | 3255 | 3255 | ||
3033 | 3256 | if (*killed_ptr(param)) | 3256 | if (killed_status(param)) |
3034 | 3257 | DBUG_RETURN(1); | 3257 | DBUG_RETURN(1); |
3035 | 3258 | 3258 | ||
3036 | 3259 | switch (share->data_file_type) { | 3259 | switch (share->data_file_type) { |
3037 | 3260 | 3260 | ||
3038 | === modified file 'Percona-Server/storage/myisam/myisamchk.c' | |||
3039 | --- Percona-Server/storage/myisam/myisamchk.c 2012-08-22 01:40:20 +0000 | |||
3040 | +++ Percona-Server/storage/myisam/myisamchk.c 2013-01-09 13:41:38 +0000 | |||
3041 | @@ -1702,11 +1702,9 @@ | |||
3042 | 1702 | sorting | 1702 | sorting |
3043 | 1703 | */ | 1703 | */ |
3044 | 1704 | 1704 | ||
3048 | 1705 | static int not_killed= 0; | 1705 | int killed_status(MI_CHECK *param __attribute__((unused))) |
3046 | 1706 | |||
3047 | 1707 | volatile int *killed_ptr(MI_CHECK *param __attribute__((unused))) | ||
3049 | 1708 | { | 1706 | { |
3051 | 1709 | return ¬_killed; /* always NULL */ | 1707 | return 0; /* always NULL */ |
3052 | 1710 | } | 1708 | } |
3053 | 1711 | 1709 | ||
3054 | 1712 | /* print warnings and errors */ | 1710 | /* print warnings and errors */ |
3055 | 1713 | 1711 | ||
3056 | === modified file 'Percona-Server/storage/myisam/myisamdef.h' | |||
3057 | --- Percona-Server/storage/myisam/myisamdef.h 2012-03-06 14:29:42 +0000 | |||
3058 | +++ Percona-Server/storage/myisam/myisamdef.h 2013-01-09 13:41:38 +0000 | |||
3059 | @@ -769,7 +769,7 @@ | |||
3060 | 769 | int mi_check_index_cond(register MI_INFO *info, uint keynr, uchar *record); | 769 | int mi_check_index_cond(register MI_INFO *info, uint keynr, uchar *record); |
3061 | 770 | 770 | ||
3062 | 771 | /* Functions needed by mi_check */ | 771 | /* Functions needed by mi_check */ |
3064 | 772 | volatile int *killed_ptr(MI_CHECK *param); | 772 | int killed_status(MI_CHECK *param); |
3065 | 773 | void mi_check_print_error(MI_CHECK *param, const char *fmt,...); | 773 | void mi_check_print_error(MI_CHECK *param, const char *fmt,...); |
3066 | 774 | void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); | 774 | void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); |
3067 | 775 | void mi_check_print_info(MI_CHECK *param, const char *fmt,...); | 775 | void mi_check_print_info(MI_CHECK *param, const char *fmt,...); |
3068 | 776 | 776 | ||
3069 | === modified file 'Percona-Server/storage/myisam/sort.c' | |||
3070 | --- Percona-Server/storage/myisam/sort.c 2012-03-06 14:29:42 +0000 | |||
3071 | +++ Percona-Server/storage/myisam/sort.c 2013-01-09 13:41:38 +0000 | |||
3072 | @@ -910,7 +910,7 @@ | |||
3073 | 910 | uchar *strpos; | 910 | uchar *strpos; |
3074 | 911 | BUFFPEK *buffpek,**refpek; | 911 | BUFFPEK *buffpek,**refpek; |
3075 | 912 | QUEUE queue; | 912 | QUEUE queue; |
3077 | 913 | volatile int *killed= killed_ptr(info->sort_info->param); | 913 | int killed= killed_status(info->sort_info->param); |
3078 | 914 | DBUG_ENTER("merge_buffers"); | 914 | DBUG_ENTER("merge_buffers"); |
3079 | 915 | 915 | ||
3080 | 916 | count=error=0; | 916 | count=error=0; |
3081 | @@ -943,7 +943,7 @@ | |||
3082 | 943 | { | 943 | { |
3083 | 944 | for (;;) | 944 | for (;;) |
3084 | 945 | { | 945 | { |
3086 | 946 | if (*killed) | 946 | if (killed) |
3087 | 947 | { | 947 | { |
3088 | 948 | error=1; goto err; | 948 | error=1; goto err; |
3089 | 949 | } | 949 | } |
Failed perfschema. threads_ mysql test is fixed now.