Skip to main content

mysql主从

· One min read
  DBUG_PRINT("info", ("Creating new slave thread"));
if (mysql_thread_create(thread_key, &th, &connection_attrib, h_func,
(void *)mi)) {
LogErr(ERROR_LEVEL, ER_RPL_CANT_CREATE_SLAVE_THREAD,
mi->get_for_channel_str());
my_error(ER_SLAVE_THREAD, MYF(0));
goto err;
}

slave 线程

/**
Slave SQL thread entry point.

@param arg Pointer to Relay_log_info object that holds information
for the SQL thread.

@return Always 0.
*/
extern "C" void *handle_slave_sql(void *arg) {
THD *thd; /* needs to be first for thread_stack */
bool thd_added = false;
bool main_loop_error = false;
char llbuff[22], llbuff1[22];