MXS-2302: Remove unused hintfilter code
Also moved the token types into the correct file.
This commit is contained in:
@ -119,13 +119,10 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
|
|||||||
*/
|
*/
|
||||||
static MXS_FILTER_SESSION* newSession(MXS_FILTER* instance, MXS_SESSION* session)
|
static MXS_FILTER_SESSION* newSession(MXS_FILTER* instance, MXS_SESSION* session)
|
||||||
{
|
{
|
||||||
HINT_INSTANCE* my_instance = (HINT_INSTANCE*)instance;
|
|
||||||
HINT_SESSION* my_session;
|
HINT_SESSION* my_session;
|
||||||
|
|
||||||
if ((my_session = static_cast<HINT_SESSION*>(MXS_CALLOC(1, sizeof(HINT_SESSION)))) != NULL)
|
if ((my_session = static_cast<HINT_SESSION*>(MXS_CALLOC(1, sizeof(HINT_SESSION)))) != NULL)
|
||||||
{
|
{
|
||||||
my_session->query_len = 0;
|
|
||||||
my_session->request = NULL;
|
|
||||||
my_session->stack = NULL;
|
my_session->stack = NULL;
|
||||||
my_session->named_hints = NULL;
|
my_session->named_hints = NULL;
|
||||||
}
|
}
|
||||||
@ -146,12 +143,6 @@ static void closeSession(MXS_FILTER* instance, MXS_FILTER_SESSION* session)
|
|||||||
NAMEDHINTS* named_hints;
|
NAMEDHINTS* named_hints;
|
||||||
HINTSTACK* hint_stack;
|
HINTSTACK* hint_stack;
|
||||||
|
|
||||||
if (my_session->request)
|
|
||||||
{
|
|
||||||
gwbuf_free(my_session->request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Free named hints */
|
/** Free named hints */
|
||||||
named_hints = my_session->named_hints;
|
named_hints = my_session->named_hints;
|
||||||
|
|
||||||
@ -208,8 +199,6 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF*
|
|||||||
|
|
||||||
if (modutil_is_SQL(queue) && gwbuf_length(queue) > 5)
|
if (modutil_is_SQL(queue) && gwbuf_length(queue) > 5)
|
||||||
{
|
{
|
||||||
my_session->request = NULL;
|
|
||||||
my_session->query_len = 0;
|
|
||||||
process_hints(my_session, queue);
|
process_hints(my_session, queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,8 +221,6 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF*
|
|||||||
*/
|
*/
|
||||||
static void diagnostic(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb)
|
static void diagnostic(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb)
|
||||||
{
|
{
|
||||||
HINT_INSTANCE* my_instance = (HINT_INSTANCE*)instance;
|
|
||||||
HINT_SESSION* my_session = (HINT_SESSION*)fsession;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,25 @@
|
|||||||
* Code for parsing SQL comments and processing them into MaxScale hints
|
* Code for parsing SQL comments and processing them into MaxScale hints
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Parser tokens for the hint parser */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TOK_MAXSCALE = 1,
|
||||||
|
TOK_PREPARE,
|
||||||
|
TOK_START,
|
||||||
|
TOK_STOP,
|
||||||
|
TOK_EQUAL,
|
||||||
|
TOK_STRING,
|
||||||
|
TOK_ROUTE,
|
||||||
|
TOK_TO,
|
||||||
|
TOK_MASTER,
|
||||||
|
TOK_SLAVE,
|
||||||
|
TOK_SERVER,
|
||||||
|
TOK_LAST,
|
||||||
|
TOK_LINEBRK,
|
||||||
|
TOK_END
|
||||||
|
} TOKEN_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hint_pop - pop the hint off the top of the stack if it is not empty
|
* hint_pop - pop the hint off the top of the stack if it is not empty
|
||||||
*
|
*
|
||||||
|
@ -17,32 +17,6 @@
|
|||||||
|
|
||||||
MXS_BEGIN_DECLS
|
MXS_BEGIN_DECLS
|
||||||
|
|
||||||
/* Parser tokens for the hint parser */
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
TOK_MAXSCALE = 1,
|
|
||||||
TOK_PREPARE,
|
|
||||||
TOK_START,
|
|
||||||
TOK_STOP,
|
|
||||||
TOK_EQUAL,
|
|
||||||
TOK_STRING,
|
|
||||||
TOK_ROUTE,
|
|
||||||
TOK_TO,
|
|
||||||
TOK_MASTER,
|
|
||||||
TOK_SLAVE,
|
|
||||||
TOK_SERVER,
|
|
||||||
TOK_LAST,
|
|
||||||
TOK_LINEBRK,
|
|
||||||
TOK_END
|
|
||||||
} TOKEN_VALUE;
|
|
||||||
|
|
||||||
/* The tokenising return type */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
TOKEN_VALUE token; // The token itself
|
|
||||||
char* value; // The string version of the token
|
|
||||||
} HINT_TOKEN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named hint set.
|
* A named hint set.
|
||||||
*
|
*
|
||||||
@ -84,27 +58,10 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
MXS_DOWNSTREAM down;
|
MXS_DOWNSTREAM down;
|
||||||
GWBUF* request;
|
|
||||||
int query_len;
|
|
||||||
HINTSTACK* stack;
|
HINTSTACK* stack;
|
||||||
NAMEDHINTS* named_hints; /* The named hints defined in this session */
|
NAMEDHINTS* named_hints; /* The named hints defined in this session */
|
||||||
} HINT_SESSION;
|
} HINT_SESSION;
|
||||||
|
|
||||||
/* Some useful macros */
|
|
||||||
#define CURRENT_HINT(session) \
|
|
||||||
((session)->stack \
|
|
||||||
? (session)->stack->hints : NULL)
|
|
||||||
|
|
||||||
/* Hint Parser State Machine */
|
|
||||||
#define HS_INIT 0
|
|
||||||
#define HS_ROUTE 1
|
|
||||||
#define HS_ROUTE1 2
|
|
||||||
#define HS_ROUTE_SERVER 3
|
|
||||||
#define HS_NAME 4
|
|
||||||
#define HS_PVALUE 5
|
|
||||||
#define HS_PREPARE 6
|
|
||||||
|
|
||||||
extern HINT* hint_parser(HINT_SESSION* session, GWBUF* request);
|
|
||||||
NAMEDHINTS* free_named_hint(NAMEDHINTS* named_hint);
|
NAMEDHINTS* free_named_hint(NAMEDHINTS* named_hint);
|
||||||
HINTSTACK* free_hint_stack(HINTSTACK* hint_stack);
|
HINTSTACK* free_hint_stack(HINTSTACK* hint_stack);
|
||||||
void process_hints(HINT_SESSION* session, GWBUF* buffer);
|
void process_hints(HINT_SESSION* session, GWBUF* buffer);
|
||||||
|
Reference in New Issue
Block a user