Merge branch 'develop-2.0-merge' into develop

This commit is contained in:
Markus Makela
2016-11-16 12:57:38 +02:00
26 changed files with 623 additions and 243 deletions

View File

@ -1731,7 +1731,7 @@ process_config_update(CONFIG_CONTEXT *context)
if (connection_timeout)
{
serviceSetTimeout(service, config_truth_value(connection_timeout));
serviceSetTimeout(service, atoi(connection_timeout));
}
if (strlen(max_connections))

View File

@ -1678,6 +1678,38 @@ dcb_grab_writeq(DCB *dcb, bool first_time)
return local_writeq;
}
static void log_illegal_dcb(DCB *dcb)
{
const char *connected_to;
switch (dcb->dcb_role)
{
case DCB_ROLE_BACKEND_HANDLER:
connected_to = dcb->server->unique_name;
break;
case DCB_ROLE_CLIENT_HANDLER:
connected_to = dcb->remote;
break;
case DCB_ROLE_INTERNAL:
connected_to = "Internal DCB";
break;
case DCB_ROLE_SERVICE_LISTENER:
connected_to = dcb->service->name;
break;
default:
connected_to = "Illegal DCB role";
break;
}
MXS_ERROR("[dcb_close] Error : Removing DCB %p but it is in state %s "
"which is not legal for a call to dcb_close. The DCB is connected to: %s",
dcb, STRDCBSTATE(dcb->state), connected_to);
}
/**
* Removes dcb from poll set, and adds it to zombies list. As a consequence,
* dcb first moves to DCB_STATE_NOPOLLING, and then to DCB_STATE_ZOMBIE state.
@ -1697,11 +1729,7 @@ dcb_close(DCB *dcb)
if (DCB_STATE_UNDEFINED == dcb->state
|| DCB_STATE_DISCONNECTED == dcb->state)
{
MXS_ERROR("%lu [dcb_close] Error : Removing DCB %p but was in state %s "
"which is not legal for a call to dcb_close. ",
pthread_self(),
dcb,
STRDCBSTATE(dcb->state));
log_illegal_dcb(dcb);
raise(SIGABRT);
}

View File

@ -800,8 +800,14 @@ mon_get_event_type(MONITOR_SERVERS* node)
}
else
{
/** These are used to detect whether we actually lost something or
* just transitioned from one state to another */
unsigned int prev_bits = prev & (SERVER_MASTER | SERVER_SLAVE);
unsigned int present_bits = present & (SERVER_MASTER | SERVER_SLAVE);
/* Was running and still is */
if (prev & (SERVER_MASTER | SERVER_SLAVE | SERVER_JOINED | SERVER_NDB))
if ((!prev_bits || !present_bits || prev_bits == present_bits) &&
prev & (SERVER_MASTER | SERVER_SLAVE | SERVER_JOINED | SERVER_NDB))
{
/* We used to know what kind of server it was */
event_type = LOSS_EVENT;
@ -1252,3 +1258,16 @@ bool monitor_serialize_servers(const MONITOR *monitor)
return rval;
}
void mon_hangup_failed_servers(MONITOR *monitor)
{
for (MONITOR_SERVERS *ptr = monitor->databases; ptr; ptr = ptr->next)
{
if (mon_status_changed(ptr) &&
(!(SERVER_IS_RUNNING(ptr->server)) ||
!(SERVER_IS_IN_CLUSTER(ptr->server))))
{
dcb_hangup_foreach(ptr->server);
}
}
}

View File

@ -163,8 +163,6 @@ MYSQL *mxs_mysql_real_connect(MYSQL *con, SERVER *server, const char *user, cons
if (listener)
{
GATEWAY_CONF* config = config_get_global_options();
// mysql_ssl_set always returns true.
mysql_ssl_set(con, listener->ssl_key, listener->ssl_cert, listener->ssl_ca_cert, NULL, NULL);
}

View File

@ -51,6 +51,9 @@
#include <maxscale/modules.h>
#include <maxscale/gwdirs.h>
/** The latin1 charset */
#define SERVER_DEFAULT_CHARSET 0x08
static SPINLOCK server_spin = SPINLOCK_INIT;
static SERVER *allServers = NULL;
@ -129,6 +132,7 @@ SERVER* server_alloc(const char *name, const char *address, unsigned short port,
server->monuser[0] = '\0';
server->monpw[0] = '\0';
server->is_active = true;
server->charset = SERVER_DEFAULT_CHARSET;
spinlock_init(&server->persistlock);
spinlock_acquire(&server_spin);