MXS-958: a new binlog file is created after CHANGE MASTER if there is… … no pending transaction
Binlog server is already configured: if there is no pending transaction a new binlog file is created after CHANGE MASTER. If as START SLAVE is issued replication starts as usuale. If maxscale is restarted the replication starts using the new created file.
This commit is contained in:
@ -1044,11 +1044,8 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
|||||||
{
|
{
|
||||||
MXS_INFO("%s: 'master.ini' created, binlog file '%s' created", router->service->name, router->binlog_name);
|
MXS_INFO("%s: 'master.ini' created, binlog file '%s' created", router->service->name, router->binlog_name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!router->trx_safe)
|
|
||||||
{
|
|
||||||
blr_master_free_config(current_master);
|
blr_master_free_config(current_master);
|
||||||
|
return blr_slave_send_ok(router, slave);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (router->trx_safe && router->pending_transaction)
|
if (router->trx_safe && router->pending_transaction)
|
||||||
@ -1064,18 +1061,25 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
|||||||
|
|
||||||
return blr_slave_send_warning_message(router, slave, message);
|
return blr_slave_send_warning_message(router, slave, message);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
blr_master_free_config(current_master);
|
|
||||||
return blr_slave_send_ok(router, slave);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
blr_master_free_config(current_master);
|
||||||
else
|
|
||||||
|
/*
|
||||||
|
* The CHAMGE MASTER command might specify a new binlog file.
|
||||||
|
* Let's create the binlogfile specified in MASTER_LOG_FILE
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strlen(router->prevbinlog) && strcmp(router->prevbinlog, router->binlog_name))
|
||||||
{
|
{
|
||||||
return blr_slave_send_ok(router, slave);
|
if (blr_file_new_binlog(router, router->binlog_name))
|
||||||
|
{
|
||||||
|
MXS_INFO("%s: created new binlog file '%s' by 'CHANGE MASTER TO' command",
|
||||||
|
router->service->name, router->binlog_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return blr_slave_send_ok(router, slave);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3456,24 +3460,23 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
|||||||
/* Send warning message to mysql command */
|
/* Send warning message to mysql command */
|
||||||
blr_slave_send_warning_message(router, slave, msg);
|
blr_slave_send_warning_message(router, slave, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create new one */
|
|
||||||
blr_file_new_binlog(router, router->binlog_name);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/* No file has beem opened, create a new binlog file */
|
||||||
if (router->binlog_fd == -1)
|
if (router->binlog_fd == -1)
|
||||||
{
|
{
|
||||||
/* create new one */
|
|
||||||
blr_file_new_binlog(router, router->binlog_name);
|
blr_file_new_binlog(router, router->binlog_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* use existing one */
|
/* A new binlog file has been created by CHANGE MASTER TO
|
||||||
blr_file_append(router, router->binlog_name);
|
* if no pending transaction is detected.
|
||||||
}
|
* use the existing one.
|
||||||
|
*/
|
||||||
|
blr_file_use_binlog(router, router->binlog_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Start the replication from Master server */
|
||||||
blr_start_master(router);
|
blr_start_master(router);
|
||||||
|
|
||||||
MXS_NOTICE("%s: START SLAVE executed by %s@%s. Trying connection to master %s:%d, "
|
MXS_NOTICE("%s: START SLAVE executed by %s@%s. Trying connection to master %s:%d, "
|
||||||
|
Reference in New Issue
Block a user