First working filters implementaton.

Only downstream filters are supported currently, i.e. no result
set filtering can be done.

A crude QLA (Query Log All) filter is included as a test harness only
This commit is contained in:
Mark Riddoch
2014-05-30 16:45:39 +01:00
parent 7bca4e383f
commit 8d55be4b23
16 changed files with 1158 additions and 51 deletions

View File

@ -57,11 +57,7 @@ static int gw_client_hangup_event(DCB *dcb);
int mysql_send_ok(DCB *dcb, int packet_number, int in_affected_rows, const char* mysql_message);
int MySQLSendHandshake(DCB* dcb);
static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue);
static int route_by_statement(
ROUTER* router_instance,
ROUTER_OBJECT* router,
void* rsession,
GWBUF* read_buf);
static int route_by_statement(SESSION *, GWBUF *);
/*
* The "module object" for the mysqld client protocol module.
@ -765,7 +761,7 @@ int gw_read_client_event(DCB* dcb) {
/** Route COM_QUIT to backend */
if (mysql_command == '\x01') {
router->routeQuery(router_instance, rsession, read_buffer);
SESSION_ROUTE_QUERY(session, read_buffer);
LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG,
"%lu [gw_read_client_event] Routed COM_QUIT to "
@ -783,10 +779,7 @@ int gw_read_client_event(DCB* dcb) {
* Feed each statement completely and separately
* to router.
*/
rc = route_by_statement(router_instance,
router,
rsession,
read_buffer);
rc = route_by_statement(session, read_buffer);
if (read_buffer != NULL)
{
/** add incomplete mysql packet to read queue */
@ -796,9 +789,7 @@ int gw_read_client_event(DCB* dcb) {
else
{
/** Feed whole packet to router */
rc = router->routeQuery(router_instance,
rsession,
read_buffer);
rc = SESSION_ROUTE_QUERY(session, read_buffer);
}
/** succeed */
@ -1339,11 +1330,7 @@ gw_client_hangup_event(DCB *dcb)
* Return 1 in success. If the last packet is incomplete return success but
* leave incomplete packet to readbuf.
*/
static int route_by_statement(
ROUTER* router_instance,
ROUTER_OBJECT* router,
void* rsession,
GWBUF* readbuf)
static int route_by_statement(SESSION *session, GWBUF *readbuf)
{
int rc = -1;
GWBUF* packetbuf;
@ -1355,7 +1342,7 @@ static int route_by_statement(
if (packetbuf != NULL)
{
CHK_GWBUF(packetbuf);
rc = router->routeQuery(router_instance, rsession, packetbuf);
rc = SESSION_ROUTE_QUERY(session, packetbuf);
}
else
{