From b32af705e6a663f0026d32782d17036e8cd7a530 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 23 Nov 2016 10:36:11 +0200 Subject: [PATCH] Extend routing capabilities The routing capabilities now define the type of output the reply processing chain expects. Currently, this only consists of two capabilities; complete packet output and contiguous buffer output. The latter implies the former. --- include/maxscale/routing.h | 5 +++++ server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/maxscale/routing.h b/include/maxscale/routing.h index 1544414a2..c16c2eb81 100644 --- a/include/maxscale/routing.h +++ b/include/maxscale/routing.h @@ -36,6 +36,11 @@ typedef enum routing_capability /**< The transaction state and autocommit mode of the session are tracked; implies RCAP_TYPE_CONTIGUOUS_INPUT and RCAP_TYPE_STMT_INPUT. */ RCAP_TYPE_TRANSACTION_TRACKING = 0x0007, /* 0b0000000000000111 */ + /**< Responses are delivered one per buffer. */ + RCAP_TYPE_STMT_OUTPUT = 0x0010, /* 0b0000000000010000 */ + /**< Each delivered buffer is contiguous; implies RCAP_TYPE_STMT_OUTPUT. */ + RCAP_TYPE_CONTIGUOUS_OUTPUT = 0x0030, /* 0b0000000000110000 */ + } routing_capability_t; #define RCAP_TYPE_NONE 0 diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 555d8f385..b3c3feb85 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -769,10 +769,10 @@ gw_read_and_write(DCB *dcb) ss_dassert(read_buffer != NULL); } - /** Ask what type of input the router/filter chain expects */ + /** Ask what type of output the router/filter chain expects */ uint64_t capabilities = service_get_capabilities(session->service); - if (rcap_type_required(capabilities, RCAP_TYPE_STMT_INPUT)) + if (rcap_type_required(capabilities, RCAP_TYPE_STMT_OUTPUT)) { GWBUF *tmp = modutil_get_complete_packets(&read_buffer); /* Put any residue into the read queue */ @@ -787,7 +787,7 @@ gw_read_and_write(DCB *dcb) read_buffer = tmp; - if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT)) + if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_OUTPUT)) { if ((tmp = gwbuf_make_contiguous(read_buffer))) {