Remove file from slave

The binlog file is now always opened when it is needed and closed
when we are finished with it. That will remove any potential
file concurrency issues between different threads dealing with
the same slave.
This commit is contained in:
Johan Wikman
2015-12-04 11:43:00 +02:00
committed by MassimilianoPinto
parent 28f05198dd
commit 40cfacfec4
3 changed files with 54 additions and 11 deletions

View File

@ -747,7 +747,9 @@ ROUTER_SLAVE *slave;
spinlock_init(&slave->catch_lock);
slave->dcb = session->client;
slave->router = inst;
#ifdef BLFILE_IN_SLAVE
slave->file = NULL;
#endif
strcpy(slave->binlogfile, "unassigned");
slave->connect_time = time(0);
slave->lastEventTimestamp = 0;
@ -892,8 +894,12 @@ ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_session;
*/
slave->state = BLRS_UNREGISTERED;
#if BLFILE_IN_SLAVE
// TODO: Is it really certain the file can be closed here? If other
// TODO: threads are using the slave instance, bag things will happen. [JWi].
if (slave->file)
blr_close_binlog(router, slave->file);
#endif
/* Unlock */
rses_end_locked_router_action(slave);