diff --git a/server/modules/routing/binlog/blr.c b/server/modules/routing/binlog/blr.c index bacadea31..1367019f6 100644 --- a/server/modules/routing/binlog/blr.c +++ b/server/modules/routing/binlog/blr.c @@ -211,24 +211,27 @@ int rc = 0; * We only support one server behind this router, since the server is * the master from which we replicate binlog records. Therefore check * that only one server has been defined. - * - * A later improvement will be to define multiple servers and have the - * router use the information that is supplied by the monitor to find - * which of these servers is currently the master and replicate from - * that server. */ - if (service->dbref == NULL || service->dbref->next != NULL) + if (service->dbref != NULL) { - skygw_log_write(LE, - "%s: Error : Exactly one database server may be " - "for use with the binlog router.", - service->name); - return NULL; + LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR, + "%s: Warning: backend database server is provided by master.ini file " + "for use with the binlog router." + " Server section is no longer required.", + service->name))); + + server_free(service->dbref->server); + free(service->dbref); + service->dbref = NULL; } if ((inst = calloc(1, sizeof(ROUTER_INSTANCE))) == NULL) { - return NULL; - } + LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR, + "%s: Error: failed to allocate memory for router instance.", + service->name))); + + return NULL; + } memset(&inst->stats, 0, sizeof(ROUTER_STATS)); memset(&inst->saved_master, 0, sizeof(MASTER_RESPONSES)); diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index cbd8d78c8..1ce316ebb 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -1161,7 +1161,7 @@ int n_bufs = -1, pn_bufs = -1; int msg_len=0; msg_err = (char *)ptr+7+6; // err msg starts after 7 bytes + 6 of status message msg_len = len-7-6; // msg len is decreased by 7 and 6 - msg_err = (uint8_t *)malloc(msg_len + 1); + msg_err = (char *)malloc(msg_len + 1); strncpy(msg_err, (char *)ptr+7+6, msg_len); /* NULL terminate error string */ *(msg_err+msg_len)='\0';