| 9296 | */ |
| 9297 | |
| 9298 | static |
| 9299 | void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) |
| 9300 | { |
| 9301 | #ifdef WITH_WSREP |
| 9302 | if (WSREP(thd)) |
| 9303 | { |
| 9304 | if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) |
| 9305 | { |
| 9306 | WSREP_DEBUG("implicit commit before KILL"); |
| 9307 | /* Commit the normal transaction if one is active. */ |
| 9308 | bool commit_failed= trans_commit_implicit(thd); |
| 9309 | /* Release metadata locks acquired in this transaction. */ |
| 9310 | thd->release_transactional_locks(); |
| 9311 | if (commit_failed || wsrep_after_statement(thd)) |
| 9312 | { |
| 9313 | WSREP_DEBUG("implicit commit failed, MDL released: %lld", |
| 9314 | (longlong) thd->thread_id); |
| 9315 | return; |
| 9316 | } |
| 9317 | thd->transaction->stmt.mark_trans_did_ddl(); |
| 9318 | } |
| 9319 | } |
| 9320 | |
| 9321 | bool wsrep_high_priority= false; |
| 9322 | #endif /* WITH_WSREP */ |
| 9323 | uint error= kill_one_thread(thd, id, state, type |
| 9324 | #ifdef WITH_WSREP |
| 9325 | , wsrep_high_priority |
| 9326 | #endif |
| 9327 | ); |
| 9328 | |
| 9329 | if (likely(!error)) |
| 9330 | { |
| 9331 | if (!thd->killed) |
| 9332 | my_ok(thd); |
| 9333 | else |
| 9334 | thd->send_kill_message(); |
| 9335 | } |
| 9336 | #ifdef WITH_WSREP |
| 9337 | else if (wsrep_high_priority) |
| 9338 | my_printf_error(error, "This is a high priority thread/query and" |
| 9339 | " cannot be killed without compromising" |
| 9340 | " the consistency of the cluster", MYF(0)); |
| 9341 | #endif |
| 9342 | else |
| 9343 | { |
| 9344 | my_error(error, MYF(0), id); |
| 9345 | } |
| 9346 | } |
| 9347 | |
| 9348 | |
| 9349 | static void __attribute__ ((noinline)) |
no test coverage detected