2238 Commits

Author SHA1 Message Date
VilhoRaatikka
2eee4ae4fd Fix to Bug #657, http://bugs.skysql.com/show_bug.cgi?id=657
filter.c:filter_free:if filter parameter is NULL, return.
tee.c:freeSession: if my_session->dummy_filterdef is NULL, don't try to release the memory
2015-01-01 01:20:21 +02:00
VilhoRaatikka
f4f537a3e2 Fix to bug #673, http://bugs.skysql.com/show_bug.cgi?id=673
dcb.c:dcb_hashtable_stats:division by zero
hashtable.c:hashtable_get_stats: NULL-pointer reference
service.c:serviceStartPort:set service->users NULL to avoid referring to freed memory
users.c:dcb_usersPrintf: NULL-pointer reference
debugcmd.c:convert_arg: changed return value to 1 in case of error, 0 (==NULL) is valid but it indicates that there are no users loaded.
	execute_cmd: fixed command handling
2014-12-31 21:06:28 +02:00
Markus Makela
9b52f5e6ba Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-31 16:28:05 +02:00
VilhoRaatikka
51ebfb9862 Fix to Coverity issue 85210. 2014-12-31 16:29:07 +02:00
Markus Makela
6710d5d25e Fixed a call to free with a pointer to a stack allocated struct. 2014-12-31 16:26:42 +02:00
Markus Makela
316093f912 Fixed memory leaks and cleaned up dead code. 2014-12-31 15:38:15 +02:00
VilhoRaatikka
d1bc68c7d0 Added new member to TEE_SESSION structure: TEE_SESSION->tee_replybuf where reply message is stored until replied to client.
Temporarily commented out waiting section and left to be removed after further testing.
2014-12-31 14:42:14 +02:00
Markus Makela
5ab329f888 Changed the way replies are handled.
Tee filter now receives two client replies, one from the parent service and
one from the child service. These replies are checked before cloning any more queries
into the child service. If the reply isn't sent fast enough, the child session is closed.
2014-12-31 12:58:37 +02:00
Markus Makela
d3e15afb2f Moved the branch session reply state inspection to routeQuery instead of clientReply. 2014-12-31 07:19:12 +02:00
Markus Makela
073db0f1e2 Added checks that the query was cloned in clientReply before waiting for a reply. 2014-12-30 23:05:13 +02:00
Markus Makela
9a77509e6a Added logging to trace log about waiting times and branch session closing. 2014-12-30 18:30:09 +02:00
Markus Makela
e6607dca40 tee.c:
Added clientReply and setUpstream entry points
    Tee filter now waits for the branch session to be replied to and if the reply isn't received in five seconds it closes the branch session.
dcb.h:
    Added the DCBF_REPLIED flag that is currently only set in dcb_null_write
dcb.c:
    The DCBF_REPLIED flag is now set in dcb_null_write
2014-12-30 17:40:47 +02:00
VilhoRaatikka
6b68136377 Fix to bugs #664 and #665
http://bugs.skysql.com/show_bug.cgi?id=664
http://bugs.skysql.com/show_bug.cgi?id=665

Cloned session was freeing the shared 'data' dcb->data/session->data. Now only session_free for the non-clone session is allowed to free the data.
2014-12-30 13:35:59 +02:00
VilhoRaatikka
77bd279a01 Fix to prevent double free of dcb->data/session->data. If authentication fails, call free(dcb->data) only when DCB in question is *not* cloned. 2014-12-30 12:28:36 +02:00
VilhoRaatikka
b0c152b55c Fixed debug assertion and protected read of client DCB's state and consistency. 2014-12-30 10:55:53 +02:00
VilhoRaatikka
df0b04a5c0 Fix: accessed released memory in mysql_client.c where dcb->data was released in gw_mysql_do_authentication and accessed afterwards. 2014-12-30 10:36:06 +02:00
VilhoRaatikka
c2cdbf40bc Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-30 10:05:57 +02:00
VilhoRaatikka
2c2d6f8b66 Clean up. Removed dead code and added comments. 2014-12-30 10:05:13 +02:00
Markus Makela
89f90c53db Merge branch 'tee_recursion_fix' into release-1.0GA
Conflicts:
	server/modules/filter/test/tee_recursion.sh
