Fix binlogrouter slave heartbeat task addition

The task was added multiple times when only one task is needed.
This commit is contained in:
Markus Mäkelä
2019-03-28 10:46:38 +02:00
parent f6219d1a80
commit 18cd890474
3 changed files with 5 additions and 1 deletions

View File

@ -354,6 +354,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
inst->trx_safe = params->get_bool("transaction_safety");
inst->fileroot = params->get_c_str_copy("filestem");
inst->heartbeat_task_active = false;
inst->slave_heartbeat_task_active = false;
/* Server id */
inst->serverid = params->get_integer("server_id");

View File

@ -800,6 +800,7 @@ struct ROUTER_INSTANCE : public MXS_ROUTER
unsigned long burst_size; /*< Maximum size of burst to send */
unsigned long heartbeat; /*< Configured heartbeat value */
bool heartbeat_task_active;
bool slave_heartbeat_task_active;
ROUTER_STATS stats; /*< Statistics for this router */
int active_logs;
int reconnect_pending;

View File

@ -425,8 +425,10 @@ int blr_slave_request(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, GWBUF* queue
/* Check whether to add the heartbeat check for this slave */
if (rv && slave->state == BLRS_DUMPING
&& router->send_slave_heartbeat
&& slave->heartbeat > 0)
&& slave->heartbeat > 0
&& !router->slave_heartbeat_task_active)
{
router->slave_heartbeat_task_active = true;
char task_name[BLRM_TASK_NAME_LEN + 1] = "";
snprintf(task_name,
BLRM_TASK_NAME_LEN,