1501 Commits

Author SHA1 Message Date
VilhoRaatikka
835c5b3915 Test that session variable scope doesn't span multiple sessions. 2014-05-08 16:36:17 +03:00
VilhoRaatikka
9af5d9fb06 Commit fix to bug #418 http://bugs.skysql.com/show_bug.cgi?id=418 2014-05-08 13:13:42 +03:00
MassimilianoPinto
29932f7fc8 MySQL handshake has a configurable version_string
MySQL handshake has no a configurable version_string parameter in
service section.
The default value is the server version of the embedded mysqld library.

Set option example:

version_string=5.5.37-MariaDB-log

Default is similar to:

5.5.35-MariaDB
2014-05-07 18:08:28 +02:00
VilhoRaatikka
a1361d9c9e Related to MAX-95, added code which makes it possible to change max_slave_connections parameter value during run time of MaxScale. The change will be effective in rwsplit sessions created after the configuration modification and reload. Note that in order to config modification to be effective, the user must connect the debug interface of MaxScale (telnet) and execute 'reload config'.
In practice, 'reload config' reads config file and updates config parameters of rwsplit router service. In addition to that there is a version number indicating what generation of configuration service holds. When router instance is created (when MaxScale is started) service's config version is copied to router intance. Whenever new client connection (rwsplit session) is started, router instance's config version is checked against that of service's. If versions differ, service's config data is copied to router instance. New session will be started with router instance's config values.
2014-05-02 16:35:40 +03:00
VilhoRaatikka
b5e9428ff7 log_manager.cc fixed memory leak, block buffer mutex names weren't freed.
query_classifier.cc use of uninitialized value in skygw_stmt_causes_implicit_commit
config.c crashed if module load failed, use of unitialized value
load_utils.c pretty-printed error
service.c use of uninitialized value in service_add_qualified_param
modules.h function prototype
readwritesplit.c memory leaks
2014-04-29 14:50:09 +03:00
VilhoRaatikka
c927057b5c Fixed two bugs of which one was older.
1. in query_classifier.cc autocommit_enabled, and transaction_active variables maintained their values across different sessions. Now those values are stored in each router_client_ses object.
2. As a part of implementation of MAX-95 session variables were added to BACKEND struct which is shared with all sessions using the SERVICE which the particular BACKEND serves. Now each router_client_ses object has a backend reference struct which includes pointer to BACKEND, DCB and to session command cursor.

Added test - set_autocommit_disabled.sql, test_after_autocommit_disabled.sql - to check that session variable is discarded when session where it belongs terminates.
2014-04-28 23:33:49 +03:00
VilhoRaatikka
28bc3509cc Added new parameter RW Split Router.max_slave_connections=[<int>|<int>%] which specifies the maximum number of slaves which read/write split router connects in each routing session.
Parameter it read from config file to CONFIG_CONTEXT's parameter list. It is qualified in service.c:service_set_slave_conn_limit and if qualified, the qualified integer value and the value type are copied to the CONFIG_PARAMETER structure.

This CONFIG_PARAMETER struct is cloned (=copied to different memory area) and linked to RW Split SERVICE struct.

When RW Split router_instance is created in readwritesplit.c:createInstance, the value is copied to (new) rwsplit_config_t structure from SERVICE's parameter list.

When new routing session is created in readwritesplit.c:newSession, the rwsplit_config_t structure is copied to ROUTER_CLIENT_SES struct and the actual max_nslaves value is calculated from the config value (if percentage is used).

