From ae5eb004fe0552507c4dcbd6c36773506890fd04 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 3 Aug 2017 08:45:13 +0200 Subject: [PATCH] SHOW [FULL] BINARY LOGS is now able to report the same log file in use with different server_ids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SHOW [FULL] BINARY LOGS is now able to report the same filename in use with different server_ids: this can happen with binlog_structure=tree example from SHOW FULL BINARY LOGS 0/10122/mysql-bin.000113 … 0/10122/mysql-bin.000116 … 0/5306/mysql-bin.000113 SHOW BINARY LOGS shows the same file twice: mysql-bin.000113 … mysql-bin.000116 … mysql-bin.000113 --- server/modules/routing/binlogrouter/blr_slave.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/binlogrouter/blr_slave.c b/server/modules/routing/binlogrouter/blr_slave.c index 4c5de5083..a0203b603 100644 --- a/server/modules/routing/binlogrouter/blr_slave.c +++ b/server/modules/routing/binlogrouter/blr_slave.c @@ -105,6 +105,7 @@ typedef struct const char *binlogdir; /* Binlog files cache dir */ bool extra_info; /* Add extra ouput info */ DCB *client; /* Connected client DCB */ + bool use_tree; /* Binlog structure type */ } BINARY_LOG_DATA_RESULT; extern void poll_fake_write_event(DCB *dcb); @@ -8140,7 +8141,9 @@ blr_show_binary_logs(ROUTER_INSTANCE *router, "rep_domain, " "server_id " "FROM gtid_maps " - "GROUP BY binlog_file " + "GROUP BY rep_domain, " + "server_id, " + "binlog_file " "ORDER BY id ASC;"; int seqno; char *errmsg = NULL; @@ -8190,6 +8193,7 @@ blr_show_binary_logs(ROUTER_INSTANCE *router, result.last_file = NULL; result.binlogdir = router->binlogdir; result.extra_info = extra_info; + result.use_tree = router->storage_type == BLR_BINLOG_STORAGE_TREE; /** * Second part of result set: @@ -8368,11 +8372,11 @@ static int binary_logs_select_cb(void *data, * Let's get the real size by calling blr_slave_get_file_size() */ - // Get filename full-path, use prefix only if requested by the caller + // Get filename full-path, use prefix only if binlog_structure is TREE blr_get_file_fullpath(values[0], data_set->binlogdir, file_path, - data_set->extra_info ? + data_set->use_tree ? t_prefix : NULL); //Get the file size