mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
CHANGE MASTER TO coredumped when the slave was initially started
masterless sql/slave.cc: fixed coredump in CHANGE MASTER TO sql/sql_parse.cc: fixed coredump in CHANGE MASTER TO
This commit is contained in:
parent
fba1498ca0
commit
bd8fa6cc86
2 changed files with 8 additions and 4 deletions
|
@ -40,7 +40,7 @@ extern bool opt_log_slave_updates ;
|
|||
|
||||
static inline bool slave_killed(THD* thd);
|
||||
static int init_slave_thread(THD* thd);
|
||||
static int init_master_info(MASTER_INFO* mi);
|
||||
int init_master_info(MASTER_INFO* mi);
|
||||
static void safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
|
||||
static void safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
|
||||
static int safe_sleep(THD* thd, int sec);
|
||||
|
@ -249,7 +249,7 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
|
|||
return error;
|
||||
}
|
||||
|
||||
static int init_master_info(MASTER_INFO* mi)
|
||||
int init_master_info(MASTER_INFO* mi)
|
||||
{
|
||||
FILE* file;
|
||||
MY_STAT stat_area;
|
||||
|
|
|
@ -52,6 +52,7 @@ static int change_master(THD* thd);
|
|||
static void reset_slave();
|
||||
static void reset_master();
|
||||
|
||||
extern int init_master_info(MASTER_INFO* mi);
|
||||
|
||||
static const char *any_db="*any*"; // Special symbol for check_access
|
||||
|
||||
|
@ -2462,7 +2463,7 @@ static int start_slave(THD* thd , bool net_report)
|
|||
return 1;
|
||||
pthread_mutex_lock(&LOCK_slave);
|
||||
if(!slave_running)
|
||||
if(master_host)
|
||||
if(glob_mi.inited && glob_mi.host)
|
||||
{
|
||||
pthread_t hThread;
|
||||
if(pthread_create(&hThread, &connection_attrib, handle_slave, 0))
|
||||
|
@ -2471,7 +2472,7 @@ static int start_slave(THD* thd , bool net_report)
|
|||
}
|
||||
}
|
||||
else
|
||||
err = "Master host not set";
|
||||
err = "Master host not set or master info not initialized";
|
||||
else
|
||||
err = "Slave already running";
|
||||
|
||||
|
@ -2557,6 +2558,9 @@ static int change_master(THD* thd)
|
|||
thd->proc_info = "changing master";
|
||||
LEX_MASTER_INFO* lex_mi = &thd->lex.mi;
|
||||
|
||||
if(!glob_mi.inited)
|
||||
init_master_info(&glob_mi);
|
||||
|
||||
pthread_mutex_lock(&glob_mi.lock);
|
||||
if((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue