55 Commits

Author SHA1 Message Date
Markus Makela
fb09cbf100 Fixed queries being routed when the session is already closing. 2015-07-07 13:15:23 +03:00
Markus Makela
e0ce987d72 Mysql_backend now only sends complete packets from the backend servers. 2015-03-22 08:56:18 +02:00
Markus Makela
3efe5c6b57 Fixed possible null pointer dereference. 2015-03-19 12:16:53 +02:00
VilhoRaatikka
6228be4284 Fix to bug #678, http://bugs.skysql.com/show_bug.cgi?id=678
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
2015-01-02 18:32:57 +02:00
VilhoRaatikka
63def8d002 Fix to bug #644, http://bugs.mariadb.com/show_bug.cgi?id=644
Initialized the lock variable in gwbuf_clone
2014-12-11 15:28:41 +02:00
VilhoRaatikka
fd11e6a7f5 Session-specific logging. Added functions
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;
2014-11-19 00:08:59 +02:00
Markus Makela
17f87e29af Fixes to some Coverity issues. 2014-11-05 11:57:42 +02:00
VilhoRaatikka
deffd4a69f Fix to Coverity cases 73417, 73420, 72759, 72639 2014-10-31 23:11:19 +02:00
VilhoRaatikka
00fded016b Fixes to Coverity tasks : 73267, 72686, 72672
Cleaned up warnings, and added checks to malloc return values and error log writes in case of failures.
2014-10-31 15:25:59 +02:00
VilhoRaatikka
42b52c6f51 Fix to bug #587, http://bugs.mariadb.com/show_bug.cgi?id=587
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.
2014-10-23 21:03:58 +03:00
VilhoRaatikka
287bc90465 Fix to bug #585, http://bugs.mariadb.com/show_bug.cgi?id=585
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
2014-10-21 21:13:21 +03:00
Markus Makela
be08f22ae1 Changed old references to SkySQL to MariaDB Corporation and Gateway to MaxScale. 2014-10-10 16:38:54 +03:00
counterpoint
d5071267e7 More tests; minor fixes. 2014-10-08 18:04:28 +01:00
counterpoint
e17607b0d3 Minor changes to tests; fix typo; tidy up. 2014-10-03 17:24:46 +01:00
counterpoint
32d66e6f84 Minor modifications for testing. 2014-10-03 17:24:46 +01:00
Markus Makela
c4ca1ddb13 Updated non-source files with new company name. 2014-10-01 15:21:47 +03:00
Markus Makela
b0683d9b4d Updated the licensing year from 2013 to 2013-2014 2014-10-01 14:37:12 +03:00
Markus Makela
abbf4e7a7d Merge branch 'develop' into pointer_arithm 2014-10-01 05:33:32 +03:00
Markus Makela
f4e591e382 Changed 'SkySQL Gateway' to 'MariaDB Corporation MaxScale' 2014-09-30 13:15:03 +03:00
Markus Makela
c344231f80 Renamed all occurences of SkySQL to MariaDB Corporation 2014-09-30 13:02:10 +03:00
Markus Makela
ea6a3f56d6 Fix to bug 487: http://bugs.skysql.com/show_bug.cgi?id=487
Changed all arithmetic operations on raw void pointers to properly use uint8_t pointers instead.
2014-09-29 13:07:30 +03:00
VilhoRaatikka
30c52677b0 buffer.c:gwbuf_consume: rval may also be NULL, thus, added that to assert condition. 2014-09-11 15:27:31 +03:00
MassimilianoPinto
8b5b4a17fe Merge from Z3
Merge from Z3
2014-09-11 12:51:16 +02:00
MassimilianoPinto
7245d1baa1 blr branch merge
blr branch merge
2014-09-11 12:20:42 +02:00
Mark Riddoch
c273988e51 Fixed for EPOLLHUP events
Possible double free in maxscaled on close

binlog router debugging/tracing
2014-09-05 17:29:17 +01:00
VilhoRaatikka
40416d424e Merge branch 'Z3' of https://github.com/skysql/MaxScale into Z3
Conflicts:
	gcov.diff
	server/core/buffer.c
	server/include/buffer.h
	server/modules/routing/readwritesplit/readwritesplit.c
2014-08-29 18:50:32 +03:00
VilhoRaatikka
4a30626974 Merge branch 'Z2' of https://github.com/skysql/MaxScale into Z2
Conflicts:
	client/Makefile
	server/core/buffer.c
	server/core/test/makefile
	server/include/buffer.h
	server/modules/filter/Makefile
	server/modules/routing/webserver.c
