365 Commits

Author SHA1 Message Date
VilhoRaatikka
5e5c59d322 Merge branch 'MAX-237' into Z3 2014-09-03 17:50:56 +03:00
Markus Makela
52f3adbf20 fixed temporary tables looking for database drops instead of table drops 2014-09-01 19:50:25 +03:00
Markus Makela
a17e584adb Merge remote-tracking branch 'origin/Z3' into MAX-237
Conflicts:
	query_classifier/query_classifier.cc
	query_classifier/query_classifier.h
	server/modules/routing/readwritesplit/readwritesplit.c
2014-09-01 11:05:10 +03:00
Markus Makela
067ce3c886 removed unneeded QUERY_TYPE_DROP_TABLE type from query_classifier.h 2014-09-01 10:35:48 +03:00
Markus Makela
bc939501e9 minor bugfix to memory allocations 2014-09-01 10:11:04 +03:00
VilhoRaatikka
40f85f9cad Fix to bug http://bugs.skysql.com/show_bug.cgi?id=488. SHOW VARIABLES was treated as if it was session write command. Instead it is a read-only query. Changed to route that to master. 2014-08-31 22:56:30 +03:00
Markus Makela
58e8c05c8a added detection of drop table targeting a temporary table 2014-08-31 20:19:47 +03:00
Markus Makela
ecc89a823b added tests for temporary tables 2014-08-31 19:30:00 +03:00
Markus Makela
45faa38877 added temporary table detection for reads 2014-08-31 07:39:26 +03:00
Markus Makela
7629c455a6 partial implementation 2014-08-30 08:27:05 +03: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
Markus Makela
7ea53f0141 Merge remote-tracking branch 'origin/MAX-160' into MAX-237
Conflicts:
	query_classifier/query_classifier.cc
	query_classifier/query_classifier.h
2014-08-29 11:02:03 +03:00
VilhoRaatikka
531d8d7b47 query_classifier.cc: added detection for CREATE TEMPORARY TABLE and setting a new query type QUERY_TYPE_CREATE_TMP_TABLE for it.
query_classifier.h: added QUERY_TYPE_CREATE_TMP_TABLE and QUERY_TYPE_READ_TMP_TABLE for use of temporary table support.
hashtable.c:Added variant of hashtable which is 'flat', that is, stored to existing memory instead of allocating memory as a part of the call. Existing function declarations don't change but added hashtable_alloc_flat for the purpose. Both hashtable_alloc and hashtable_alloc_flat now call the real allocation function, hashtable_alloc_real. hashtable_free only frees memory which is allocated in hashtable_alloc_real.
hashtable.h: added a flag to HASHTABLE struct to indicate whether hashtable owns its memory or not.
readwritesplit.h: Added RSES_PROP_TYPE_TMPTABLES property type to be used for keeping the hashtable for tablenames.
readwritesplit.c: Added comments about temporary table support implementation.
2014-08-29 10:08:48 +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
VilhoRaatikka
13dfd34d5d Test use for cacnonical query function. Effective in debug build only. 2014-08-19 09:39:40 +03:00
Hartmut Holzgraefe
d355e07e2d gitignore cleanup
* ignore typical backup files created by common editors
* move general ignore rules like "*.o" or "depend.mk" to top level gitignore
* ignore executables and test directories in target dir gitignore
  as these are local and there's no general catch-all pattern for them
2014-08-18 09:39:29 +00:00
Vilho Raatikka
34f6884920 Merge pull request #24 from hholzgra/hartmut-DEL
Hartmut del
2014-08-18 09:20:30 +03:00
Vilho Raatikka
087c4720bb Merge pull request #23 from hholzgra/hartmut-DEL
Hartmut del
2014-08-18 09:20:03 +03:00
Hartmut Holzgraefe
fb87f68368 consistently use DEL instead of rm in Makefiles 2014-08-17 21:02:24 +00:00
VilhoRaatikka
dcb2070736 Merge branch 'release-1.0beta' of https://github.com/skysql/MaxScale into release-1.0beta
Conflicts:
	server/modules/protocol/mysql_common.c
