Disconnect slave if duplicate event detected

If a duplicate event is detected the state of the slave is set
to BLRS_ERRORED and the connection is closed. That way the
duplicate event will not break the slave, and it will pick
up its state when it reconnects.
This commit is contained in:
Johan Wikman
2016-03-30 16:05:19 +03:00
parent 51e60000dd
commit 0493196ecc
2 changed files with 44 additions and 13 deletions

View File

@ -2303,6 +2303,23 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large)
slave->stats.n_events++;
burst_size -= hdr.event_size;
}
else
{
MXS_WARNING("Slave %s:%i, server-id %d, binlog '%s, position %u: "
"Slave-thread could not send event to slave, closing connection.",
slave->dcb->remote,
ntohs((slave->dcb->ipv4).sin_port),
slave->serverid,
binlog_name,
binlog_pos);
#ifndef BLFILE_IN_SLAVE
blr_close_binlog(router, file);
#endif
slave->state = BLRS_ERRORED;
dcb_close(slave->dcb);
return 0;
}
gwbuf_free(record);
record = NULL;