summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorgluh@gluh.mysql.r18.ru <>2003-07-18 14:11:01 +0500
committergluh@gluh.mysql.r18.ru <>2003-07-18 14:11:01 +0500
commit333bddb33ffa00989a98fdfa6157f5abff3e7cd6 (patch)
tree781fa5cf6448620f00a72dd55b39685f4d0de79a /sql/slave.cc
parent39e7db9f51fb9f78d7c3846ad11afd1f13778593 (diff)
downloadmariadb-git-333bddb33ffa00989a98fdfa6157f5abff3e7cd6.tar.gz
SCRUM:
Task 499 'init_connect, init_slave options'
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index c45c11f8bef..b9da8c7eca6 100644
--- a/sql/slave.cc
+++ b/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))