2014-08-15 18:43:05 +03:00
VilhoRaatikka
677a44f497 Merge from release-1.0beta to Z2 2014-08-15 18:00:39 +03:00
Markus Makela
d174740b08 Merge remote-tracking branch 'origin/release-1.0beta' into session_variable_test 2014-08-15 13:48:04 +03:00
Markus Makela
be52b3a71e more stress tests for rwsplit router 2014-08-15 13:41:56 +03:00
VilhoRaatikka
902004c1ee Fix to bug #463, http://bugs.skysql.com/show_bug.cgi?id=463
mysql_common.c:gw_MySQL_get_next_packet didn't handle case where an insert command followed by alter table in the same read buffer. It shouldn't been possible without multi-statement being set.
2014-08-14 22:33:57 +03:00
VilhoRaatikka
15e3ef6950 Merge branch 'release-1.0beta' of https://github.com/skysql/MaxScale into release-1.0beta 2014-08-14 15:19:23 +03:00
VilhoRaatikka
77e5525436 mysql_client.c:gw_error_client_event & gw_client_hangup_event: added session state check, if session is already closing, don't start redundant call to dcb_close.
mysql_common.c:mysql_protocol_done: added protocol state check. Used not to check it which caused double free of allocated memory.
2014-08-14 15:15:22 +03:00
Vilho Raatikka
35f64ff33a Merge pull request #17 from skysql/session_variable_test
rwsplit router tests for session variables
2014-08-14 14:38:26 +03:00
Markus Makela
01eb9822e0 rwsplit router tests for session variables 2014-08-14 14:34:22 +03:00
VilhoRaatikka
d3a79ce7c4 Partial fix to #463, http://bugs.skysql.com/show_bug.cgi?id=463
log_manager.cc: fixed block buffer overflow. Queries are logged to trace log and long queries exceed the bufsize in length. Those were written beyond allocated memory areas.
mysql_client_server_protocol.h: added mysql_protocol_state_t to indicate whether MySQL protocol object is allocated, usable or freed. Freed means that memory allocations made by the protocol are freed. That is, command history etc.
mysql_backend.c: gw_backend_hangup and gw_error_backend_event used to call error handling function although session was already closing. Added check for session state.
mysql_client.c: route_by_statement lost some packets in case where query was sent in multiple packets.
mysql_common.c: gw_MySQL_get_next_packet failed in packet handling with route_by_statement. When multi-packet query was merged into one, packet type wasn't copied.
	protocol_archive_srv_command and mysql_protocol_done didn't have proper locking in place which lead to occasional crashes.
2014-08-14 13:05:05 +03:00
Markus Makela
430cd8d140 Merge branch 'Z2' of https://github.com/skysql/MaxScale into testing_makefile_fix 2014-08-12 14:43:30 +03:00
VilhoRaatikka
c02bb41a9d Added logging for case where route hint is to slave. 2014-08-12 10:27:15 +03:00
Markus Makela
3a639403bf added fixes to core tests failing even though they passed, hint syntax test only checking for a partial logfile and readwritesplit tests being run twice. 2014-08-11 14:27:33 +03:00
Markus Makela
f23a9e2b72 tests for hints and changes in makefiles and configuration files to enable testing them through 'make testall' 2014-08-08 13:19:23 +03:00
VilhoRaatikka
d4de582e16 Fix to #471, http://bugs.skysql.com/show_bug.cgi?id=471
Replication lag is not checked in precense of routing hint.
2014-08-08 11:11:28 +03: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
b72e80b464 Fix for Bug #466, http://bugs.skysql.com/show_bug.cgi?id=466
hintparser.c:hint_parser:when string token is found, create a copy of the token value instead of copying the its address because token will be freed before the value is used.
	hint_next_token:didn't recognize '=' as TOK_EQUAL, fixed that. Read the code.
hint.c:hint_create_parameter: copy the pointer to parameter name instead of creating copy of it - pname is already copied from token before the call
readwritesplit.c:routeQuery:Hint name was copied when hint value was supposed to be copied, thus resulting invalid value for hinted parameter. Also fixed server type in trace log command.
skygw_debug.h:Added string for Relay server to macro STRSRVSTATUS.
2014-08-06 16:39:22 +03:00
VilhoRaatikka
08b99c121e Bug #468, http://bugs.skysql.com/show_bug.cgi?id=468, Query classifier accessed freed thread context. If parsing fails thd doesn't need to be freed because it holds correct information about command type.
session.c:session_setup_filters : fixed memory leak
hintparser.c: added token_free for HINT_TOKENs and fixed a few memory leaks.
mysql_client_server_protocol.h: added mysql_protocol_done which frees memory blocks pointed to by protocol members. Those can't be freed in dcb.c because dcb.c doesn't know about protocol's members.
mysql_backend.c:gw_backend_close: fixed memory leak
mysql_client.c: gw_client_close: fixed memory leak
mysql_common.c: added implementation of mysql_protocol_done
        :protocol_archive_srv_command: tried to fix memory leak. Some memory is still leaking according to valgrind. Removed use of uninitialized local variable len.
