190 Commits

Author SHA1 Message Date
Mark Riddoch
9e642c32cb Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop 2015-01-22 15:09:01 +01:00
Mark Riddoch
41bc0ddd24 Addition of example filter to set routing hint to route to a named server
based on a regular expression match within the query text.
2015-01-22 15:08:06 +01:00
Markus Makela
81aa2b7c00 Removed redundant include from tee.c. 2015-01-20 12:52:39 +02:00
Timofey Turenko
885dfb0242 Merge branch 'remove_makefiles' into develop 2015-01-16 18:04:16 +02:00
Markus Makela
533042b61a Fixes to coverity defects from 85514 up to 85529. 2015-01-15 14:09:11 +02:00
Markus Makela
88a26f03ab Fix to bug 685: http://bugs.mariadb.com/show_bug.cgi?id=685
Added the missing detection of partial packets in the buffers.
2015-01-15 13:13:09 +02:00
Markus Makela
85c84c9e71 Fixed debug variables being used out of debug blocks. 2015-01-15 05:11:08 +02:00
Markus Makela
b635eb1493 Additional debugging info added to tee filter. 2015-01-14 21:13:52 +02:00
Timofey Turenko
7e05d4d716 Merge branch 'develop' into remove_makefiles 2015-01-14 19:09:43 +02:00
Timofey Turenko
06c2d201e0 remove makefiles and other garbage 2015-01-14 19:08:24 +02:00
Markus Makela
5c210455fa Fixed variable declaration being inside a debug build only block. 2015-01-14 18:20:59 +02:00
Markus Makela
df2297aa6c Added missing command types that possibly receive multiple packets to tee.c. 2015-01-13 22:10:47 +02:00
Markus Makela
7f4675cd57 Fix to bug 685: http://bugs.mariadb.com/show_bug.cgi?id=685
Added the missing ERR packet detection to modutil functions.
2015-01-13 21:32:04 +02:00
Markus Makela
d194af0733 Moved result set processing functions to modutil.c from tee.c. 2015-01-13 09:45:58 +02:00
Markus Makela
2b4e6bb594 Merge branch 'develop' into firewall
Conflicts:
	server/modules/filter/test/CMakeLists.txt
2015-01-13 07:48:43 +02:00
Markus Makela
c7362cec23 Update to bug 685 fix: http://bugs.mariadb.com/show_bug.cgi?id=685
Fixed results sets not being processed as a set of multiple packets.
2015-01-12 18:52:59 +02:00
Markus Makela
759b0c2ccb Fix to bug 685: http://bugs.mariadb.com/show_bug.cgi?id=685
Tee filter now supports longer packets and only sends the last GWBUF if both the parent and the child session have send all their bytes.
2015-01-09 19:38:50 +02:00
Markus Makela
ba009e5fd3 Fixes to Coverity defects 85010 84878 72752 72742 72719 and 73418.
skygw_utils.cc: Added function is_valid_posix_path that checks if a path is POSIX-compliant.
2015-01-05 06:05:56 +02:00
VilhoRaatikka
a3d5367d55 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA
Conflicts:
	server/modules/filter/tee.c
2015-01-02 18:43:17 +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
Markus Makela
ef19b9e729 Fixed concurrency issues in tee.
tee.c: added a spinlock to the session which is used in clientReply
2015-01-02 16:21:21 +02:00
Markus Makela
a99c24e9dc Tee filter now only returns the reply from the parent service. 2015-01-02 16:12:44 +02:00
Markus Makela
4e655eda0a Fixes to coverity defects 85250 and 85251. 2015-01-02 07:21:13 +02:00
Markus Makela
89a394ab09 Fixed orphaned sessions being stuck in the SESSION_STATE_STOPPING state. 2015-01-01 19:53:26 +02:00
Markus Makela
9061967c31 Added simple query success detection to tee filter.
tee.c: If one query fails and the other succeeds the successful one is returned to the client.
2015-01-01 14:14:36 +02:00
Markus Makela
ce58157901 Added more debugging output.
tee.c: Added details about the freeing of orphaned sessions.
session.: Added missing cases of session state into the session_state function in debug builds.
2015-01-01 13:03:03 +02:00
Markus Makela
162391c46c Fixed orphaned branch sessions leaking memory.
tee.c: Created a static, module-wide list of orphaned branch sessions which holds the branch sessions that can't be freed at the
time the parent session is being freed. This list is processed every time a a tee filter session is freeing its memory.
2015-01-01 07:37:28 +02:00
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
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
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
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
Markus Makela
fcca284db3 Added complex recursion detection to tee filter 2014-12-24 06:22:49 +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
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
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
d41d16a1f3 Cleaned up the code and documented fucntions. 2014-12-18 19:51:24 +02:00
Markus Makela
1e43102eea Merge branch 'release-1.0GA' into firewall 2014-12-16 11:10:02 +02:00
VilhoRaatikka
82407ceaf4 Fix to #650, http://bugs.mariadb.com/show_bug.cgi?id=650
Added checks.
2014-12-15 15:03:47 +02:00
VilhoRaatikka
a4968f2521 Complete fix candidate for #645, http://bugs.skysql.com/show_bug.cgi?id=645 and #648, http://bugs.skysql.com/show_bug.cgi?id=648
tee.c:closeSession removed unnecessary dcb_free, router/service closes all backend DCBs and the client DCB, and client DCB is the one that was tried to free in closeSession.
readwritesplit.c:routeQuery now handles untyped and typed GWBUFs. Untyped means that read buffer may consist of incomplete and multiple MySQL packets. Typed buffer always consists of a single MySQL packet (which can be split to many buffers inside GWBUF).
Fixed Coverity cases #84840 and #84841
2014-12-14 11:26:15 +02:00