Unsafe position is no longer an error

The unsafe slave position is no longer an error and will be treated the
same way if no events are available i.e. the slaves are no longer disconnected.

The log messages now have more information such as the current committed
transaction event being processed and the number of events sent by the
current thread.
This commit is contained in:
Markus Makela 2015-12-30 17:57:17 +02:00
parent 23809af02e
commit a5ccf09ac5
2 changed files with 6 additions and 14 deletions

View File

@ -464,8 +464,7 @@ struct stat statb;
{
if (pos > router->binlog_position && !router->rotating)
{
/* Unsafe position, slave will be disconnected by the calling routine */
snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Requested binlog position %lu. Position is unsafe so disconnecting. "
snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "Requested binlog position %lu is unsafe. "
"Latest safe position %lu, end of binlog file %lu",
pos, router->binlog_position, router->current_pos);

View File

@ -1962,6 +1962,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
#ifdef BLSLAVE_IN_FILE
slave->file = file;
#endif
int events_before = slave->stats.n_events;
while (burst-- && burst_size > 0 &&
(record = blr_read_binlog(router, file, slave->binlog_pos, &hdr, read_errmsg)) != NULL)
@ -2103,24 +2104,16 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
if (hdr.ok == SLAVE_POS_READ_UNSAFE) {
MXS_ERROR("%s: Slave %s:%i, server-id %d, binlog '%s', %s",
MXS_NOTICE("%s: Slave %s:%i, server-id %d, binlog '%s', read %d events, "
"current committed transaction event being sent: %lu, %s",
router->service->name,
slave->dcb->remote,
ntohs((slave->dcb->ipv4).sin_port),
slave->serverid,
slave->binlogfile,
slave->stats.n_events - events_before,
router->current_safe_event,
read_errmsg);
/*
* Close the slave session and socket
* The slave will try to reconnect
*/
dcb_close(slave->dcb);
#ifndef BLFILE_IN_SLAVE
blr_close_binlog(router, file);
#endif
return 0;
}
}
spinlock_acquire(&slave->catch_lock);