From 9826458700c12fdc20f7ca61a7e8179a7bdcd3c8 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Fri, 31 Aug 2018 13:51:12 +0300 Subject: [PATCH] MXS-2011 Log complaint from master If the replication is terminated, the error message sent by the master is written to the log. --- server/modules/routing/binlogrouter/blr_master.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_master.cc b/server/modules/routing/binlogrouter/blr_master.cc index 7dd71bd75..b526588a4 100644 --- a/server/modules/routing/binlogrouter/blr_master.cc +++ b/server/modules/routing/binlogrouter/blr_master.cc @@ -1787,6 +1787,7 @@ static void blr_terminate_master_replication(ROUTER_INSTANCE* router, memcpy(msg_err, (char *)ptr + err_msg_offset, msg_len); *(msg_err + msg_len) = '\0'; + std::string s(msg_err); spinlock_acquire(&router->lock); char* old_errmsg = router->m_errmsg; @@ -1798,8 +1799,10 @@ static void blr_terminate_master_replication(ROUTER_INSTANCE* router, spinlock_release(&router->lock); MXS_FREE(old_errmsg); - MXS_ERROR("Error packet in binlog stream.%s @ %lu.", - router->binlog_name, router->current_pos); + // TODO: Would it or would it not be safe to access router->m_errmsg here? + // TODO: Is the locking above really needed? + MXS_ERROR("Error packet in binlog stream (%s@%lu): %s", + router->binlog_name, router->current_pos, s.c_str()); }