slave start <options> to be able to do
slave start io_thread slave start sql_thread same for stop
This commit is contained in:
parent
0300cd77df
commit
d993a1c0c4
@ -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},
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user