@@ -112,38 +112,29 @@ enum enum_slave_reconnect_actions
112
112
113
113
enum enum_slave_reconnect_messages
114
114
{
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,
121
119
SLAVE_RECON_MSG_MAX
122
120
};
123
121
124
122
static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]=
125
123
{
126
124
{
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" ,
130
125
" Reconnecting after a failed registration on master" ,
131
126
" failed registering on master, reconnecting to try again, \
132
127
log '%s' at position %llu%s" ,
133
128
" COM_REGISTER_SLAVE" ,
134
129
" Slave I/O thread killed during or after reconnect"
135
130
},
136
131
{
137
- " Waiting to reconnect after a failed binlog dump request" ,
138
- " Slave I/O thread killed while retrying master dump" ,
139
132
" Reconnecting after a failed binlog dump request" ,
140
133
" failed dump request, reconnecting to try again, log '%s' at position %llu%s" ,
141
134
" COM_BINLOG_DUMP" ,
142
135
" Slave I/O thread killed during or after reconnect"
143
136
},
144
137
{
145
- " Waiting to reconnect after a failed master event read" ,
146
- " Slave I/O thread killed while waiting to reconnect after a failed read" ,
147
138
" Reconnecting after a failed master event read" ,
148
139
" Slave I/O thread: Failed reading log event, reconnecting to retry, \
149
140
log '%s' at position %llu%s" ,
@@ -4396,20 +4387,18 @@ static bool check_io_slave_killed(Master_info *mi, const char *info)
4396
4387
/* *
4397
4388
@brief Try to reconnect slave IO thread.
4398
4389
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 -
4402
4393
if it exceeds @c master_retry_count then connection is not re-established
4403
4394
and function signals error.
4404
4395
Unless @c suppres_warnings is TRUE, a warning is put in the server error log
4405
4396
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.
4408
4398
4409
4399
@param[in] thd Thread context.
4410
4400
@param[in] mysql MySQL connection.
4411
4401
@param[in] mi Master connection information.
4412
- @param[in,out] retry_count Number of attempts to reconnect.
4413
4402
@param[in] suppress_warnings TRUE when a normal net read timeout
4414
4403
has caused to reconnecting.
4415
4404
@param[in] messages Messages to print/log, see
@@ -4420,23 +4409,14 @@ static bool check_io_slave_killed(Master_info *mi, const char *info)
4420
4409
*/
4421
4410
4422
4411
static int try_to_reconnect (THD *thd, MYSQL *mysql, Master_info *mi,
4423
- uint *retry_count, bool suppress_warnings,
4412
+ bool suppress_warnings,
4424
4413
const char *messages[SLAVE_RECON_MSG_MAX])
4425
4414
{
4426
4415
mi->slave_running = MYSQL_SLAVE_RUN_NOT_CONNECT;
4427
- thd->proc_info = messages[SLAVE_RECON_MSG_WAIT];
4428
4416
#ifdef SIGNAL_WITH_VIO_CLOSE
4429
4417
thd->clear_active_vio ();
4430
4418
#endif
4431
4419
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 ;
4440
4420
thd->proc_info = messages[SLAVE_RECON_MSG_AFTER];
4441
4421
if (!suppress_warnings)
4442
4422
{
@@ -4497,7 +4477,6 @@ pthread_handler_t handle_slave_io(void *arg)
4497
4477
MYSQL *mysql;
4498
4478
Master_info *mi = (Master_info*)arg;
4499
4479
Relay_log_info *rli= &mi->rli ;
4500
- uint retry_count;
4501
4480
bool suppress_warnings;
4502
4481
int ret;
4503
4482
rpl_io_thread_info io_info;
@@ -4511,7 +4490,6 @@ pthread_handler_t handle_slave_io(void *arg)
4511
4490
4512
4491
DBUG_ASSERT (mi->inited );
4513
4492
mysql= NULL ;
4514
- retry_count= 0 ;
4515
4493
4516
4494
thd= new THD (next_thread_id ()); // note that contructor of THD uses DBUG_ !
4517
4495
@@ -4661,7 +4639,7 @@ pthread_handler_t handle_slave_io(void *arg)
4661
4639
Try to reconnect because the error was caused by a transient network
4662
4640
problem
4663
4641
*/
4664
- if (try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4642
+ if (try_to_reconnect (thd, mysql, mi, suppress_warnings,
4665
4643
reconnect_messages[SLAVE_RECON_ACT_REG]))
4666
4644
goto err;
4667
4645
@@ -4678,7 +4656,7 @@ pthread_handler_t handle_slave_io(void *arg)
4678
4656
" while registering slave on master" ))
4679
4657
{
4680
4658
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,
4682
4660
reconnect_messages[SLAVE_RECON_ACT_REG]))
4683
4661
goto err;
4684
4662
}
@@ -4705,7 +4683,7 @@ pthread_handler_t handle_slave_io(void *arg)
4705
4683
{
4706
4684
sql_print_error (" Failed on request_dump()" );
4707
4685
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,
4709
4687
reconnect_messages[SLAVE_RECON_ACT_DUMP]))
4710
4688
goto err;
4711
4689
goto connected;
@@ -4764,13 +4742,12 @@ Stopping slave I/O thread due to out-of-memory error from master");
4764
4742
" %s" , ER_THD (thd, ER_OUT_OF_RESOURCES));
4765
4743
goto err;
4766
4744
}
4767
- if (try_to_reconnect (thd, mysql, mi, &retry_count, suppress_warnings,
4745
+ if (try_to_reconnect (thd, mysql, mi, suppress_warnings,
4768
4746
reconnect_messages[SLAVE_RECON_ACT_EVENT]))
4769
4747
goto err;
4770
4748
goto connected;
4771
4749
} // if (event_len == packet_error)
4772
4750
4773
- retry_count=0 ; // ok event, reset retry counter
4774
4751
thd->set_time_for_next_stage ();
4775
4752
THD_STAGE_INFO (thd, stage_queueing_master_event_to_the_relay_log);
4776
4753
event_buf= mysql->net .read_pos + 1 ;
0 commit comments