2014-08-29 16:21:08 +03:00
VilhoRaatikka
9ce36d7242 Merge branch 'master' of https://github.com/skysql/MaxScale 2014-08-29 14:46:06 +03:00
Mark Riddoch
81e1dd8719 Merge branch 'develop' into blr
Add instrumentation

Remove mutexes

Improve gwbuf_append performance

Conflicts:
	server/core/dcb.c
	server/modules/protocol/mysql_backend.c
2014-08-28 11:41:26 +01:00
VilhoRaatikka
ee52ac64a9 query_classifier.cc:skygw_get_canonical: if the item to be replaced is an empty string "", it is processed differently from the other cases due to difficulties to get wanted result by adding special rule for that to regex.
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.
2014-08-22 19:01:56 +03:00
VilhoRaatikka
c501d4d4e1 Changes related to canonical query format implementation.
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.
2014-08-20 22:10:36 +03:00
Mark Riddoch
d6a2ef6996 Misc fixes to doxygen comments 2014-08-19 13:22:40 +01:00
VilhoRaatikka
86a4c3ba90 Fix to #472, http://bugs.skysql.com/show_bug.cgi?id=472
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.
2014-08-08 01:28:07 +03:00
VilhoRaatikka
4f3d746f4e MAX-157. Added support for hints in rwsplit router.
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.
2014-07-31 23:40:02 +03:00
Mark Riddoch
2dea68b9b3 Hint parsing 2014-07-25 16:33:49 +01:00
Mark Riddoch
764ceac105 Merge branch 'httpd' into MAX-157
Conflicts:
	server/core/buffer.c
	server/include/buffer.h
2014-07-16 18:31:12 +01:00
Mark Riddoch
944ee9134c Initial HINT structure added 2014-07-16 18:29:20 +01:00
Mark Riddoch
87e66a0ea8 Revert "Implementation of HTTPD protocol, gwbuf properties and a dmeo web application"
This reverts commit 6fd5dff34902051f38932947493280e1e62dbeb1.
2014-07-15 17:53:39 +01:00
Mark Riddoch
6fd5dff349 Implementation of HTTPD protocol, gwbuf properties and a dmeo web application
interface to test the new httpd.
2014-07-15 17:39:31 +01:00
VilhoRaatikka
39679447c9 Bugzilla #455, MaxScale crashed due missing buffer type information in multi-buffer responses. 2014-07-03 19:20:45 +03:00
VilhoRaatikka
fcf67716fd Added mechanism for choosing slave for a query based on the current load in all connected slaves. Counting operations is not correctly done here. Reading values and choosing accordingly is done.
Fixed several things in session command reply processing.
2014-06-29 22:21:30 +03:00
VilhoRaatikka
1d1da398d4 Merge branch 'develop' into MAX-99
Conflicts:
	server/modules/routing/readwritesplit/readwritesplit.c
2014-06-25 17:50:29 +03:00
VilhoRaatikka
442ac7fefb Added GWBUF type GWBUF_TYPE_SINGLE_STMT to indicate that buffer only includes single complete stmt. Added macro for checking the flag and changed existing routines as necessary. 2014-06-24 21:51:54 +03:00
Mark Riddoch
a652e875b5 Support for multipacket statements
Remove double free in cloned DCB's
2014-06-24 17:59:29 +01:00
VilhoRaatikka
15ff1fd26a Fixed many error handling issues regading to timing and multiple threads.
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.
2014-06-12 23:22:51 +03:00
Mark Riddoch
fda9b1c706 Merge branch 'develop' into blr
Conflicts:
	server/core/dcb.c
	server/modules/include/blr.h
	server/modules/routing/binlog/STATUS
	server/modules/routing/binlog/blr.c
	server/modules/routing/binlog/blr_file.c
	server/modules/routing/binlog/blr_master.c
	server/modules/routing/binlog/blr_slave.c
2014-06-08 00:50:36 +01:00
Mark Riddoch
bb0e6c3858 Support non-default binlog filenames
Add support for bin log file names that are shorter than the default.
Handle events per more than 2 packets
2014-06-04 18:37:41 +01:00
Mark Riddoch
509379df70 Fix for NULL buffer past to gwbuf_length 2014-05-28 11:00:50 +01:00
VilhoRaatikka
a3f7eebdc9 Extended session command support to cover COM_CHANGE_USER, and COM_INIT_DB.
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).
2014-03-14 13:25:37 +02:00
VilhoRaatikka
cb6a976555 Router has now capability value which currently tells whether router session expects stream or individual, complete statements. With read con
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.
2014-03-11 23:12:11 +02:00