readwritesplit.c: Fix to bug #469, http://bugs.skysql.com/show_bug.cgi?id=469,  rwsplit counts every connection twice in master - counnection counts leak
	execute_sescmd_in_backend: fixed a memory leak - visible only in DEBUG=Y build.
readwritesplit/test/makefile: added target for hints tests
2014-08-05 18:14:06 +03:00
VilhoRaatikka
f738b2e0cb Fix to http://bugs.skysql.com/show_bug.cgi?id=469, connection counter leaks in master.
Removed redundant counter increments.
2014-08-05 16:38:00 +03:00
VilhoRaatikka
97ab902ede Fix to http://bugs.skysql.com/show_bug.cgi?id=469, connection counter leaks in master.
Removed redundant counter increments.
2014-08-05 16:31:39 +03:00
VilhoRaatikka
dbfaa5a8ea Fix to http://bugs.skysql.com/show_bug.cgi?id=469, connection counter leaks in master.
Removed redundant counter increments.
2014-08-05 16:28:26 +03:00
VilhoRaatikka
7558abb6fa Bug #468, http://bugs.skysql.com/show_bug.cgi?id=468, Query classifier accessed freed thread context. If parsing fails thd doesn't need to be freed because it holds correct information about command type.
session.c:session_setup_filters : fixed memory leak
hintparser.c: added token_free for HINT_TOKENs and fixed a few memory leaks.
mysql_client_server_protocol.h: added mysql_protocol_done which frees memory blocks pointed to by protocol members. Those can't be freed in dcb.c because dcb.c doesn't know about protocol's members.
mysql_backend.c:gw_backend_close: fixed memory leak
mysql_client.c: gw_client_close: fixed memory leak
mysql_common.c: added implementation of mysql_protocol_done
    :protocol_archive_srv_command: tried to fix memory leak. Some memory is still leaking according to valgrind. Removed use of uninitialized local variable len.
readwritesplit.c:execute_sescmd_in_backend: fixed a memory leak - visible only in DEBUG=Y build.
2014-08-05 10:42:13 +03:00
VilhoRaatikka
6b3c7041e3 Bug #468, http://bugs.skysql.com/show_bug.cgi?id=468, Query classifier accessed freed thread context. If parsing fails thd doesn't need to be freed because it holds correct information about command type.
session.c:session_setup_filters : fixed memory leak
hintparser.c: added token_free for HINT_TOKENs and fixed a few memory leaks.
mysql_client_server_protocol.h: added mysql_protocol_done which frees memory blocks pointed to by protocol members. Those can't be freed in dcb.c because dcb.c doesn't know about protocol's members.
mysql_backend.c:gw_backend_close: fixed memory leak
mysql_client.c: gw_client_close: fixed memory leak
mysql_common.c: added implementation of mysql_protocol_done
	:protocol_archive_srv_command: tried to fix memory leak. Some memory is still leaking according to valgrind. Removed use of uninitialized local variable len.
readwritesplit.c:execute_sescmd_in_backend: fixed a memory leak - visible only in DEBUG=Y build.
2014-08-05 09:31:10 +03:00
VilhoRaatikka
76d7f3d836 readwritesplit.c: corrected max_replication_lag with max_slave_replication_lag in hint parameter comparison functions. 2014-08-01 18:30:40 +03:00
VilhoRaatikka
65b121889b config.h: Added enumerated types MAX_RLAG_AVAILABLE and MAX_RLAG_UNDEFINED to be used instead of magic numbers as max_slave_replication_lag values.
readwritesplit.h: Added TARGET_RLAG_MAX to the list of hint targets. It is used in case of hint max_slave_replication_lag=<value>
readwritesplit.c: get_dcb is called when readwritesplit router chooses target backend for a query. Backend is selected from those the router has connection to. get_dcb now takes additional parameters, name and max_rlag. Name is used if there is a hint route to server <server name>. max_rlag is used for hint max_slave_replication_lag=<value> or if it doesn't exist, then for configure parameter max_slave_replication_lag=<configured value> or if both are absent, ignored.
2014-08-01 16:33:29 +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
4af2e58c86 Update plugin status to BETA 2014-07-04 09:23:40 +01:00
VilhoRaatikka
0036d6d8af Merge branch 'develop' of https://github.com/skysql/MaxScale into develop 2014-07-03 19:27:59 +03:00
VilhoRaatikka
39679447c9 Bugzilla #455, MaxScale crashed due missing buffer type information in multi-buffer responses. 2014-07-03 19:20:45 +03:00
MassimilianoPinto
a100b46680 Comments updated in get_root_master()
Comments updated in get_root_master()
2014-07-03 17:04:58 +02:00