Tests and many error handling branches are missing but functionality seems to be working.
2014-04-24 22:05:26 +03:00
VilhoRaatikka
04313caf82 Initial implementation of the support for multiple slaves in read/write split router session. Omits configuration changes. 2014-04-23 14:55:04 +03:00
VilhoRaatikka
81af54730a Added missing test files for rwsplit router tests. 2014-04-16 10:25:32 +03:00
VilhoRaatikka
c994c81a0e Changed the way how autocommit is searched from parse tree. Switched to use typelib instead of explicitly converting and comparing user value. Added more tests for cases where user uses literal values in SET autocommit command. 2014-04-15 14:32:47 +03:00
VilhoRaatikka
7b40c1ee70 Changed how MaxScale unit test works.
All tests are run by executing 'make testall' in root directory. As a result all directories which contain tests will be entered and tests executed.
After tests, each directory have a test log including the last run's logs only.
Created a global test log, which is specified in test.inc. Test logs from subdirectories are concatenated to this file.
2014-04-10 19:08:28 +03:00
VilhoRaatikka
b9a8f2ce65 Merge branch 'develop' of https://github.com/skysql/MaxScale into develop 2014-04-10 17:11:45 +03:00
VilhoRaatikka
bbf1bc2afa Fix for bug #418
Increased skygw_query_type_t to 16 bits, and corrected the way how those bit fields are checked.
Added tests for cases where autocommit is disabled and corrected old tests.
2014-04-10 17:09:42 +03:00
VilhoRaatikka
2c17dc3edf Bug #418, added functions to query classifier to detect if SET autocommit is called.
Note: this compiles but doesn't work yet properly.
2014-04-09 23:43:03 +03:00
VilhoRaatikka
c86e25eeb8 Added a test for implicitly started trasnaction. 2014-04-07 17:00:31 +03:00
VilhoRaatikka
ce5dc19ecc Added read/write split router tests to a part of makefile structure. 2014-04-01 14:11:48 -07:00
MassimilianoPinto
6f46742201 master update from 'release-0.5' 2014-03-28 16:21:10 +01:00
Mark Riddoch
efebd27d31 Galera HA Connection Router
Example Galera Connection router for HA environments. Code produced as
part of router writers tutorial.
2014-03-28 14:48:21 +00:00
VilhoRaatikka
7c3a354fd8 Query classifier ignored implicit commits in cases of write commands. Fixed it.
Added more tests for transaction support. Mostly different cases where some command triggers implicit commit in the middle of transaction.
2014-03-28 00:16:18 +02:00
VilhoRaatikka
9b1035751a Made rwsplit test select_for_var_set.sql generic so that master server's id is filled in test.inc. 2014-03-27 17:17:01 +02:00
MassimilianoPinto
e9d1f04bc6 Added test: set var @a via select @@server_id
Added test: set  var @a via select @@server_id
2014-03-27 11:45:47 +01:00
VilhoRaatikka
10fdccdeee Added two tests for testing readwrite split router's ability to route read to master if in active transaction and to slave when outside transaction. 2014-03-27 10:27:19 +02:00
VilhoRaatikka
75549c6a20 Added $(ROOT_PATH)/test.inc where test parameters can be added. For example, MaxScale port numbers, usernames, passwords. The file can be included in every */test/makefile so that all test directories can use same parameters if necessary.
Moved checking test results to rwsplit.sh so that tests can use easily different criterias to evaluate test success.
2014-03-27 10:06:31 +02:00
VilhoRaatikka
f49df89a0c Changed how query classifier determines which statements trigger implicit commit.
Changed test makefile and rwsplit.sh script and added two example sql scripts.
2014-03-26 19:10:35 +02:00
VilhoRaatikka
df02926321 Added structure which can be cloned for multiple test cases. 2014-03-25 23:19:24 +02:00
MassimilianoPinto
f320c17834 Added test for readwrite split: SET and TRANSACTION - COMMIT
Added test for readwrite split: SET and TRANSACTION - COMMIT
2014-03-24 15:15:21 +01:00
VilhoRaatikka
d660d3590d Cannot compile in readwritesplit.c 2014-03-20 20:30:03 +02:00
VilhoRaatikka
288ca68677 Changed variable type which includes information of query type returned by query classifier.
As a consequence, if autocommit is enabled, active transaction(s) are implicitly committed and MaxScale detects that implicit commit.
2014-03-20 12:15:57 +02:00
VilhoRaatikka
fcf7d37114 Added support for router option 'synced' in read write split router. If router option is specified, backend server must be in 'joined' state to be eligible backend candidate. 2014-03-19 22:29:02 +02:00
VilhoRaatikka
5ef657d833 Corrected some error messages. Added checking for protocol state in gw_MySQLWrite_backend. If protocol is in MYSQL_AUTH_FAILED state (=authentication is comleted and failed) write to backend is discarded. 2014-03-19 14:36:47 +02:00
VilhoRaatikka
d6a9a5c1d0 MAX-10, Transaction support for MaxScale.
Naive implementation, which routes all statements to master between BEGIN|START TRANSACTION <options> and ROLLBACK|COMMIT
2014-03-18 23:41:32 +02:00
VilhoRaatikka
d7e9978ac1 Changed back the first part of gw_MySQLWrite_backend so that it is protected by dcb->authlock which must wait until authentication phase is complete. If authentication fails, the error is handled before next query starts its execution. 2014-03-18 17:00:43 +02:00
VilhoRaatikka
35c460457a Fixed compile error. 2014-03-18 11:21:51 +02:00
VilhoRaatikka
526762bcc7 Fixed reference to backend servers. 2014-03-18 10:54:19 +02:00
VilhoRaatikka
72a17e5fe2 Merging SESvars with develop. 2014-03-18 10:28:34 +02:00
VilhoRaatikka
c356b396a6 Merge branch 'SESvars' of https://github.com/skysql/MaxScale into SESvars
Conflicts:
	server/core/dcb.c
	server/core/poll.c
	server/modules/include/mysql_client_server_protocol.h
	server/modules/routing/readwritesplit/readwritesplit.c
