Merge branch 'develop' into MAX-324
This commit is contained in:
@ -71,7 +71,6 @@ static char *config_get_value(CONFIG_PARAMETER *, const char *);
|
||||
static int handle_global_item(const char *, const char *);
|
||||
static void global_defaults();
|
||||
static void check_config_objects(CONFIG_CONTEXT *context);
|
||||
static int config_truth_value(char *str);
|
||||
static int internalService(char *router);
|
||||
|
||||
static char *config_file = NULL;
|
||||
@ -1902,14 +1901,14 @@ bool config_set_qualified_param(
|
||||
* @param str String to convert to a boolean
|
||||
* @return Truth value
|
||||
*/
|
||||
static int
|
||||
int
|
||||
config_truth_value(char *str)
|
||||
{
|
||||
if (strcasecmp(str, "true") == 0 || strcasecmp(str, "on") == 0)
|
||||
if (strcasecmp(str, "true") == 0 || strcasecmp(str, "on") == 0 || strcasecmp(str, "yes") == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(str, "false") == 0 || strcasecmp(str, "off") == 0)
|
||||
if (strcasecmp(str, "false") == 0 || strcasecmp(str, "off") == 0 || strcasecmp(str, "no") == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2081,12 +2081,12 @@ dcb_get_next (DCB* dcb)
|
||||
}
|
||||
|
||||
/**
|
||||
* Call all the callbacks on all DCB's that match the reason given
|
||||
* Call all the callbacks on all DCB's that match the server and the reason given
|
||||
*
|
||||
* @param reason The DCB_REASON that triggers the callback
|
||||
*/
|
||||
void
|
||||
dcb_call_foreach(DCB_REASON reason)
|
||||
dcb_call_foreach(struct server* server, DCB_REASON reason)
|
||||
{
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"%lu [dcb_call_foreach]",
|
||||
@ -2106,7 +2106,8 @@ dcb_call_foreach(DCB_REASON reason)
|
||||
|
||||
while (dcb != NULL)
|
||||
{
|
||||
if (dcb->state == DCB_STATE_POLLING)
|
||||
if (dcb->state == DCB_STATE_POLLING && dcb->server &&
|
||||
strcmp(dcb->server->unique_name,server->unique_name) == 0)
|
||||
{
|
||||
dcb_call_callback(dcb, DCB_REASON_NOT_RESPONDING);
|
||||
}
|
||||
|
||||
@ -139,9 +139,12 @@ monitorStart(MONITOR *monitor)
|
||||
void
|
||||
monitorStop(MONITOR *monitor)
|
||||
{
|
||||
if(monitor->state != MONITOR_STATE_STOPPED)
|
||||
{
|
||||
monitor->state = MONITOR_STATE_STOPPING;
|
||||
monitor->module->stopMonitor(monitor->handle);
|
||||
monitor->state = MONITOR_STATE_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -293,6 +293,90 @@ char *stat;
|
||||
spinlock_release(&server_spin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print all servers in Json format to a DCB
|
||||
*
|
||||
* Designed to be called within a debugger session in order
|
||||
* to display all active servers within the gateway
|
||||
*/
|
||||
void
|
||||
dprintAllServersJson(DCB *dcb)
|
||||
{
|
||||
SERVER *ptr;
|
||||
char *stat;
|
||||
int len = 0;
|
||||
int el = 1;
|
||||
|
||||
spinlock_acquire(&server_spin);
|
||||
ptr = allServers;
|
||||
while (ptr)
|
||||
{
|
||||
ptr = ptr->next;
|
||||
len++;
|
||||
}
|
||||
ptr = allServers;
|
||||
dcb_printf(dcb, "[\n");
|
||||
while (ptr)
|
||||
{
|
||||
dcb_printf(dcb, " {\n \"server\": \"%s\",\n",
|
||||
ptr->name);
|
||||
stat = server_status(ptr);
|
||||
dcb_printf(dcb, " \"status\": \"%s\",\n",
|
||||
stat);
|
||||
free(stat);
|
||||
dcb_printf(dcb, " \"protocol\": \"%s\",\n",
|
||||
ptr->protocol);
|
||||
dcb_printf(dcb, " \"port\": \"%d\",\n",
|
||||
ptr->port);
|
||||
if (ptr->server_string)
|
||||
dcb_printf(dcb, " \"version\": \"%s\",\n",
|
||||
ptr->server_string);
|
||||
dcb_printf(dcb, " \"nodeId\": \"%d\",\n",
|
||||
ptr->node_id);
|
||||
dcb_printf(dcb, " \"masterId\": \"%d\",\n",
|
||||
ptr->master_id);
|
||||
if (ptr->slaves) {
|
||||
int i;
|
||||
dcb_printf(dcb, " \"slaveIds\": [ ");
|
||||
for (i = 0; ptr->slaves[i]; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
dcb_printf(dcb, "%li", ptr->slaves[i]);
|
||||
else
|
||||
dcb_printf(dcb, ", %li ", ptr->slaves[i]);
|
||||
}
|
||||
dcb_printf(dcb, "],\n");
|
||||
}
|
||||
dcb_printf(dcb, " \"replDepth\": \"%d\",\n",
|
||||
ptr->depth);
|
||||
if (SERVER_IS_SLAVE(ptr) || SERVER_IS_RELAY_SERVER(ptr)) {
|
||||
if (ptr->rlag >= 0) {
|
||||
dcb_printf(dcb, " \"slaveDelay\": \"%d\",\n", ptr->rlag);
|
||||
}
|
||||
}
|
||||
if (ptr->node_ts > 0) {
|
||||
dcb_printf(dcb, " \"lastReplHeartbeat\": \"%lu\",\n", ptr->node_ts);
|
||||
}
|
||||
dcb_printf(dcb, " \"totalConnections\": \"%d\",\n",
|
||||
ptr->stats.n_connections);
|
||||
dcb_printf(dcb, " \"currentConnections\": \"%d\",\n",
|
||||
ptr->stats.n_current);
|
||||
dcb_printf(dcb, " \"currentOps\": \"%d\"\n",
|
||||
ptr->stats.n_current_ops);
|
||||
if (el < len) {
|
||||
dcb_printf(dcb, " },\n");
|
||||
}
|
||||
else {
|
||||
dcb_printf(dcb, " }\n");
|
||||
}
|
||||
ptr = ptr->next;
|
||||
el++;
|
||||
}
|
||||
dcb_printf(dcb, "]\n");
|
||||
spinlock_release(&server_spin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print server details to a DCB
|
||||
*
|
||||
|
||||
@ -157,7 +157,7 @@ static bool do_hashtest(
|
||||
CHK_HASHTABLE(h);
|
||||
hashtable_free(h);
|
||||
|
||||
return_succp:
|
||||
|
||||
free(val_arr);
|
||||
return succp;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <server.h>
|
||||
|
||||
#include <log_manager.h>
|
||||
/**
|
||||
* test1 Allocate a server and do lots of other things
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user