From ba135c5548d33cd0f92fb68d3c3d6ccfb6507a1a Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Fri, 27 Nov 2015 09:16:17 +0100 Subject: [PATCH 1/3] Log messages fix with slave ip:port and id Log messages fix with slave ip:port and id --- server/modules/include/blr.h | 1 + server/modules/routing/binlog/blr_file.c | 3 +-- server/modules/routing/binlog/blr_slave.c | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/server/modules/include/blr.h b/server/modules/include/blr.h index 934c315e0..d41e4cac4 100644 --- a/server/modules/include/blr.h +++ b/server/modules/include/blr.h @@ -184,6 +184,7 @@ #define SLAVE_POS_READ_OK 0x00 #define SLAVE_POS_READ_ERR 0xff #define SLAVE_POS_READ_UNSAFE 0xfe +#define SLAVE_POS_FSTAT_ERR 0xfd /** * Some useful macros for examining the MySQL Response packets diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index 6e4e268de..e9143cfde 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -422,10 +422,9 @@ struct stat statb; filelen = statb.st_size; else { if (file->fd == -1) { - hdr->ok = SLAVE_POS_READ_OK; + hdr->ok = SLAVE_POS_FSTAT_ERR; snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "blr_read_binlog called with invalid file->fd, pos %lu", pos); spinlock_release(&file->lock); - MXS_ERROR("Slave has failed fstat %s", errmsg); return NULL; } } diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index ae470b050..69de58665 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -2024,6 +2024,16 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; if (record == NULL) { slave->stats.n_failed_read++; + if (hdr.ok == SLAVE_POS_FSTAT_ERR) { + MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s', %s", + router->service->name, + slave->dcb->remote, + ntohs((slave->dcb->ipv4).sin_port), + slave->serverid, + slave->binlogfile, + read_errmsg); + } + if (hdr.ok == SLAVE_POS_READ_ERR) { MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s', %s", router->service->name, @@ -2166,12 +2176,17 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; * but the new binlog file has not yet been created. Therefore * we ignore these issues during the rotate processing. */ - MXS_ERROR("Slave reached end of file for binlog file %s at %lu " - "which is not the file currently being downloaded. " + MXS_ERROR("%s: Slave %s:%d, server-id %d reached end of file for binlog file %s " + "at %lu which is not the file currently being downloaded. " "Master binlog is %s, %lu. This may be caused by a " "previous failure of the master.", + router->service->name, + slave->dcb->remote, + ntohs((slave->dcb->ipv4).sin_port), + slave->serverid, slave->binlogfile, (unsigned long)slave->binlog_pos, router->binlog_name, router->binlog_position); + if (blr_slave_fake_rotate(router, slave)) { spinlock_acquire(&slave->catch_lock); From 592e4d06cb51b4679653b10354d44e03494310f7 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Fri, 27 Nov 2015 09:43:58 +0100 Subject: [PATCH 2/3] Changed name for bad fd Changed name for bad fd --- server/modules/include/blr.h | 2 +- server/modules/routing/binlog/blr_file.c | 2 +- server/modules/routing/binlog/blr_slave.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/modules/include/blr.h b/server/modules/include/blr.h index d41e4cac4..23add0bba 100644 --- a/server/modules/include/blr.h +++ b/server/modules/include/blr.h @@ -184,7 +184,7 @@ #define SLAVE_POS_READ_OK 0x00 #define SLAVE_POS_READ_ERR 0xff #define SLAVE_POS_READ_UNSAFE 0xfe -#define SLAVE_POS_FSTAT_ERR 0xfd +#define SLAVE_POS_BAD_FD 0xfd /** * Some useful macros for examining the MySQL Response packets diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index e9143cfde..7afb53f70 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -422,7 +422,7 @@ struct stat statb; filelen = statb.st_size; else { if (file->fd == -1) { - hdr->ok = SLAVE_POS_FSTAT_ERR; + hdr->ok = SLAVE_POS_BAD_FD; snprintf(errmsg, BINLOG_ERROR_MSG_LEN, "blr_read_binlog called with invalid file->fd, pos %lu", pos); spinlock_release(&file->lock); return NULL; diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index 69de58665..35b44f1d5 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -2024,7 +2024,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; if (record == NULL) { slave->stats.n_failed_read++; - if (hdr.ok == SLAVE_POS_FSTAT_ERR) { + if (hdr.ok == SLAVE_POS_BAD_FD) { MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s', %s", router->service->name, slave->dcb->remote, From 6367ac7148915bd8ba29033d58ec1570ac2aef54 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Mon, 30 Nov 2015 19:23:36 +0100 Subject: [PATCH 3/3] Changed log level for up to date transition Changed log level for up to date transition --- server/modules/routing/binlog/blr_slave.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index 35b44f1d5..921c21292 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -2142,7 +2142,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; slave->stats.n_caughtup++; if (slave->stats.n_caughtup == 1) { - MXS_ERROR("%s: Slave %s:%d, server-id %d is now up to date '%s', position %lu.", + MXS_NOTICE("%s: Slave %s:%d, server-id %d is now up to date '%s', position %lu.", router->service->name, slave->dcb->remote, ntohs((slave->dcb->ipv4).sin_port), @@ -2151,7 +2151,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1]; } else if ((slave->stats.n_caughtup % 50) == 0) { - MXS_ERROR("%s: Slave %s:%d, server-id %d is up to date '%s', position %lu.", + MXS_NOTICE("%s: Slave %s:%d, server-id %d is up to date '%s', position %lu.", router->service->name, slave->dcb->remote, ntohs((slave->dcb->ipv4).sin_port),