2014-03-18 10:28:06 +02:00
VilhoRaatikka
67d9b3afb9 Fixed bug in how response messages from backends were handled. Now messages are examined if session command cursor is active
. That means that (at least) the first packet  in the message is response to session command. Then if the response is alread
y forwarded to client it is discarded. Otherwise it is routed to client and the command is marked as responded so that the o
ther backend knows to discard its duplicate response.
2014-03-17 22:26:32 +02:00
MassimilianoPinto
68e96fb0fc Unix domain socket support 2014-03-17 16:57:51 +01:00
MassimilianoPinto
ae2379be31 Server connection counter is updated in closeSession
Server connection counter is updated in closeSession
2014-03-17 11:26:35 +01:00
VilhoRaatikka
90f701be8e readwritesplit.c : router is changed so that it guarantees to keep the execution order of session commands and queries when they are routed to backend servers. In the same way it maintains the order of response packets and discards duplicate responses.
For each session command a sescmd property is created and added to the end of list of session commands. List is owned by router client session and it includes all session commands from the beginning of router session.
Router maintains an individual session command cursor for each backend. A cursor refers to the first session command which the corresponding backend server haven't yet responded yet.
When response message arrives at any time from backend, first it is checked whether backend's cursor is active. Cursor is active if a session command is routed to backend and the backend haven't responded to it yet. If cursor is active, next it is checked whether the current session command property has been responded by other backend. If both are true, then response message is sent to client as is. If session command response is routed to client already, the arrived response is discarded.
2014-03-16 19:43:49 +02: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
MassimilianoPinto
9a11a3241b UNIX socket support
UNIX socket support
2014-03-11 13:00:34 +01:00
VilhoRaatikka
c28892323a Added support for session commands to readwrite split router.
Added support for multi-statement packets.

This is an intermediate commit to save work. Code is not cleaned and there are debug prints and prototypes to be removed.
2014-03-07 20:53:33 +02:00
MassimilianoPinto
4f60625a54 Server connection counter is updated in closeSession
Server connection counter is updated in closeSession
2014-03-06 08:45:51 +01:00
MassimilianoPinto
a2285e9e00 Compile errors fixed
Compile errors fixed
2014-02-28 12:56:09 +01:00
MassimilianoPinto
45543eceed Merge branch 'fix-127' into feature-MAX-2
Conflicts:
server/core/dbusers.c
server/core/service.c
server/core/users.c
server/include/dbusers.h
server/include/users.h
server/modules/protocol/mysql_client.c
server/modules/protocol/mysql_common.c
2014-02-28 12:28:14 +01:00
VilhoRaatikka
3e111534a1 Support for mysql session variable commands, for example, SET AUTOCOMMIT=0
Session commands are identified by query clasisfier, and added to the session command property list in router client session object.
Session commands are then executed in existing backend servers but only one of them will reply to client.
2014-02-26 20:07:09 +02:00
MassimilianoPinto
e8d68d7271 Added localhost check in gw_find_mysql_user_password_sha()
Added localhost check in gw_find_mysql_user_password_sha1().
The wilcard check is skipped if user@localhost failed
2014-02-17 10:17:22 +01:00
MassimilianoPinto
7ecea7ae7d set dcb->ipv4 for mysql user@host authentication
set dcb->ipv4 for mysql user@host authentication
2014-02-14 18:37:04 +01:00