diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index 843c7d04e..1a4f2eedb 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -1098,6 +1098,8 @@ createInstance(SERVICE *service, char **options) /* Force STOPPED state */ inst->master_state = BLRM_SLAVE_STOPPED; + /* Set current binlog file to empy value */ + *inst->binlog_name = 0; /* Set mysql_errno and error message */ inst->m_errno = BINLOG_FATAL_ERROR_READING; inst->m_errmsg = MXS_STRDUP_A("HY000 Cannot find any GTID" diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index 398367d70..403eb74d3 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -3370,7 +3370,26 @@ static bool blr_handle_missing_files(ROUTER_INSTANCE *router, { return false; } + if (router->fileroot) + { + MXS_FREE(router->fileroot); + } + /* set filestem */ + router->fileroot = MXS_STRNDUP_A(new_file, fptr - new_file); + new_fseqno = atol(fptr + 1); + + if (!*router->binlog_name) + { + MXS_INFO("Fake ROTATE_EVENT comes with %s log file." + " Current router binlog file has not been set yet." + " Skipping creation of empty files" + " before sequence %" PRIu32 "", + new_file, + new_fseqno); + return true; + } + if (*router->binlog_name && (fptr = strrchr(router->binlog_name, '.')) == NULL) {