MXS-1220: Make the parameters of the diagnostic entry points const
The diagnostic entry points should not modify the state of the object being diagnosed.
This commit is contained in:
committed by
Markus Mäkelä
parent
c17c451fb5
commit
076599ee5e
2
server/modules/filter/cache/cachefilter.cc
vendored
2
server/modules/filter/cache/cachefilter.cc
vendored
@ -306,7 +306,7 @@ CacheFilterSession* CacheFilter::newSession(MXS_SESSION* pSession)
|
||||
}
|
||||
|
||||
// static
|
||||
json_t* CacheFilter::diagnostics()
|
||||
json_t* CacheFilter::diagnostics() const
|
||||
{
|
||||
return m_sCache->show();
|
||||
}
|
||||
|
||||
2
server/modules/filter/cache/cachefilter.hh
vendored
2
server/modules/filter/cache/cachefilter.hh
vendored
@ -37,7 +37,7 @@ public:
|
||||
|
||||
CacheFilterSession* newSession(MXS_SESSION* pSession);
|
||||
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
|
||||
uint64_t getCapabilities();
|
||||
|
||||
|
||||
@ -447,7 +447,7 @@ int CacheFilterSession::clientReply(GWBUF* pData)
|
||||
return rv;
|
||||
}
|
||||
|
||||
json_t* CacheFilterSession::diagnostics()
|
||||
json_t* CacheFilterSession::diagnostics() const
|
||||
{
|
||||
// Not printing anything. Session of the same instance share the same cache, in
|
||||
// which case the same information would be printed once per session, or all
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
/**
|
||||
* Print diagnostics of the session cache.
|
||||
*/
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
|
||||
private:
|
||||
int handle_expecting_fields();
|
||||
|
||||
@ -55,7 +55,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
#define CCR_DEFAULT_TIME "60"
|
||||
@ -358,7 +358,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
* @param fsession Filter session, may be NULL
|
||||
* @param dcb The DCB for diagnostic output
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
CCR_INSTANCE *my_instance = (CCR_INSTANCE *)instance;
|
||||
json_t* rval = json_object();
|
||||
|
||||
@ -101,7 +101,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
/**
|
||||
@ -2504,7 +2504,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
* @param dcb The DCB for diagnostic output
|
||||
*/
|
||||
static json_t*
|
||||
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
return rules_to_json(thr_rules);
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
/**
|
||||
@ -222,7 +222,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t*
|
||||
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream);
|
||||
static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER *instance);
|
||||
static int32_t clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF *reply);
|
||||
static bool extract_insert_target(GWBUF *buffer, char* target, int len);
|
||||
@ -498,7 +498,7 @@ static int32_t clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GW
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
DS_INSTANCE *my_instance = (DS_INSTANCE*)instance;
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, M
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
|
||||
static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static int32_t clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER *instance);
|
||||
|
||||
/**
|
||||
@ -624,7 +624,7 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
LUA_INSTANCE *my_instance = (LUA_INSTANCE *)instance;
|
||||
json_t* rval = json_object();
|
||||
|
||||
@ -138,7 +138,7 @@ MaskingFilterSession* MaskingFilter::newSession(MXS_SESSION* pSession)
|
||||
}
|
||||
|
||||
// static
|
||||
json_t* MaskingFilter::diagnostics()
|
||||
json_t* MaskingFilter::diagnostics() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
|
||||
MaskingFilterSession* newSession(MXS_SESSION* pSession);
|
||||
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
|
||||
uint64_t getCapabilities();
|
||||
|
||||
|
||||
@ -67,8 +67,8 @@ static int routeQuery(MXS_FILTER *instance,
|
||||
static int clientReply(MXS_FILTER *instance,
|
||||
MXS_FILTER_SESSION *sdata,
|
||||
GWBUF *queue);
|
||||
static json_t* diagnostics(MXS_FILTER *instance,
|
||||
MXS_FILTER_SESSION *sdata);
|
||||
static json_t* diagnostics(const MXS_FILTER *instance,
|
||||
const MXS_FILTER_SESSION *sdata);
|
||||
static uint64_t getCapabilities(MXS_FILTER *instance);
|
||||
|
||||
enum maxrows_return_mode
|
||||
@ -487,7 +487,7 @@ static int clientReply(MXS_FILTER *instance,
|
||||
* @param fsession Filter session, may be NULL
|
||||
* @param dcb The DCB for diagnostic output
|
||||
*/
|
||||
static json_t* diagnostics(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata)
|
||||
static json_t* diagnostics(const MXS_FILTER *instance, const MXS_FILTER_SESSION *sdata)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER *instance);
|
||||
|
||||
/**
|
||||
@ -1484,7 +1484,7 @@ static int clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t*
|
||||
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
MQ_INSTANCE *my_instance = (MQ_INSTANCE*)instance;
|
||||
json_t* rval = json_object();
|
||||
|
||||
@ -311,7 +311,7 @@ RegexHintFilter::create(const char* name, char** options, MXS_CONFIG_PARAMETER*
|
||||
*
|
||||
* @param dcb The DCB for diagnostic output
|
||||
*/
|
||||
json_t* RegexHintFSession::diagnostics()
|
||||
json_t* RegexHintFSession::diagnostics() const
|
||||
{
|
||||
|
||||
json_t* rval = m_fil_inst.diagnostics(); /* Print overall diagnostics */
|
||||
@ -329,7 +329,7 @@ json_t* RegexHintFSession::diagnostics()
|
||||
*
|
||||
* @param dcb The DCB for diagnostic output
|
||||
*/
|
||||
json_t* RegexHintFilter::diagnostics()
|
||||
json_t* RegexHintFilter::diagnostics() const
|
||||
{
|
||||
json_t* rval = json_object();
|
||||
|
||||
@ -340,12 +340,12 @@ json_t* RegexHintFilter::diagnostics()
|
||||
{
|
||||
json_t* arr = json_array();
|
||||
|
||||
for (MappingArray::iterator it = m_mapping.begin(); it != m_mapping.end(); it++)
|
||||
for (MappingArray::const_iterator it = m_mapping.begin(); it != m_mapping.end(); it++)
|
||||
{
|
||||
json_t* obj = json_object();
|
||||
json_t* targets = json_array();
|
||||
|
||||
for (StringArray::iterator it2 = it->m_targets.begin(); it2 != it->m_targets.end(); it2++)
|
||||
for (StringArray::const_iterator it2 = it->m_targets.begin(); it2 != it->m_targets.end(); it2++)
|
||||
{
|
||||
json_array_append_new(targets, json_string(it2->c_str()));
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
static RegexHintFilter* create(const char* zName, char** pzOptions,
|
||||
MXS_CONFIG_PARAMETER* ppParams);
|
||||
RegexHintFSession* newSession(MXS_SESSION *session);
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
uint64_t getCapabilities();
|
||||
const RegexToServers* find_servers(char* sql, int sql_len, pcre2_match_data* mdata);
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
pcre2_match_data* md);
|
||||
~RegexHintFSession();
|
||||
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
int routeQuery(GWBUF* buffer);
|
||||
};
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ NullFilterSession* NullFilter::newSession(MXS_SESSION* pSession)
|
||||
}
|
||||
|
||||
// static
|
||||
json_t* NullFilter::diagnostics()
|
||||
json_t* NullFilter::diagnostics() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public:
|
||||
|
||||
NullFilterSession* newSession(MXS_SESSION* pSession);
|
||||
|
||||
json_t* diagnostics();
|
||||
json_t* diagnostics() const;
|
||||
|
||||
uint64_t getCapabilities();
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
/**
|
||||
@ -579,7 +579,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
QLA_INSTANCE *my_instance = (QLA_INSTANCE*)instance;
|
||||
QLA_SESSION *my_session = (QLA_SESSION*)fsession;
|
||||
|
||||
@ -48,7 +48,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
|
||||
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
static char *regex_replace(const char *sql, pcre2_code *re, pcre2_match_data *study,
|
||||
@ -377,7 +377,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
REGEX_INSTANCE *my_instance = (REGEX_INSTANCE*)instance;
|
||||
REGEX_SESSION *my_session = (REGEX_SESSION*)fsession;
|
||||
|
||||
@ -106,7 +106,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
/**
|
||||
@ -698,7 +698,7 @@ clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF *reply)
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
TEE_INSTANCE *my_instance = (TEE_INSTANCE*)instance;
|
||||
TEE_SESSION *my_session = (TEE_SESSION*)fsession;
|
||||
|
||||
@ -58,7 +58,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
|
||||
/**
|
||||
@ -574,7 +574,7 @@ clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *reply)
|
||||
* @param instance The filter instance
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
TOPN_INSTANCE *my_instance = (TOPN_INSTANCE*)instance;
|
||||
TOPN_SESSION *my_session = (TOPN_SESSION*)fsession;
|
||||
|
||||
@ -85,7 +85,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession
|
||||
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
|
||||
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
|
||||
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
|
||||
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
|
||||
static uint64_t getCapabilities(MXS_FILTER* instance);
|
||||
static void checkNamedPipe(void *args);
|
||||
|
||||
@ -574,7 +574,7 @@ clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *reply)
|
||||
* @param fsession Filter session, may be NULL
|
||||
*/
|
||||
static json_t*
|
||||
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
|
||||
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
|
||||
{
|
||||
TPM_INSTANCE *my_instance = (TPM_INSTANCE*)instance;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user