2014-12-29 20:48:03 +02:00
VilhoRaatikka
2b30dcad6b Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-29 20:30:11 +02:00
VilhoRaatikka
635fcf708f Fix to bugs #665, and #664. Potentially to #649.
http://bugs.skysql.com/show_bug.cgi?id=665
http://bugs.skysql.com/show_bug.cgi?id=664
http://bugs.skysql.com/show_bug.cgi?id=649

dcb.c:dcb_final_free: (665):set dcb->session->client pointer to NULL so that it won't be read anymore and other threads won't try to close it.
	dcb_final_free:(664):don't free dcb->data, it is either freed in session_alloc if session creation fails or in session_free only.
session.c:if session creation fails, free dcb->data and remove links between client DCB and session.
mysql_backend.c:(665):gw_backend_close:check that session->client isn't NULL and that client DCB's state is still polling before calling dcb_close for it.
mysql_client.c:gw_mysql_do_authentication:if anything fails, and session_alloc won't be called, free dcb->data.
mysql_common.c:gw_send_authentication_to_backend:if session is already closing then return with error.
2014-12-29 20:19:01 +02:00
Markus Makela
ecdb6f2d4a Added a test for tee filter recursion. 2014-12-29 20:14:08 +02:00
Markus Makela
69237b4f4f Added tests for tee filter recursion. 2014-12-29 14:58:08 +02:00
VilhoRaatikka
beacd524da Fix to bug #662, http://bugs.mariadb.com/show_bug.cgi?id=662
dbusers.c: Added function for setting read, write and connection timeout values. Set default timeouts for getUsers. Defaults are listed in service.c
gateway.c:shutdown_server is called whenever MaxScale is to be shut down. Added call for service_shutdown to shutdown_server.
service.c:service_alloc: replaced malloc with calloc and removed unnecessary zero/NULL initialization statements as a consequence.
	serviceStart: Exit serviceStartPort loop if shutdown flag is set for the service.
	serviceStartAll: Exit serviceStart loop if shutdown flag is set for the service.
service.c: Added service_shutdown which sets shutdown flag for each service found in allServices list.
service.h: Added prototype for service_shutdown
2014-12-29 13:45:24 +02:00
Markus Makela
fcca284db3 Added complex recursion detection to tee filter 2014-12-24 06:22:49 +02:00
VilhoRaatikka
5e3d90b8b0 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-23 18:13:32 +02:00
VilhoRaatikka
8e1e72132b Fix to #645, http://bugs.mariadb.com/show_bug.cgi?id=654
NULL-terminated argument list in case where there are given more arguments than expected.
2014-12-23 18:12:23 +02:00
Markus Makela
a1d7ccac2f Commented out a debug assert in dcb.c:917 2014-12-23 17:40:22 +02:00
VilhoRaatikka
ff5fe23ce6 dcb.b:dcb_final_free:replaced ((dcb->flags & DCBF_CLONE)==0) with macro !DCB_IS_CLONE(dcb)
readwritesplit.h:Removed invalid macros which assumed that ROUTER_CLIENT_SES->rses_backend_ref always pointed to valid and used backend reference and thus included potential risk of NULL-pointer refernce.
mysql_backend.c and mysql_client.c:avoid executing CHK_PROTOCOL(p) after original DCB has been released the memory.
readwritesplit.c:Replaced RSES_CLEINT_DCB macro with a function which returns client DCB for a given router client session.
2014-12-23 16:10:27 +02:00
VilhoRaatikka
d2281d6391 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-23 13:37:12 +02:00
VilhoRaatikka
51315c0764 Fixed a memory leak in tee.c:freeSession, where tee session wasn't freed 2014-12-23 13:36:05 +02:00
Markus Makela
a199a32301 Addition to bug 658 fix: http://bugs.mariadb.com/show_bug.cgi?id=658
readconnroute.c:Added backend state change handling.
2014-12-23 13:16:24 +02:00
Markus Makela
3826f41007 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-23 11:15:48 +02:00
Markus Makela
0ade57e56e Fix to bug 658: http://bugs.mariadb.com/show_bug.cgi?id=658
readconnroute.c:Added a check for server status before routing the query.
2014-12-23 11:14:19 +02:00
VilhoRaatikka
f0d8ed0cf2 Fix to #657, http://bugs.mariadb.com/show_bug.cgi?id=657
session.c:session_free:if session is child of another service (tee in this case), it is the parent which releases child's allocated memory back to the system. This now also includes the child router session.
dcb.h: Added DCB_IS_CLONE macro
tee.c:freeSession:if parent session triggered closing of tee, then child session may not be closed yet. In that case free the child session first and only then free child router session and release child session's memory back to system.
tee.c:routeQuery: only route if child session is ready for routing. Log if session is not ready for routing and set tee session inactive
mysql_client.c:gw_client_close:if DCB is cloned one don't close the protocol because they it is shared with the original DCB.
2014-12-23 00:26:57 +02:00
VilhoRaatikka
61fcc1e21e Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-22 16:45:31 +02:00
VilhoRaatikka
6b6ac2f95f Partial fix to bug #657, http://bugs.mariadb.com/show_bug.cgi?id=657
dcb.c:dcb_clone: set same close function than in the original DCB so that routing session will become closed when client DCB is closed.
session.h:introduce a new state which indicates that SESSION structure can be freed next, SESSION_STATE_TO_BE_FREED. State is needed to separate the state before and after memory free. Memory is freed in different situation depending on whether the session is parent or child session. Child sessions are freed in their parent.
Also introduce a new member in SESSION struct, ses_is_child, to indicate whether SESSION has a parent session which is responsible for releasing the memory of it.

