MXS-1220: Add old diagnostic interface for monitors and authenticators
Added back the old diagnostic entry point in the monitor and authenticator interfaces.
This commit is contained in:
committed by
Markus Mäkelä
parent
07175ed86b
commit
b1294f083c
@ -245,7 +245,18 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
* @param dcb DCB to send output
|
||||
* @param mon The monitor
|
||||
*/
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
static void
|
||||
diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param dcb DCB to send output
|
||||
* @param mon The monitor
|
||||
*/
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *mon)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -263,7 +274,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
diagnostics,
|
||||
diagnostics_json
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
|
||||
@ -49,7 +49,8 @@ static bool warn_erange_on_local_index = true;
|
||||
|
||||
static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *params);
|
||||
static void stopMonitor(MXS_MONITOR *);
|
||||
static json_t* diagnostics(const MXS_MONITOR *);
|
||||
static void diagnostics(DCB *, const MXS_MONITOR *);
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *);
|
||||
static MXS_MONITOR_SERVERS *get_candidate_master(MXS_MONITOR*);
|
||||
static MXS_MONITOR_SERVERS *set_cluster_master(MXS_MONITOR_SERVERS *, MXS_MONITOR_SERVERS *, int);
|
||||
static void disableMasterFailback(void *, int);
|
||||
@ -80,7 +81,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
diagnostics,
|
||||
diagnostics_json
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
@ -218,9 +220,36 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param dcb DCB to send output
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
static void
|
||||
diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
{
|
||||
const GALERA_MONITOR *handle = (const GALERA_MONITOR *) mon->handle;
|
||||
|
||||
dcb_printf(dcb, "Master Failback:\t%s\n", (handle->disableMasterFailback == 1) ? "off" : "on");
|
||||
dcb_printf(dcb, "Available when Donor:\t%s\n", (handle->availableWhenDonor == 1) ? "on" : "off");
|
||||
dcb_printf(dcb, "Master Role Setting Disabled:\t%s\n",
|
||||
handle->disableMasterRoleSetting ? "on" : "off");
|
||||
dcb_printf(dcb, "Set wsrep_sst_donor node list:\t%s\n", (handle->set_donor_nodes == 1) ? "on" : "off");
|
||||
if (handle->cluster_info.c_uuid)
|
||||
{
|
||||
dcb_printf(dcb, "Galera Cluster UUID:\t%s\n", handle->cluster_info.c_uuid);
|
||||
dcb_printf(dcb, "Galera Cluster size:\t%d\n", handle->cluster_info.c_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb_printf(dcb, "Galera Cluster NOT set:\tno member nodes\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *mon)
|
||||
{
|
||||
json_t* rval = json_object();
|
||||
const GALERA_MONITOR *handle = (const GALERA_MONITOR *)mon->handle;
|
||||
|
||||
@ -39,7 +39,8 @@ MXS_MODULE info =
|
||||
|
||||
static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *);
|
||||
static void stopMonitor(MXS_MONITOR *);
|
||||
static json_t* diagnostics(const MXS_MONITOR *);
|
||||
static void diagnostics(DCB *, const MXS_MONITOR *);
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *);
|
||||
static void detectStaleMaster(void *, int);
|
||||
static MXS_MONITOR_SERVERS *get_current_master(MXS_MONITOR *);
|
||||
static bool isMySQLEvent(mxs_monitor_event_t event);
|
||||
@ -60,7 +61,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
diagnostics,
|
||||
diagnostics_json
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
@ -166,9 +168,22 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param dcb DCB to print diagnostics
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
static void diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
{
|
||||
const MM_MONITOR *handle = (const MM_MONITOR *) mon->handle;
|
||||
|
||||
dcb_printf(dcb, "Detect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *mon)
|
||||
{
|
||||
const MM_MONITOR *handle = (const MM_MONITOR *)mon->handle;
|
||||
|
||||
|
||||
@ -48,7 +48,8 @@ static void monitorMain(void *);
|
||||
|
||||
static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER*);
|
||||
static void stopMonitor(MXS_MONITOR *);
|
||||
static json_t* diagnostics(const MXS_MONITOR *);
|
||||
static void diagnostics(DCB *, const MXS_MONITOR *);
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *);
|
||||
static MXS_MONITOR_SERVERS *getServerByNodeId(MXS_MONITOR_SERVERS *, long);
|
||||
static MXS_MONITOR_SERVERS *getSlaveOfNodeId(MXS_MONITOR_SERVERS *, long);
|
||||
static MXS_MONITOR_SERVERS *get_replication_tree(MXS_MONITOR *, int);
|
||||
@ -76,7 +77,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
diagnostics,
|
||||
diagnostics_json
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
@ -310,12 +312,49 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
thread_wait(handle->thread);
|
||||
}
|
||||
|
||||
/**
|
||||
* Daignostic interface
|
||||
*
|
||||
* @param dcb DCB to print diagnostics
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
{
|
||||
const MYSQL_MONITOR *handle = (const MYSQL_MONITOR *)mon->handle;
|
||||
|
||||
dcb_printf(dcb, "MaxScale MonitorId:\t%lu\n", handle->id);
|
||||
dcb_printf(dcb, "Replication lag:\t%s\n", (handle->replicationHeartbeat == 1) ? "enabled" : "disabled");
|
||||
dcb_printf(dcb, "Detect Stale Master:\t%s\n", (handle->detectStaleMaster == 1) ? "enabled" : "disabled");
|
||||
dcb_printf(dcb, "Server information\n\n");
|
||||
|
||||
for (MXS_MONITOR_SERVERS *db = mon->databases; db; db = db->next)
|
||||
{
|
||||
MYSQL_SERVER_INFO *serv_info = hashtable_fetch(handle->server_info, db->server->unique_name);
|
||||
dcb_printf(dcb, "Server: %s\n", db->server->unique_name);
|
||||
dcb_printf(dcb, "Server ID: %d\n", serv_info->server_id);
|
||||
dcb_printf(dcb, "Read only: %s\n", serv_info->read_only ? "ON" : "OFF");
|
||||
dcb_printf(dcb, "Slave configured: %s\n", serv_info->slave_configured ? "YES" : "NO");
|
||||
dcb_printf(dcb, "Slave IO running: %s\n", serv_info->slave_io ? "YES" : "NO");
|
||||
dcb_printf(dcb, "Slave SQL running: %s\n", serv_info->slave_sql ? "YES" : "NO");
|
||||
dcb_printf(dcb, "Master ID: %d\n", serv_info->master_id);
|
||||
dcb_printf(dcb, "Master binlog file: %s\n", serv_info->binlog_name);
|
||||
dcb_printf(dcb, "Master binlog position: %lu\n", serv_info->binlog_pos);
|
||||
|
||||
if (handle->multimaster)
|
||||
{
|
||||
dcb_printf(dcb, "Master group: %d\n", serv_info->group);
|
||||
}
|
||||
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *mon)
|
||||
{
|
||||
json_t* rval = json_object();
|
||||
|
||||
|
||||
@ -41,7 +41,8 @@ static void monitorMain(void *);
|
||||
|
||||
static void *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *params);
|
||||
static void stopMonitor(MXS_MONITOR *);
|
||||
static json_t* diagnostics(const MXS_MONITOR *);
|
||||
static void diagnostics(DCB *, const MXS_MONITOR *);
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *);
|
||||
bool isNdbEvent(mxs_monitor_event_t event);
|
||||
|
||||
|
||||
@ -62,7 +63,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
diagnostics,
|
||||
diagnostics_json
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
@ -170,7 +172,18 @@ stopMonitor(MXS_MONITOR *mon)
|
||||
* @param dcb DCB to send output
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics(const MXS_MONITOR *mon)
|
||||
static void
|
||||
diagnostics(DCB *dcb, const MXS_MONITOR *mon)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic interface
|
||||
*
|
||||
* @param dcb DCB to send output
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static json_t* diagnostics_json(const MXS_MONITOR *mon)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user