128
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
128
typedef enum { SLAVE_Session_IO, SLAVE_Session_SQL} SLAVE_Session_TYPE;
130
130
static int32_t process_io_rotate(Master_info* mi, Rotate_log_event* rev);
131
131
static int32_t process_io_create_file(Master_info* mi, Create_file_log_event* cev);
132
132
static bool wait_for_relay_log_space(Relay_log_info* rli);
133
static inline bool io_slave_killed(THD* thd,Master_info* mi);
134
static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli);
135
static int32_t init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type);
136
static int32_t safe_connect(THD* thd, DRIZZLE *drizzle, Master_info* mi);
137
static int32_t safe_reconnect(THD* thd, DRIZZLE *drizzle, Master_info* mi,
133
static inline bool io_slave_killed(Session* thd,Master_info* mi);
134
static inline bool sql_slave_killed(Session* thd,Relay_log_info* rli);
135
static int32_t init_slave_thread(Session* thd, SLAVE_Session_TYPE thd_type);
136
static int32_t safe_connect(Session* thd, DRIZZLE *drizzle, Master_info* mi);
137
static int32_t safe_reconnect(Session* thd, DRIZZLE *drizzle, Master_info* mi,
138
138
bool suppress_warnings);
139
static int32_t connect_to_master(THD* thd, DRIZZLE *drizzle, Master_info* mi,
139
static int32_t connect_to_master(Session* thd, DRIZZLE *drizzle, Master_info* mi,
140
140
bool reconnect, bool suppress_warnings);
141
static int32_t safe_sleep(THD* thd, int32_t sec, CHECK_KILLED_FUNC thread_killed,
141
static int32_t safe_sleep(Session* thd, int32_t sec, CHECK_KILLED_FUNC thread_killed,
142
142
void* thread_killed_arg);
143
143
static int32_t get_master_version_and_clock(DRIZZLE *drizzle, Master_info* mi);
144
144
static Log_event* next_event(Relay_log_info* rli);
145
145
static int32_t queue_event(Master_info* mi,const char* buf,uint32_t event_len);
146
static int32_t terminate_slave_thread(THD *thd,
146
static int32_t terminate_slave_thread(Session *thd,
147
147
pthread_mutex_t* term_lock,
148
148
pthread_cond_t* term_cond,
149
149
volatile uint32_t *slave_running,
151
static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info);
151
static bool check_io_slave_killed(Session *thd, Master_info *mi, const char *info);
154
154
Find out which replications threads are running
1341
1341
init_slave_thread()
1344
static int32_t init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
1344
static int32_t init_slave_thread(Session* thd, SLAVE_Session_TYPE thd_type)
1346
1346
int32_t simulate_error= 0;
1347
thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
1347
thd->system_thread = (thd_type == SLAVE_Session_SQL) ?
1348
1348
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
1349
1349
thd->security_ctx->skip_grants();
1350
1350
my_net_init(&thd->net, 0);
1864
1864
@retval 1 There was an error.
1867
static int32_t try_to_reconnect(THD *thd, DRIZZLE *drizzle, Master_info *mi,
1867
static int32_t try_to_reconnect(Session *thd, DRIZZLE *drizzle, Master_info *mi,
1868
1868
uint32_t *retry_count, bool suppress_warnings,
1869
1869
const char *messages[SLAVE_RECON_MSG_MAX])
1937
1937
mi->events_till_disconnect = disconnect_slave_event_count;
1940
THD_CHECK_SENTRY(thd);
1940
Session_CHECK_SENTRY(thd);
1941
1941
mi->io_thd = thd;
1943
1943
pthread_detach_this_thread();
1944
1944
thd->thread_stack= (char*) &thd; // remember where our stack is
1945
if (init_slave_thread(thd, SLAVE_THD_IO))
1945
if (init_slave_thread(thd, SLAVE_Session_IO))
1947
1947
pthread_cond_broadcast(&mi->start_cond);
1948
1948
pthread_mutex_unlock(&mi->run_lock);
3173
3173
master_retry_count times
3176
static int32_t safe_reconnect(THD* thd, DRIZZLE *drizzle, Master_info* mi,
3176
static int32_t safe_reconnect(Session* thd, DRIZZLE *drizzle, Master_info* mi,
3177
3177
bool suppress_warnings)
3179
3179
return(connect_to_master(thd, drizzle, mi, 1, suppress_warnings));