167 Commits

Author SHA1 Message Date
Markus Makela
54d242758f Revert "Removed walking of packets from mysql_backend and moved storing of partial packets to session command handling section."
This reverts commit 9e1dc40bb549fdaf05fb4f8c12dc159c30ad4c41.
2015-03-23 11:55:03 +02:00
Markus Makela
9e1dc40bb5 Removed walking of packets from mysql_backend and moved storing of partial packets to session command handling section. 2015-03-23 11:17:07 +02:00
Markus Makela
b416455f4f Added missing type to GWBUF returned from mysql_backend. 2015-03-22 16:53:51 +02:00
Markus Makela
6cfc2338c1 Small fix to modutil_get_complete_packets. 2015-03-22 10:33:35 +02:00
Markus Makela
55513cc998 Improved modutil_get_complete_packets to only allocate a single buffer. 2015-03-22 07:44:14 +02:00
Markus Makela
dcdb86e5a9 Fix to MXS-47: https://mariadb.atlassian.net/browse/MXS-47
mysql_backend now streams server response data.
2015-03-19 11:35:01 +02:00
Markus Makela
880adca73e Merge branch 'develop' into MAX-324 2015-03-05 10:45:48 +02:00
Markus Makela
bdbe55233d Fix to NULL dcb in mysql_backend.c 2015-02-25 12:10:33 +02:00
Markus Makela
9e7afeb302 Merge branch 'develop' into MAX-324
Conflicts:
	macros.cmake
	server/core/config.c
	server/core/service.c
	server/modules/routing/CMakeLists.txt
2015-02-24 06:26:55 +02:00
Markus Makela
aa4932bf2d Moved the housekeeper heartbeat to a separate header for ease of integration.
This keeps the behavior the same but allows the heartbeat to be used as a crude timer
without including everything the housekeeper.h header includes.

Moved the protocol level updates on the DCBs last_read value into dcb_read.
This keeps the implementation nice and compact.
2015-02-24 05:00:16 +02:00
Markus Makela
c47d2f3791 Added session timeouts.
The parameter 'connection_timeout' for services takes a value as seconds.
All sessions that have been idle for longer than this will be disconnected.
2015-02-20 22:16:43 +02:00
Markus Makela
ea88cea959 Merge branch 'develop' into MAX-324 2015-01-29 20:36:26 +02:00
VilhoRaatikka
270c0ebf8a Clean up, added comments, removed some dead code. 2015-01-27 10:24:37 +02:00
Markus Makela
db1ea422a0 Merge branch 'develop' into MAX-324
Conflicts:
	server/core/modutil.c
2015-01-20 04:25:40 +02:00
VilhoRaatikka
fca674b16a modutil.c: added modutil_reply_auth_error
mysql_backend.c:gw_change_user: instead of setting flags directly to replybuffer, set server command to backend's protocol object and reply the message directly to backend where flags are set and it is replied back to client.
2015-01-19 00:01:08 +02:00
VilhoRaatikka
6d2b38d4b6 Complementary fix to #694,http://bugs.mariadb.com/show_bug.cgi?id=694
RWSplit router handles query processing errors that happened in router by sending parse error reply to client. routeQuery fails only when backend has failed.
2015-01-17 22:40:52 +02:00
Markus Makela
db70163373 Merge branch 'develop' into MAX-324
Conflicts:
	query_classifier/query_classifier.cc
2015-01-15 13:17:42 +02:00
VilhoRaatikka
b3824a1eaf Clean up bits and pieces, removed some unnecessary checks. 2015-01-14 14:11:19 +02:00
Markus Makela
0187edf559 Merge branch 'develop' into MAX-324
Conflicts:
	query_classifier/query_classifier.cc
2015-01-14 04:56:58 +02:00
VilhoRaatikka
61efbfe687 Added comment to mysql_backend.c:process_response_data 2015-01-13 09:52:54 +02:00
Markus Makela
fed828eb29 Merge branch 'release-1.0GA' into MAX-324
Conflicts:
	server/MaxScale_template.cnf
	server/core/service.c
