tee.c:routeQuery cloned partial MySQL packets to be routed to child router. Problems were due to the use of gwbuf_clone and modutil_MySQL_query which clone/examine only the first buffer from the buffer list which composes GWBUF.
modutil.c: Added function modutil_MySQL_query_len which calculates MySQL packet length and the missing bytecount
void session_enable_log(SESSION* ses, logfile_id_t id)
and
void session_disable_log(SESSION* ses, logfile_id_t id)
Which switch specific log type on/off if the log type in question is not generally enabled.
Each thread carries a thread-specific struct log_info_t which includes members for current session id and bitfield for enabled log types for the current session. That information is checked before actual log write functions are called.
Each file where session-specific logging is used, must include the following exports:
/** Defined in log_manager.cc */
extern int lm_enabled_logfiles_bitmask;
extern size_t log_ses_count[];
extern __thread log_info_t tls_log_info;
buffer.c:gwbuf_make_contiguous: hint wasn't duplicated to new GWBUF struct. As a result hints were lost if query rewriting resulted in longer query than the original.
buffer.c:gwbuf_make_contiguous: when new buffer is created, copy original buffer's type to new buffer
modutil.c:modutil_replace_SQL: when new bugger is added to GWBUF, copy original buffer's type to new buffer
In all filters, merge all buffers of GWBUF to one before calling modutil:extract_SQL
query_classifier.h: added parsing information structure to query classifier away from buffer.h.
buffer.c:introduced a buffer object which includes object pointer and a clean-up call-back function. Buffer objects form a list which is cleaned up by the last referrer of the buffer, as a part of gwbuf_free. Buffer object list is protected by a spinlock gwbuf_lock.
Also added identifier type, bufobj_id_t which is enumerated type and currently includes one value only, GWBUF_PARSING_INFO. Added also a bitfield for information about the buffer. It currently has one type only, GWBUF_INFO_PARSED indicating that buffer content is parsed and there is buffer object of type GWBUF_PARSING_INFO.
skygw_utils.cc:replace_literal:changed regexec matching to case insensitive because user-defined literals are sometimes converted to upper-case ones.
query_classifier.cc: Now query can be parsed outside query_classifier_get_type by calling function parse_query. It creates parsing_info_t struct which is then added to the GWBUF which also includes the query. Parsing information follows the buffered query and it is freed at the same time with query buffer, in gwbuf_free.
buffer.c: additions of parsing information to gwbuf struct.
modutil.c: added function which returns query from GWBUF in plain text string.
readwritesplit.c:routeQuery now only calls query_classifier_get_type to get the query type instead of extracting plain text query from the GWBUF buffer.
Fix to #473, http://bugs.skysql.com/show_bug.cgi?id=473
Several memory issues. Read the code.
In general one-off hint is only added to gwbuf and freed in gwbuf_free. Stacked hint is copied to stack and to gwbuf. gwbuf is freed after routing but stacked hint is freed either in stop or when session is closed. All this applies to named hint as well except that in addition, it has one more copy in named hint struct which is emptied when session is closed.
buffer.c: added memory release for hint of a GWBUF
hint.c: added bool hint_exists()
hint.h: added placeholder for hint type HINT_ROUTE_TO_ALL which doesn't have implementation yet.
filter/Makefile: fixed dependency issue
hintparser.c: added const char* token_get_keyword(), hint_parser:added NULL check, hint_next_token: fixed off-by-one bug
readwritesplit.h: added bitfield for hints' use, which includes route targets and flag for case where user hinted to route to named backend server.
readwritesplit.c: added function route_target_t get_route_target() for resolving route target based on 1) query type (from query_classifier) 2) transaction state (active/not) and 3) hints. Modified get_dcb, which is called in routeQuery to provide pointer to correct backend DCB. Now get_dcb also takes server unique name as a parameter if such a hint was found. for hints' use, which includes enter the commit message for your changes.
Added flags to those backend references which have sent something to backend which causes the backend to send results or reply back. Didn't add removal of the flag since there's currently no way to tell whether response from backend contains anything else than session command reply - which aren't counted when BREF_WAITING_RESULT is set and cleared.
This implementation doesn't guarantee execution order between session commands and queries
if other backend server lags behind in session command execution.
In poll.c : moved processing of EPOLLERR and EPOLLHUP after processing of EPOLLIN and EPOLLOUT.
This ensures that COM_QUIT messages are read and routed forward before signals arrive (from local client/backend).
nection router stream is used and with read/write split router individual statements are passed to router.
Added new function to ROUTER_OBJECT : uint8_t (*getCapabilities)(ROUTER *instance, void* router_session); which is implemented in every route
r.
Added support for multi-statement packets in rwsplit router. In other words, if network packet includes multiple mysql statements, they are separated and passed to router one by one.
Multi-packet statements (those which exceeds network packet boundaries) are _not_ supported yet.