4320 Commits

Author SHA1 Message Date
Mark Riddoch
29d247319d Fixed issue with bin log event straddling buffers 2014-05-17 07:25:03 +01:00
VilhoRaatikka
bb364f531b Bug #425, http://bugs.skysql.com/show_bug.cgi?id=425
mysqlk_client.c now assumes that mysql packets may arrive in separate pieces.
gw_read_client_event reads client data, and if packet is incomplete it is added to new dcb->dcb_readqueue. When next packet is combined with data in readqueue.

mysql_common.c:gw_MySQL_get_next_packet can now return mysql packet from read buffer although it would span multiple gwbuf buffers.
2014-05-16 17:01:10 +02:00
Mark Riddoch
1d08b0100f Initial binlog prototype
Supports pulling binlogs from the master, caching to a local file and relaying to a slave.

Only tested with a single slave and a single MaxScale thread.
2014-05-13 16:06:05 +01:00
VilhoRaatikka
25cb08cc29 Return value of service_alloc wasn't read and caused MaxScale to fail if module load failed. 2014-05-12 16:59:19 +03:00
VilhoRaatikka
b7ae1c1784 Added router_option slave_selection_criteria=[LEAST_GLOBAL_CONNECTIONS(default)|LEAST_BEHIND_MASTER] to readwritesplit section.
The option is reloadable in the same way as max_slave_connections parameter. Option value determines which sort function is called before to sort backend server pointers before selecting them and establishing connections to backends.
2014-05-11 23:59:16 +03:00
MassimilianoPinto
e228baf256 version_string is a new service parameter
version_string is a new service parameter.

Documentation updated and current release is now 0.6.0
2014-05-09 20:13:45 +02:00
VilhoRaatikka
8be4aba223 Added new state to SESSION: SESSION_STATE_STOPPING, which is set in protocol module before calling closeSession (router). THe new state tells that session is closing and DCBs included may not be polling anymore.
Fixed some crash scenarios.
2014-05-08 23:17:35 +03:00
MassimilianoPinto
4913c270d3 Merge branch 'fix-423' into release-0.6 2014-05-08 16:26:51 +02: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
2fcc371606 Added back --skip-innodb to a call argument for libmysqld 2014-04-15 19:22:46 +03:00
MassimilianoPinto
e01cbd74ed Bug 409: dcb_final_free now frees dcb->delayq 2014-04-14 10:08:34 +02:00
MassimilianoPinto
a253da7b9c Bug 409: dcb_final_free now frees dcb->delayq
Bug 409: dcb_final_free now frees dcb->delayq
2014-04-14 10:06:00 +02: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
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
5e3ec5b3c8 Added "--no-defaults" to arguments that are passed to mysql_library_init. It tells to embedded server not to use any external my.cnf configuration file. 2014-03-29 12:27:02 +02:00
MassimilianoPinto
40b7ce6d43 Buffer for users' table SHA1 hash is set to zero before using it and strncopy used instead of snprintf
Buffer for users' table SHA1 hash is set to zero before using it and
strncopy used instead of snprintf
2014-03-27 17:19:10 +01: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
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
MassimilianoPinto
9b833b9464 Added 'socket' to the parameter list and moved EPOLLERR and EPOLLHUP after processing of EPOLLIN and EPOLLOUT.
Added 'socket' to the parameter list and moved EPOLLERR and EPOLLHUP
after processing of EPOLLIN and EPOLLOUT.
2014-03-14 16:43:41 +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
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
0a0463c42c Fix for bug-406
Fix for bug-406 in dcb_alloc()
2014-03-03 17:54:39 +01:00
MassimilianoPinto
c6cfc99ee3 At service startup service->rate_limit.last is set back to USERS_REFRESH_TIME
At service startup service->rate_limit.last is set back to
USERS_REFRESH_TIME
This allows reloading users’ table as soon as possible

Fixed mysql_users_alloc instead of users_alloc in replace_mysql_users()
and added MYSQL_USER_MAXLEN where missing
2014-02-28 18:26:24 +01:00
MassimilianoPinto
92d94e16ac Removed duplicated code
Removed duplicated code
2014-02-28 17:55:57 +01:00
MassimilianoPinto
bc31ac2ed3 Branch updated from develop
Branch updated from develop
2014-02-28 17:36:48 +01:00
MassimilianoPinto
1f533c64ff Files updated for user@host mysql auth
Files updated for user@host mysql auth
2014-02-28 15:47:11 +01:00
MassimilianoPinto
22947109b4 Removed extra header file inclusion
Removed extra header file inclusion
2014-02-28 15:07:01 +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
MassimilianoPinto
78799e505f Fix for bug 127 and 345 as part of it
Fix for bug 127 and 345 as part of it
http://bugs.skysql.com/show_bug.cgi?id=127
http://bugs.skysql.com/show_bug.cgi?id=345
2014-02-28 11:29:55 +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
17b328cb9a Added USERS_HASHTABLE_SIZE
Added USERS_HASHTABLE_SIZE,  default size is 52
2014-02-21 17:08:27 +01:00
MassimilianoPinto
8d0f893bb8 Added test file for mysql authentication (user@host, passwd)
Added test file for mysql authentication (user@host, passwd)

make -f ./makefile.mysql_users testall
2014-02-17 16:22:52 +01:00
MassimilianoPinto
086399bb20 uh_cmpfun: resolved error in NULL check
uh_cmpfun: resolved error in NULL check
2014-02-14 18:00:19 +01:00
MassimilianoPinto
9b6ad904f6 MySQL authentication with user@host, resolved compile errors
MySQL authentication with user@host, resolved compile errors
2014-02-14 17:27:17 +01:00
MassimilianoPinto
6a12e99001 MySQL authentication with user@host
MySQL authentication with user@host: user, host and pass word are
loaded from backend servers.
Host is currently handled as IPv4 address
2014-02-14 15:56:48 +01:00
MassimilianoPinto
badb2e3f2c Added return code to setipaddress and removed fprintfs
Added return code to setipaddress and removed fprintfs
2014-02-14 12:27:33 +01:00
MassimilianoPinto
93fc31d9d9 enable_root_user option added to service_params list
enable_root_user option added to service_params list
2014-02-14 11:39:21 +01:00
MassimilianoPinto
5fd5aab2be Added checks for possible handle hashtable_add() failure
Added checks for possible handle hashtable_add() failure with key,
value and copyfn
2014-02-14 10:49:06 +01:00
VilhoRaatikka
b673108276 Bug # 403 http://bugs.skysql.com/show_bug.cgi?id=403
Comparing the return value of atomic_add instead of buffer's reference count variable.
2014-02-12 18:55:44 +02:00
VilhoRaatikka
cb20f8ab8d Initialized argument pointer values with zeroes in hashtable_get_stats. 2014-02-11 15:22:52 +02:00
VilhoRaatikka
83bdc15b54 Made a quick fix to server/core/test/testhash.c. In makefile there is one call for multiple tests and so it makes sense to check return value of the test program. 2014-02-11 14:57:27 +02:00