mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
SCRUM:
Task 499 'init_connect, init_slave options'
This commit is contained in:
32
sql/slave.cc
32
sql/slave.cc
@ -2448,6 +2448,24 @@ err:
|
||||
}
|
||||
|
||||
|
||||
void init_slave_execute(THD *thd, sys_var_str *init_slave_var)
|
||||
{
|
||||
Vio* save_vio;
|
||||
ulong save_client_capabilities;
|
||||
|
||||
thd->proc_info= "Execution of init_slave";
|
||||
thd->query= init_slave_var->value;
|
||||
thd->query_length= init_slave_var->value_length;
|
||||
save_client_capabilities= thd->client_capabilities;
|
||||
thd->client_capabilities|= CLIENT_MULTI_QUERIES;
|
||||
save_vio= thd->net.vio;
|
||||
thd->net.vio= 0;
|
||||
dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1);
|
||||
thd->client_capabilities= save_client_capabilities;
|
||||
thd->net.vio= save_vio;
|
||||
}
|
||||
|
||||
|
||||
/* Slave SQL Thread entry point */
|
||||
|
||||
extern "C" pthread_handler_decl(handle_slave_sql,arg)
|
||||
@ -2530,6 +2548,20 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
|
||||
llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name,
|
||||
llstr(rli->group_relay_log_pos,llbuff1));
|
||||
|
||||
/* execute init_slave variable */
|
||||
if (sys_init_slave.value)
|
||||
{
|
||||
rw_wrlock(&LOCK_sys_init_slave);
|
||||
init_slave_execute(thd, &sys_init_slave);
|
||||
rw_unlock(&LOCK_sys_init_slave);
|
||||
if (thd->query_error)
|
||||
{
|
||||
sql_print_error("\
|
||||
Slave SQL thread aborted. Can't execute init_slave query");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read queries from the IO/THREAD until this thread is killed */
|
||||
|
||||
while (!sql_slave_killed(thd,rli))
|
||||
|
Reference in New Issue
Block a user