From d99cece151defa465cb1848691c99676fa72a84f Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 7 Jan 2016 14:36:52 +0100 Subject: [PATCH] Removed the 16 chars limitation for binlog file name Removed the 16 chars limitation for binlog file name --- server/modules/include/blr.h | 2 +- server/modules/routing/binlog/blr_master.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/modules/include/blr.h b/server/modules/include/blr.h index 58600d259..148e75006 100644 --- a/server/modules/include/blr.h +++ b/server/modules/include/blr.h @@ -45,7 +45,7 @@ #include #include -#define BINLOG_FNAMELEN 16 +#define BINLOG_FNAMELEN 255 #define BLR_PROTOCOL "MySQLBackend" #define BINLOG_MAGIC { 0xfe, 0x62, 0x69, 0x6e } #define BINLOG_NAMEFMT "%s.%06d" diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index fd13823b4..4a6cd2f39 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -731,7 +731,10 @@ blr_make_binlog_dump(ROUTER_INSTANCE *router) { GWBUF *buf; unsigned char *data; -int len = 0x1b; +int binlog_file_len = strlen(router->binlog_name); +/* COM_BINLOG_DUMP needs 11 bytes + binlogname (terminating NULL is not required) */ +int len = 11 + binlog_file_len; + if ((buf = gwbuf_alloc(len + 4)) == NULL) return NULL; @@ -745,8 +748,8 @@ int len = 0x1b; encode_value(&data[9], 0, 16); // Flags encode_value(&data[11], router->serverid, 32); // Server-id of MaxScale - strncpy((char *)&data[15], router->binlog_name, - BINLOG_FNAMELEN); // binlog filename + memcpy((char *)&data[15], router->binlog_name, + binlog_file_len); // binlog filename return buf; }