Added blr_check_binlog at router startup if trx_safe is set

Added blr_check_binlog at router startup if trx_safe is set
This commit is contained in:
MassimilianoPinto
2015-08-07 11:59:15 +02:00
parent e5a2e5cd1f
commit 479e4e3203
4 changed files with 115 additions and 60 deletions

View File

@ -2544,6 +2544,7 @@ blr_stop_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
router->master_state = BLRM_SLAVE_STOPPED;
/* set last_safe_pos */
router->last_safe_pos = router->binlog_position;
/**
@ -2637,7 +2638,7 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
snprintf(msg, 1024, "A transaction is still opened at pos %lu in file %s. Truncating it ... Try START SLAVE again.", router->last_safe_pos, router->prevbinlog);
/* Truncate previous binlog file to safe pos */
/* Truncate previous binlog file to last_safe pos */
snprintf(file, PATH_MAX, "%s/%s", router->binlogdir, router->prevbinlog);
truncate(file, router->last_safe_pos);
@ -2658,7 +2659,6 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
router->pending_transaction = 0;
router->last_safe_pos = 0;
router->last_safe_pos = 0;
router->master_state = BLRM_SLAVE_STOPPED;
router->current_pos = 4;
router->binlog_position = 4;