diff options
-rw-r--r-- | sql/lex.h | 2 | ||||
-rw-r--r-- | sql/sql_lex.cc | 1 | ||||
-rw-r--r-- | sql/sql_lex.h | 2 | ||||
-rw-r--r-- | sql/sql_repl.cc | 4 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 20 |
5 files changed, 26 insertions, 3 deletions
diff --git a/sql/lex.h b/sql/lex.h index 6bee4152e48..62540c82c28 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -191,6 +191,7 @@ static SYMBOL symbols[] = { { "INT4", SYM(INT_SYM),0,0}, { "INT8", SYM(BIGINT),0,0}, { "INTO", SYM(INTO),0,0}, + { "IO_THREAD", SYM(IO_THREAD),0,0}, { "IF", SYM(IF),0,0}, { "IS", SYM(IS),0,0}, { "ISOLATION", SYM(ISOLATION),0,0}, @@ -327,6 +328,7 @@ static SYMBOL symbols[] = { { "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0}, { "SQL_SLAVE_SKIP_COUNTER", SYM(SQL_SLAVE_SKIP_COUNTER),0,0}, { "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0}, + { "SQL_THREAD", SYM(SQL_THREAD),0,0}, { "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0}, { "SSL", SYM(SSL_SYM),0,0}, { "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0}, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7995e7701e5..43195bc908b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -150,6 +150,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->convert_set=(lex->thd=thd)->convert_set; lex->yacc_yyss=lex->yacc_yyvs=0; lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); + lex->slave_thd_opt=0; return lex; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index c0ede015eb8..ecfb3dec99c 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -186,7 +186,7 @@ typedef struct st_lex { thr_lock_type lock_option; bool drop_primary,drop_if_exists,local_file; bool in_comment,ignore_space,verbose,simple_alter, option_type; - + uint slave_thd_opt; } LEX; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0b408920703..c6384817512 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -562,6 +562,8 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) return 1; lock_slave_threads(mi); // this allows us to cleanly read slave_running init_thread_mask(&thread_mask,mi,1 /* inverse */); + if (thd->lex.slave_thd_opt) + thread_mask &= thd->lex.slave_thd_opt; if (thread_mask) { if (server_id_supplied && (!mi->inited || (mi->inited && *mi->host))) @@ -602,6 +604,8 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) int thread_mask; lock_slave_threads(mi); init_thread_mask(&thread_mask,mi,0 /* not inverse*/); + if (thd->lex.slave_thd_opt) + thread_mask &= thd->lex.slave_thd_opt; slave_errno = (thread_mask) ? terminate_slave_threads(mi,thread_mask, 1 /*skip lock */) : ER_SLAVE_NOT_RUNNING; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 90c16daf407..850a8ad7ee8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -123,6 +123,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token RESET_SYM %token PURGE %token SLAVE +%token IO_THREAD +%token SQL_THREAD %token START_SYM %token STOP_SYM %token TRUNCATE_SYM @@ -1256,20 +1258,34 @@ opt_to: | AS {} slave: - SLAVE START_SYM + SLAVE START_SYM slave_thread_opts { LEX *lex=Lex; lex->sql_command = SQLCOM_SLAVE_START; lex->type = 0; } | - SLAVE STOP_SYM + SLAVE STOP_SYM slave_thread_opts { LEX *lex=Lex; lex->sql_command = SQLCOM_SLAVE_STOP; lex->type = 0; }; +slave_thread_opts: slave_thread_opt + | slave_thread_opts ',' slave_thread_opt + +slave_thread_opt: + /*empty*/ {} + | SQL_THREAD + { + Lex->slave_thd_opt|=SLAVE_SQL; + } + | IO_THREAD + { + Lex->slave_thd_opt|=SLAVE_IO; + } + restore: RESTORE_SYM table_or_tables { |