MXS-1220: Add back the old diagnostic entry point
This makes 2.2 maxadmin backwards compatible with 2.1.
This commit is contained in:
committed by
Markus Mäkelä
parent
bab7957952
commit
dd68069471
@ -82,6 +82,7 @@ typedef struct mxs_authenticator
|
||||
void (*free)(struct dcb *);
|
||||
void (*destroy)(void *);
|
||||
int (*loadusers)(struct servlistener *);
|
||||
void (*diagnostic)(struct dcb*, struct servlistener *);
|
||||
|
||||
/**
|
||||
* @brief Return diagnostic information about the authenticator
|
||||
@ -95,7 +96,7 @@ typedef struct mxs_authenticator
|
||||
*
|
||||
* @see jansson.h
|
||||
*/
|
||||
json_t* (*diagnostic)(const struct servlistener *listener);
|
||||
json_t* (*diagnostic_json)(const struct servlistener *listener);
|
||||
|
||||
/** This entry point was added to avoid calling authenticator functions
|
||||
* directly when a COM_CHANGE_USER command is executed. */
|
||||
|
||||
@ -170,6 +170,15 @@ typedef struct mxs_filter_object
|
||||
*/
|
||||
int32_t (*clientReply)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
|
||||
/**
|
||||
* @brief Called for diagnostic output
|
||||
*
|
||||
* @param instance Filter instance
|
||||
* @param fsession Filter session, NULL if general information about the filter is queried
|
||||
* @param dcb DCB where the diagnostic information should be written
|
||||
*/
|
||||
void (*diagnostics)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
|
||||
|
||||
/**
|
||||
* @brief Called for diagnostic output
|
||||
*
|
||||
@ -180,7 +189,7 @@ typedef struct mxs_filter_object
|
||||
*
|
||||
* @see jansson.h
|
||||
*/
|
||||
json_t* (*diagnostics)(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
json_t* (*diagnostics_json)(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
|
||||
/**
|
||||
* @brief Called to obtain the capabilities of the filter
|
||||
|
||||
@ -144,8 +144,15 @@ public:
|
||||
|
||||
/**
|
||||
* Called for obtaining diagnostics about the filter session.
|
||||
*
|
||||
* @param pDcb The dcb where the diagnostics should be written.
|
||||
*/
|
||||
json_t* diagnostics() const;
|
||||
void diagnostics(DCB *pDcb);
|
||||
|
||||
/**
|
||||
* Called for obtaining diagnostics about the filter session.
|
||||
*/
|
||||
json_t* diagnostics_json() const;
|
||||
|
||||
protected:
|
||||
FilterSession(MXS_SESSION* pSession);
|
||||
@ -272,7 +279,23 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static json_t* diagnostics(const MXS_FILTER* pInstance, const MXS_FILTER_SESSION* pData)
|
||||
static void diagnostics(MXS_FILTER* pInstance, MXS_FILTER_SESSION* pData, DCB* pDcb)
|
||||
{
|
||||
if (pData)
|
||||
{
|
||||
FilterSessionType* pFilterSession = static_cast<FilterSessionType*>(pData);
|
||||
|
||||
MXS_EXCEPTION_GUARD(pFilterSession->diagnostics(pDcb));
|
||||
}
|
||||
else
|
||||
{
|
||||
FilterType* pFilter = static_cast<FilterType*>(pInstance);
|
||||
|
||||
MXS_EXCEPTION_GUARD(pFilter->diagnostics(pDcb));
|
||||
}
|
||||
}
|
||||
|
||||
static json_t* diagnostics_json(const MXS_FILTER* pInstance, const MXS_FILTER_SESSION* pData)
|
||||
{
|
||||
json_t* rval = NULL;
|
||||
|
||||
@ -280,13 +303,13 @@ public:
|
||||
{
|
||||
const FilterSessionType* pFilterSession = static_cast<const FilterSessionType*>(pData);
|
||||
|
||||
MXS_EXCEPTION_GUARD(rval = pFilterSession->diagnostics());
|
||||
MXS_EXCEPTION_GUARD(rval = pFilterSession->diagnostics_json());
|
||||
}
|
||||
else
|
||||
{
|
||||
const FilterType* pFilter = static_cast<const FilterType*>(pInstance);
|
||||
|
||||
MXS_EXCEPTION_GUARD(rval = pFilter->diagnostics());
|
||||
MXS_EXCEPTION_GUARD(rval = pFilter->diagnostics_json());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -326,6 +349,7 @@ MXS_FILTER_OBJECT Filter<FilterType, FilterSessionType>::s_object =
|
||||
&Filter<FilterType, FilterSessionType>::routeQuery,
|
||||
&Filter<FilterType, FilterSessionType>::clientReply,
|
||||
&Filter<FilterType, FilterSessionType>::diagnostics,
|
||||
&Filter<FilterType, FilterSessionType>::diagnostics_json,
|
||||
&Filter<FilterType, FilterSessionType>::getCapabilities,
|
||||
&Filter<FilterType, FilterSessionType>::destroyInstance,
|
||||
};
|
||||
|
||||
@ -78,6 +78,7 @@ typedef struct mxs_monitor_object
|
||||
* @param monitor The monitor object
|
||||
*/
|
||||
void (*stopMonitor)(MXS_MONITOR *monitor);
|
||||
void (*diagnostics)(DCB *, const MXS_MONITOR *);
|
||||
|
||||
/**
|
||||
* @brief Return diagnostic information about the monitor
|
||||
@ -86,7 +87,7 @@ typedef struct mxs_monitor_object
|
||||
*
|
||||
* @see jansson.h
|
||||
*/
|
||||
json_t* (*diagnostics)(const MXS_MONITOR *monitor);
|
||||
json_t* (*diagnostics_json)(const MXS_MONITOR *monitor);
|
||||
} MXS_MONITOR_OBJECT;
|
||||
|
||||
/**
|
||||
|
||||
@ -145,6 +145,15 @@ typedef struct mxs_router_object
|
||||
*/
|
||||
int32_t (*routeQuery)(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Called for diagnostic output
|
||||
*
|
||||
* @param instance Router instance
|
||||
* @param dcb DCB where the diagnostic information should be written
|
||||
*/
|
||||
void (*diagnostics)(MXS_ROUTER *instance, DCB *dcb);
|
||||
|
||||
/**
|
||||
* @brief Called for diagnostic output
|
||||
*
|
||||
@ -154,7 +163,7 @@ typedef struct mxs_router_object
|
||||
*
|
||||
* @see jansson.h
|
||||
*/
|
||||
json_t* (*diagnostics)(const MXS_ROUTER *instance);
|
||||
json_t* (*diagnostics_json)(const MXS_ROUTER *instance);
|
||||
|
||||
/**
|
||||
* @brief Called for each reply packet
|
||||
|
||||
@ -173,13 +173,20 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static json_t* diagnostics(const MXS_ROUTER* pInstance)
|
||||
static void diagnostics(MXS_ROUTER* pInstance, DCB* pDcb)
|
||||
{
|
||||
RouterType* pRouter = static_cast<RouterType*>(pInstance);
|
||||
|
||||
MXS_EXCEPTION_GUARD(pRouter->diagnostics(pDcb));
|
||||
}
|
||||
|
||||
static json_t* diagnostics_json(const MXS_ROUTER* pInstance)
|
||||
{
|
||||
const RouterType* pRouter = static_cast<const RouterType*>(pInstance);
|
||||
|
||||
json_t* rval = NULL;
|
||||
|
||||
MXS_EXCEPTION_GUARD(rval = pRouter->diagnostics());
|
||||
MXS_EXCEPTION_GUARD(rval = pRouter->diagnostics_json());
|
||||
|
||||
return rval;
|
||||
}
|
||||
@ -242,6 +249,7 @@ MXS_ROUTER_OBJECT Router<RouterType, RouterSessionType>::s_object =
|
||||
&Router<RouterType, RouterSessionType>::freeSession,
|
||||
&Router<RouterType, RouterSessionType>::routeQuery,
|
||||
&Router<RouterType, RouterSessionType>::diagnostics,
|
||||
&Router<RouterType, RouterSessionType>::diagnostics_json,
|
||||
&Router<RouterType, RouterSessionType>::clientReply,
|
||||
&Router<RouterType, RouterSessionType>::handleError,
|
||||
&Router<RouterType, RouterSessionType>::getCapabilities,
|
||||
|
||||
@ -115,9 +115,17 @@ int users_default_loadusers(SERV_LISTENER *port);
|
||||
/**
|
||||
* @brief Default authenticator diagnostic function
|
||||
*
|
||||
* @param dcb DCB where data is printed
|
||||
* @param port Port whose data is to be printed
|
||||
*/
|
||||
json_t* users_default_diagnostic(const SERV_LISTENER *port);
|
||||
void users_default_diagnostic(DCB *dcb, SERV_LISTENER *port);
|
||||
|
||||
/**
|
||||
* @brief Default authenticator diagnostic function
|
||||
*
|
||||
* @param port Port whose data is to be printed
|
||||
*/
|
||||
json_t* users_default_diagnostic_json(const SERV_LISTENER *port);
|
||||
|
||||
/**
|
||||
* Print details of the users storage mechanism
|
||||
|
||||
Reference in New Issue
Block a user