Merge from develop
Merge from develop
This commit is contained in:
@ -51,6 +51,7 @@
|
||||
* 11/07/2016 Massimiliano Pinto Added SSL backend support
|
||||
* 22/07/2016 Massimiliano Pinto Added semi_sync replication support
|
||||
* 16/08/2016 Massimiliano Pinto Addition of Start Encription Event description
|
||||
* 08/11/2016 Massimiliano Pinto Added destroyInstance()
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -109,6 +110,7 @@ static int blr_check_binlog(ROUTER_INSTANCE *router);
|
||||
int blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug);
|
||||
void blr_master_close(ROUTER_INSTANCE *);
|
||||
void blr_free_ssl_data(ROUTER_INSTANCE *inst);
|
||||
static void destroyInstance(ROUTER *instance);
|
||||
|
||||
/** The module object definition */
|
||||
static ROUTER_OBJECT MyObject =
|
||||
@ -121,7 +123,8 @@ static ROUTER_OBJECT MyObject =
|
||||
diagnostics,
|
||||
clientReply,
|
||||
errorReply,
|
||||
getCapabilities
|
||||
getCapabilities,
|
||||
destroyInstance
|
||||
};
|
||||
|
||||
static void stats_func(void *);
|
||||
@ -583,7 +586,8 @@ createInstance(SERVICE *service, char **options)
|
||||
{
|
||||
SERVER *server;
|
||||
SSL_LISTENER *ssl_cfg;
|
||||
server = server_alloc("_none_", "MySQLBackend", 3306, "MySQLBackendAuth", NULL);
|
||||
server = server_alloc("binlog_router_master_host", "_none_", 3306,
|
||||
"MySQLBackend", "MySQLBackendAuth", NULL);
|
||||
if (server == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Error for server_alloc in createInstance",
|
||||
@ -615,7 +619,6 @@ createInstance(SERVICE *service, char **options)
|
||||
server->server_ssl = ssl_cfg;
|
||||
|
||||
/* Set server unique name */
|
||||
server_set_unique_name(server, "binlog_router_master_host");
|
||||
/* Add server to service backend list */
|
||||
serviceAddBackend(inst->service, server);
|
||||
}
|
||||
@ -2293,3 +2296,65 @@ blr_free_ssl_data(ROUTER_INSTANCE *inst)
|
||||
inst->service->dbref->server->server_ssl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy binlog server instance
|
||||
*
|
||||
* @param service The service this router instance belongs to
|
||||
*/
|
||||
static void
|
||||
destroyInstance(ROUTER *instance)
|
||||
{
|
||||
ROUTER_INSTANCE *inst = (ROUTER_INSTANCE *) instance;
|
||||
|
||||
MXS_DEBUG("Destroying instance of router %s for service %s",
|
||||
inst->service->routerModule, inst->service->name);
|
||||
|
||||
/* Check whether master connection is active */
|
||||
if (inst->master)
|
||||
{
|
||||
if (inst->master->fd != -1 && inst->master->state == DCB_STATE_POLLING)
|
||||
{
|
||||
blr_master_close(inst);
|
||||
}
|
||||
}
|
||||
|
||||
spinlock_acquire(&inst->lock);
|
||||
|
||||
if (inst->master_state != BLRM_UNCONFIGURED)
|
||||
{
|
||||
inst->master_state = BLRM_SLAVE_STOPPED;
|
||||
}
|
||||
|
||||
if (inst->client)
|
||||
{
|
||||
if (inst->client->state == DCB_STATE_POLLING)
|
||||
{
|
||||
dcb_close(inst->client);
|
||||
inst->client = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard the queued residual data */
|
||||
while (inst->residual)
|
||||
{
|
||||
inst->residual = gwbuf_consume(inst->residual, GWBUF_LENGTH(inst->residual));
|
||||
}
|
||||
inst->residual = NULL;
|
||||
|
||||
MXS_INFO("%s is being stopped by MaxScale shudown. Disconnecting from master %s:%d, "
|
||||
"read up to log %s, pos %lu, transaction safe pos %lu",
|
||||
inst->service->name,
|
||||
inst->service->dbref->server->name,
|
||||
inst->service->dbref->server->port,
|
||||
inst->binlog_name, inst->current_pos, inst->binlog_position);
|
||||
|
||||
if (inst->trx_safe && inst->pending_transaction)
|
||||
{
|
||||
MXS_WARNING("%s stopped by shutdown: detected mid-transaction in binlog file %s, "
|
||||
"pos %lu, incomplete transaction starts at pos %lu",
|
||||
inst->service->name, inst->binlog_name, inst->current_pos, inst->binlog_position);
|
||||
}
|
||||
|
||||
spinlock_release(&inst->lock);
|
||||
}
|
||||
|
@ -103,12 +103,12 @@ int main(int argc, char **argv) {
|
||||
s = strtok_r(NULL, ",", &lasts);
|
||||
}
|
||||
set_libdir(MXS_STRDUP_A("../../../authenticator/"));
|
||||
server = server_alloc("_none_", "MySQLBackend", 3306, "MySQLBackendAuth", NULL);
|
||||
server = server_alloc("binlog_router_master_host", "_none_", 3306,
|
||||
"MySQLBackend", "MySQLBackendAuth", NULL);
|
||||
if (server == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
server_set_unique_name(server, "binlog_router_master_host");
|
||||
serviceAddBackend(service, server);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user