MCPcopy Create free account
hub / github.com/MariaDB/server / sql_kill_user

Function sql_kill_user

sql/sql_parse.cc:9349–9389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9347
9348
9349static void __attribute__ ((noinline))
9350sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
9351{
9352 uint error;
9353 ha_rows rows;
9354#ifdef WITH_WSREP
9355 if (WSREP(thd))
9356 {
9357 if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
9358 {
9359 WSREP_DEBUG("implicit commit before KILL");
9360 /* Commit the normal transaction if one is active. */
9361 bool commit_failed= trans_commit_implicit(thd);
9362 /* Release metadata locks acquired in this transaction. */
9363 thd->release_transactional_locks();
9364 if (commit_failed || wsrep_after_statement(thd))
9365 {
9366 WSREP_DEBUG("implicit commit failed, MDL released: %lld",
9367 (longlong) thd->thread_id);
9368 return;
9369 }
9370 thd->transaction->stmt.mark_trans_did_ddl();
9371 }
9372 }
9373#endif /* WITH_WSREP */
9374 switch (error= kill_threads_for_user(thd, user, state, &rows))
9375 {
9376 case 0:
9377 my_ok(thd, rows);
9378 break;
9379 case ER_KILL_DENIED_ERROR:
9380 char buf[DEFINER_LENGTH+1];
9381 strxnmov(buf, sizeof(buf)-1, user->user.str, "@", user->host.str, NULL);
9382 my_printf_error(ER_KILL_DENIED_ERROR, ER_THD(thd, ER_CANNOT_USER), MYF(0),
9383 "KILL USER", buf);
9384 break;
9385 case ER_OUT_OF_RESOURCES:
9386 default:
9387 my_error(error, MYF(0));
9388 }
9389}
9390
9391
9392/** If pointer is not a null pointer, append filename to it. */

Callers 1

sql_parse.ccFile · 0.85

Calls 9

trans_commit_implicitFunction · 0.85
wsrep_after_statementFunction · 0.85
kill_threads_for_userFunction · 0.85
my_okFunction · 0.85
strxnmovFunction · 0.85
my_printf_errorFunction · 0.85
my_errorFunction · 0.85
mark_trans_did_ddlMethod · 0.80

Tested by

no test coverage detected