session.c:session_unlink_dcb:when last session reference is removed set SESSION->state=SESSION_STATE_TO_BE_FREED
session.c:session_free:only free the memory if session is not child session. If it is child, session is left to be freed by the parent (in tee filter's freeSession, for example).

tee.c:newSession:mark branch session to child.
tee.c:freeSession:if child session memory is ready to be freed, free it.

mysql_mon.c:monitorMain:when backend server's status changes so that it is not running anymore or doesn't have any of the states - master, slave, ndb, joined - call for each DCB the callback-function DCB_REASON_NOT_RESPONDING if specified. Earlier callbacks were called if there was any change in the state of the server being monitored.
2014-12-22 16:24:07 +02:00
Markus Makela
68932b49f2 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-20 16:16:05 +02:00
Markus Makela
63006f686d Fixed rwsplit hint tests writing to source tree instead of the build tree. 2014-12-20 16:15:13 +02:00
Mark Riddoch
3e37f0d0f6 Fixed race condition on hashtable n_readers field 2014-12-19 15:54:05 +00:00
Markus Makela
ce53159e7d Moved dbshard tests to a separate cmake file 2014-12-19 17:23:26 +02:00
VilhoRaatikka
c33e17db31 Fix to NULL reference 2014-12-19 14:05:56 +02:00
VilhoRaatikka
726f221113 Added debug log to session closing and related functions 2014-12-19 12:18:25 +02:00
VilhoRaatikka
55447919ce Fix to Coverity issue 84943 2014-12-19 11:35:17 +02:00
Markus Makela
d41d16a1f3 Cleaned up the code and documented fucntions. 2014-12-18 19:51:24 +02:00
VilhoRaatikka
552d3186eb Disabled fix to #642 for now. 2014-12-18 19:20:21 +02:00
VilhoRaatikka
ac97fcd764 Removed redundancy from error and message logs.
server.c: Added new member to SERVER->master_err_is_logged. It is used if server loses master status. It causes error log print in readwritesplit router's eror handling. Initial value is false and it is set always to false when server's status is set to master.
Added message log printing to mysql monitor, if master status changes to something else. It is not warning or error but only information which probably interests the user.

readwritesplit.c:Muted warnings and error printings in cases if slaves are not found if it is allowed to have a master only.
readwritesplit.c:Corrected error log printing in case where master lost its status. REdundant prints are removed.
2014-12-18 19:12:01 +02:00
VilhoRaatikka
494ac968e2 Fix candidate to bug #642, http://bugs.skysql.com/show_bug.cgi?id=652
If user only has a privileges to certain table, login with db still succeeds.

Removed invalid debug assertion from readwritesplit.c
2014-12-17 23:51:04 +02:00
Markus Makela
a7d1a865de Updates to how shards are discovered while the module is running
SHOW DATABASES now takes notice of the state of the backends
Added scripts for sharding test preparation and local port blocking
2014-12-17 16:22:52 +02:00
Markus Makela
e6fca9b50d Added a simple test for dbshard router.
The test sets a session variable and queries a union of this variable and a value in each of the databases.
2014-12-17 14:06:34 +02:00