MXS-2432 Recognize RESET

RESET QUERY CACHE is reported to be a session command, which will
cause it to be sent to all servers. RESET [MASTER|SLAVE] are
classified as write, which will cause them to be sent to the master.

It could be argued that RESET [MASTER|SLAVE] should cause an error
to be sent to the client.
This commit is contained in:
Johan Wikman
2019-04-12 14:27:06 +03:00
parent 3127aa85c5
commit d2c71472b0
5 changed files with 66 additions and 4 deletions

View File

@ -2602,6 +2602,11 @@ public:
m_operation = QUERY_OP_REVOKE;
break;
case TK_RESET:
m_status = QC_QUERY_TOKENIZED;
m_type_mask = (QUERY_TYPE_WRITE | QUERY_TYPE_COMMIT);
break;
case TK_SELECT:
m_status = QC_QUERY_TOKENIZED;
m_type_mask = QUERY_TYPE_READ;
@ -2838,6 +2843,23 @@ public:
}
}
void maxscaleReset(Parse* pParse, int what)
{
mxb_assert(this_thread.initialized);
m_status = QC_QUERY_PARSED;
switch (what)
{
case MXS_RESET_QUERY_CACHE:
m_type_mask = (QUERY_TYPE_SESSION_WRITE | QUERY_TYPE_COMMIT);
break;
default:
mxb_assert(!true);
}
}
void maxscaleSet(Parse* pParse, int scope, mxs_set_t kind, ExprList* pList)
{
mxb_assert(this_thread.initialized);
@ -3448,6 +3470,7 @@ extern "C"
extern void maxscalePrepare(Parse*, Token* pName, Expr* pStmt);
extern void maxscalePrivileges(Parse*, int kind);
extern void maxscaleRenameTable(Parse*, SrcList* pTables);
extern void maxscaleReset(Parse*, int what);
extern void maxscaleSet(Parse*, int scope, mxs_set_t kind, ExprList*);
extern void maxscaleShow(Parse*, MxsShow* pShow);
extern void maxscaleTruncate(Parse*, Token* pDatabase, Token* pName);
@ -4488,6 +4511,16 @@ void maxscalePrivileges(Parse* pParse, int kind)
QC_EXCEPTION_GUARD(pInfo->maxscalePrivileges(pParse, kind));
}
void maxscaleReset(Parse* pParse, int what)
{
QC_TRACE();
QcSqliteInfo* pInfo = this_thread.pInfo;
mxb_assert(pInfo);
QC_EXCEPTION_GUARD(pInfo->maxscaleReset(pParse, what));
}
void maxscaleSet(Parse* pParse, int scope, mxs_set_t kind, ExprList* pList)
{
QC_TRACE();