@@ -112,38 +112,29 @@ enum enum_slave_reconnect_actions
112112
113113enum enum_slave_reconnect_messages
114114{
115- SLAVE_RECON_MSG_WAIT= 0 ,
116- SLAVE_RECON_MSG_KILLED_WAITING= 1 ,
117- SLAVE_RECON_MSG_AFTER= 2 ,
118- SLAVE_RECON_MSG_FAILED= 3 ,
119- SLAVE_RECON_MSG_COMMAND= 4 ,
120- SLAVE_RECON_MSG_KILLED_AFTER= 5 ,
115+ SLAVE_RECON_MSG_AFTER,
116+ SLAVE_RECON_MSG_FAILED,
117+ SLAVE_RECON_MSG_COMMAND,
118+ SLAVE_RECON_MSG_KILLED_AFTER,
121119 SLAVE_RECON_MSG_MAX
122120};
123121
124122static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]=
125123{
126124 {
127- " Waiting to reconnect after a failed registration on master" ,
128- " Slave I/O thread killed while waiting to reconnect after a failed \
129- registration on master" ,
130125 " Reconnecting after a failed registration on master" ,
131126 " failed registering on master, reconnecting to try again, \
132127log '%s' at position %llu%s" ,
133128 " COM_REGISTER_SLAVE" ,
134129 " Slave I/O thread killed during or after reconnect"
135130 },
136131 {
137- " Waiting to reconnect after a failed binlog dump request" ,
138- " Slave I/O thread killed while retrying master dump" ,
139132 " Reconnecting after a failed binlog dump request" ,
140133 " failed dump request, reconnecting to try again, log '%s' at position %llu%s" ,
141134 " COM_BINLOG_DUMP" ,
142135 " Slave I/O thread killed during or after reconnect"
143136 },
144137 {
145- " Waiting to reconnect after a failed master event read" ,
146- " Slave I/O thread killed while waiting to reconnect after a failed read" ,
147138 " Reconnecting after a failed master event read" ,
148139 " Slave I/O thread: Failed reading log event, reconnecting to retry, \
149140log '%s' at position %llu%s" ,
@@ -4396,20 +4387,18 @@ static bool check_io_slave_killed(Master_info *mi, const char *info)
43964387/* *
43974388 @brief Try to reconnect slave IO thread.
43984389
4399- @details Terminates current connection to master, sleeps for
4400- @c mi->connect_retry msecs and initiates new connection with
4401- @c safe_reconnect(). Variable pointed by @c retry_count is increased -
4390+ @details Terminates current connection to master
4391+ and initiates new connection with safe_reconnect(), which sleeps for
4392+ @c mi->connect_retry msecs and increases @c mi->TODO for each attempt -
44024393 if it exceeds @c master_retry_count then connection is not re-established
44034394 and function signals error.
44044395 Unless @c suppres_warnings is TRUE, a warning is put in the server error log
44054396 when reconnecting. The warning message and messages used to report errors
4406- are taken from @c messages array. In case @c master_retry_count is exceeded,
4407- no messages are added to the log.
4397+ are taken from @c messages array.
44084398
44094399 @param[in] thd Thread context.
44104400 @param[in] mysql MySQL connection.
44114401 @param[in] mi Master connection information.
4412- @param[in,out] retry_count Number of attempts to reconnect.
44134402 @param[in] suppress_warnings TRUE when a normal net read timeout
44144403 has caused to reconnecting.
44154404 @param[in] messages Messages to print/log, see
@@ -4420,23 +4409,14 @@ static bool check_io_slave_killed(Master_info *mi, const char *info)
44204409*/
44214410
44224411static int try_to_reconnect (THD *thd, MYSQL *mysql, Master_info *mi,
4423- uint *retry_count, bool suppress_warnings,
4412+ bool suppress_warnings,
44244413 const char *messages[SLAVE_RECON_MSG_MAX])
44254414{
44264415 mi->slave_running = MYSQL_SLAVE_RUN_NOT_CONNECT;
4427- thd->proc_info = messages[SLAVE_RECON_MSG_WAIT];
44284416#ifdef SIGNAL_WITH_VIO_CLOSE
44294417 thd->clear_active_vio ();
44304418#endif
44314419 end_server (mysql);
4432- if ((*retry_count)++)
4433- {
4434- if (*retry_count > master_retry_count)
4435- return 1 ; // Don't retry forever
4436- slave_sleep (thd, mi->connect_retry , io_slave_killed, mi);
4437- }
4438- if (check_io_slave_killed (mi, messages[SLAVE_RECON_MSG_KILLED_WAITING]))
4439- return 1 ;
44404420 thd->proc_info = messages[SLAVE_RECON_MSG_AFTER];
44414421 if (!suppress_warnings)
44424422 {
@@ -4497,7 +4477,6 @@ pthread_handler_t handle_slave_io(void *arg)
44974477 MYSQL *mysql;
44984478 Master_info *mi = (Master_info*)arg;
44994479 Relay_log_info *rli= &mi->rli ;
4500- uint retry_count;
45014480 bool suppress_warnings;
45024481 int ret;
45034482 rpl_io_thread_info io_info;
@@ -4511,7 +4490,6 @@ pthread_handler_t handle_slave_io(void *arg)
45114490
45124491 DBUG_ASSERT (mi->inited );
45134492 mysql= NULL ;
4514- retry_count= 0 ;
45154493
45164494 thd= new THD (next_thread_id ()); // note that contructor of THD uses DBUG_ !
45174495
@@ -4661,7 +4639,7 @@ pthread_handler_t handle_slave_io(void *arg)
46614639 Try to reconnect because the error was caused by a transient network
46624640 problem
46634641 */
4664- if (try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4642+ if (try_to_reconnect (thd, mysql, mi, suppress_warnings,
46654643 reconnect_messages[SLAVE_RECON_ACT_REG]))
46664644 goto err;
46674645
@@ -4678,7 +4656,7 @@ pthread_handler_t handle_slave_io(void *arg)
46784656 " while registering slave on master" ))
46794657 {
46804658 sql_print_error (" Slave I/O thread couldn't register on master" );
4681- if (try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4659+ if (try_to_reconnect (thd, mysql, mi, suppress_warnings,
46824660 reconnect_messages[SLAVE_RECON_ACT_REG]))
46834661 goto err;
46844662 }
@@ -4705,7 +4683,7 @@ pthread_handler_t handle_slave_io(void *arg)
47054683 {
47064684 sql_print_error (" Failed on request_dump()" );
47074685 if (check_io_slave_killed (mi, NullS) ||
4708- try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4686+ try_to_reconnect (thd, mysql, mi, suppress_warnings,
47094687 reconnect_messages[SLAVE_RECON_ACT_DUMP]))
47104688 goto err;
47114689 goto connected;
@@ -4764,13 +4742,12 @@ Stopping slave I/O thread due to out-of-memory error from master");
47644742 " %s" , ER_THD (thd, ER_OUT_OF_RESOURCES));
47654743 goto err;
47664744 }
4767- if (try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4745+ if (try_to_reconnect (thd, mysql, mi, suppress_warnings,
47684746 reconnect_messages[SLAVE_RECON_ACT_EVENT]))
47694747 goto err;
47704748 goto connected;
47714749 } // if (event_len == packet_error)
47724750
4773- retry_count=0 ; // ok event, reset retry counter
47744751 thd->set_time_for_next_stage ();
47754752 THD_STAGE_INFO (thd, stage_queueing_master_event_to_the_relay_log);
47764753 event_buf= mysql->net .read_pos + 1 ;
0 commit comments