2015-01-06 04:45:30 +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
48f443782e Fixed a typo 2015-01-02 09:55:55 +02:00
VilhoRaatikka
a745383956 Added debug log to mysql_backend.c:gw_read_backend_event to tracm the case where less than 5 bytes is read from backend. This is potential issue with long result sets. 2015-01-02 09:53:24 +02:00
VilhoRaatikka
2c2d6f8b66 Clean up. Removed dead code and added comments. 2014-12-30 10:05:13 +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
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
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
VilhoRaatikka
bc104c0ef1 Merge branch 'release-1.0GA' into MAX-324 2014-12-08 22:37:15 +02:00
VilhoRaatikka
6a54d888de Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-08 16:04:27 +02:00
VilhoRaatikka
5264a1abc9 Added function documentation, moved one non-error log entry to message log, cleaned up a bit. 2014-12-08 16:02:16 +02:00
Mark Riddoch
8fed527ac9 Merge branch 'release-1.0GA' into blr 2014-12-08 09:21:38 +00:00
Mark Riddoch
ce056dccd8 Update modue status of all GA modules 2014-12-08 09:19:35 +00:00
VilhoRaatikka
b1eaaea961 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-05 23:57:02 +02:00
VilhoRaatikka
01b1b0a304 Fixes to Coverity issues 84388, 84386, 84385
mysql_mon.c: Added back server state logging to Debug build.
query_classifier.cc: removed some extra debug code, cleaned up a bit function documentation.
mysql_client_server_protocol.h, mysql_backend.c, mysql_common.c: changed some variables to signed ones to enable checking of calculations in the code.
skygw_utils.cc: removed erroneous debug assertion.
2014-12-05 23:39:14 +02:00
Mark Riddoch
e102d56e69 Merge branch 'blr' into release-1.0GA
Conflicts:
	server/modules/protocol/mysql_backend.c
	server/modules/routing/binlog/blr_master.c
2014-12-05 11:42:02 +00:00
Mark Riddoch
2b998eb17f Merging binlog router into beta refresh 2014-12-05 11:30:03 +00:00
Markus Makela
84679a48ff Fixes to Coverity defects 84335 84336 84337 2014-12-04 10:13:41 +02:00
Markus Makela
1e2027f4dc Fixes to Coverity defects 83027 73421 72714 72671 72646 72642 2014-12-03 17:56:22 +02:00
VilhoRaatikka
6d98df0c37 Added error check to mysql_backend.c to prevent unnecessary logging. 2014-12-03 15:42:04 +02:00
MassimilianoPinto
33f77303f7 Backend failed handshake is now a detected
Backend failed handshake is now a detected and MYSQL_HANDSHAKE_FAILED s
set.

Reload users from backend is now restricted to MYSQL_AUTH_FAILED only
2014-12-03 09:11:26 +01:00
VilhoRaatikka
a78ac19a87 Added createInstance and newSession, cleaned up things related to other routers. 2014-12-01 15:52:00 +02:00
VilhoRaatikka
83f7203213 Fix to unreported bug which printed result of getsockopt even in case when there was no socket error. 2014-11-27 15:37:13 +02:00
Mark Riddoch
863a30c969 Merge branch 'blr' of https://github.com/mariadb-corporation/MaxScale into blr
Conflicts:
	server/core/gateway.c
2014-11-26 08:47:50 +00:00
Mark Riddoch
d3c8770852 Merge branch 'blr' into develop
Conflicts:
	client/maxadmin.c
	server/core/CMakeLists.txt
	server/core/dcb.c
	server/core/gateway.c
	server/core/poll.c
	server/core/test/CMakeLists.txt
	server/core/test/makefile
	server/include/poll.h
	server/modules/routing/debugcmd.c
2014-11-19 12:00:55 +00:00
Mark Riddoch
6cbbf7260f Improved logging and diagnostics 2014-11-19 10:49:40 +00:00
VilhoRaatikka
fd11e6a7f5 Session-specific logging. Added functions
void session_enable_log(SESSION* ses, logfile_id_t id)
and
void session_disable_log(SESSION* ses, logfile_id_t id)

Which switch specific log type on/off if the log type in question is not generally enabled.

Each thread carries a thread-specific struct log_info_t which includes members for current session id and bitfield for enabled log types for the current session. That information is checked before actual log write functions are called.

Each file where session-specific logging is used, must include the following exports:

/** Defined in log_manager.cc */
extern int            lm_enabled_logfiles_bitmask;
extern size_t         log_ses_count[];
extern __thread log_info_t tls_log_info;
2014-11-19 00:08:59 +02:00
VilhoRaatikka
8c1e7172f3 Added debug logging for #615 2014-11-14 20:48:33 +02:00
VilhoRaatikka
77aa9827fe Fix candidate to bug #615, http://bugs.skysql.com/show_bug.cgi?id=615 2014-11-14 13:06:35 +02:00
VilhoRaatikka
175711a1bc Fix to #601, http://bugs.skysql.com/show_bug.cgi?id=601
if (func.auth ==)gw_change_user->gw_send_change_user_to_backend is called before backend has its scramble, auth packet is set to backend's delauqueue instead of writing it to backend. When backend_write_delayqueue is called COM_CHANGE_USER packets are rewritten with backend's current data.
2014-11-13 17:55:29 +02:00