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

Function start_slave_deadlock_handler_thread

sql/slave.cc:542–563  ·  view source on GitHub ↗

Start the slave deadlock handler thread. This thread is used to kill worker thread transactions during parallel replication, when a storage engine attempts to take an errorneous conflicting lock that would cause a deadlock. Killing is done asynchroneously, as the kill may not be safe within the context of a callback from inside storage engine locking code. */

Source from the content-addressed store, hash-verified

540 callback from inside storage engine locking code.
541*/
542static int
543start_slave_deadlock_handler_thread()
544{
545 pthread_t th;
546
547 mysql_mutex_lock(&LOCK_slave_deadlock_handler);
548 slave_deadlock_handler_thread_running= false;
549 slave_deadlock_handler_thread_stop= false;
550 if (mysql_thread_create(key_thread_slave_deadlock_handler,
551 &th, &connection_attrib, slave_deadlock_handler,
552 NULL))
553 {
554 sql_print_error("Failed to create thread while initialising slave");
555 return 1;
556 }
557
558 while (!slave_deadlock_handler_thread_running)
559 mysql_cond_wait(&COND_slave_deadlock_handler, &LOCK_slave_deadlock_handler);
560 mysql_mutex_unlock(&LOCK_slave_deadlock_handler);
561
562 return 0;
563}
564
565
566static void

Callers 1

init_slaveFunction · 0.85

Calls 1

sql_print_errorFunction · 0.70

Tested by

no test coverage detected