From f83129584773d60d68d8479de9ea4b917ded4c44 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Wed, 30 Nov 2016 10:05:00 +0100 Subject: [PATCH] In case of error ftruncate is called with router->binlog_position In case of error router->binlog_position is used with truncate and error message instead of router->last_written --- server/modules/routing/binlog/blr_file.c | 4 ++-- server/modules/routing/binlog/blr_master.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index b6be11af8..c25478328 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -352,10 +352,10 @@ blr_write_binlog_record(ROUTER_INSTANCE *router, REP_HEADER *hdr, uint32_t size, router->binlog_name, strerror_r(errno, err_msg, sizeof(err_msg))); /* Remove any partial event that was written */ - if (ftruncate(router->binlog_fd, router->last_written)) + if (ftruncate(router->binlog_fd, router->binlog_position)) { MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ", - router->service->name, router->last_written, + router->service->name, router->binlog_position, router->binlog_name, strerror_r(errno, err_msg, sizeof(err_msg))); } diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index 53e251c83..ac4abeefb 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -2607,10 +2607,10 @@ blr_write_data_into_binlog(ROUTER_INSTANCE *router, uint32_t data_len, uint8_t * strerror_r(errno, err_msg, sizeof(err_msg))); /* Remove any partial event that was written */ - if (ftruncate(router->binlog_fd, router->last_written)) + if (ftruncate(router->binlog_fd, router->binlog_position)) { MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ", - router->service->name, router->last_written, + router->service->name, router->binlog_position, router->binlog_name, strerror_r(errno, err_msg, sizeof(err_msg))); }