141 Commits

Author SHA1 Message Date
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
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
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
VilhoRaatikka
0ea4dd63a9 Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop 2014-11-11 14:25:49 +02:00
VilhoRaatikka
128d5e3f48 Addition to previous fix 2014-11-11 14:25:34 +02:00
VilhoRaatikka
061fa62d29 Fixes to Coverity issues 77197 (mysql_common.c, dcb.c, mysql_client.c, skygw_debug.h), 72654 (poll.c), 72756 (mysql_backend.c), 72744 (mysql_backend.c), 77197 (mysql_common.c), 72746 (mysql_common.c), 72676 (mysql_common.c), 72705 (readwritesplit.c), 72697 (readwritesplit.c), 72652 (skygw_debug.h) 2014-11-11 14:10:06 +02:00
MassimilianoPinto
39b04682ea COM_CHANGE_USER honours charset change
COM_CHANGE_USER honours charset change
2014-11-10 17:06:14 +01:00
MassimilianoPinto
49d28bc1f3 MySQL connect: charset flag is stored
MySQL connect: charset flag is stored and passed to backend
2014-11-10 16:09:55 +01:00
VilhoRaatikka
3b07449daa Fix to bug #614, http://bugs.skysql.com/show_bug.cgi?id=614
Added protected state check to mysql_client.c, fixed locking in session.c
2014-11-10 14:07:51 +02:00
VilhoRaatikka
44771dbc51 readwritesplit.c:handleError is meant to handle backend errors. Removed one call from mysql_client.c and only send error message to client instead.
Added checks to debug build to ensure that handleError is called before backend DCB is closed.
2014-11-07 17:55:05 +02:00
VilhoRaatikka
4b98c472a8 Fixed a comment 2014-11-06 16:12:01 +02:00
VilhoRaatikka
9ccbab1899 poll.c:dcb_close Don't call poll_remove_dcb anymore if DCB has already been removed from poll set.
mysql_backend.c, mysql_client.c free error message GWBUF after calling handleError
readconnroute.c:handleError send error message to client before returning.
readwritesplit.c:handleError don't free error message buffer anymore since the caller of handleError frees it.
2014-11-01 20:00:59 +02:00
VilhoRaatikka
3f375e680a Fix to #590, http://bugs.mariadb.com/show_bug.cgi?id=590
gw_change_user returned error code in cases where authentication failed. That is not right behavior in that context. gw_change_user succeeds to route query and should return succees to router's routeQuery. Possible error is handled by creating error message and by feeding it to client DCB's event queue.
2014-10-31 20:09:43 +02:00
VilhoRaatikka
00fded016b Fixes to Coverity tasks : 73267, 72686, 72672
Cleaned up warnings, and added checks to malloc return values and error log writes in case of failures.
2014-10-31 15:25:59 +02:00
VilhoRaatikka
60536f622e Fix to bug #590, http://bugs.mariadb.com/show_bug.cgi?id=590
Added function poll.c:poll_add_epollin_event_to_dcb which adds given event and related GWBUF to given DCB. The DCB is then added to event queue list so that its even becomes executed as soon as any of the threads start to process events next time.
The problem solved is case where COM_CHANGE_USER failed due to authentication failure. An error should be sent to the client but it was sent once per failed backend authentication instead of just once.
Thread which failed in authentication bypassed router and thus replies weren't filtered out. Solution adds an event and a GWBUF including error message to DCB and the DCB is then added to event queue. Thus the error message appeares like it was an incoming event and becomes processed properly.

An addition was made to mysql_backend.c:gw_read_backend_event so that self-generated event can be processed. Even if socket read doesn't manage to read anything, function proceeds if there is enough data in DCB's readqueue.

Fix ti bug #602, http://bugs.mariadb.com/show_bug.cgi?id=602
Added function sescmd_response_complete which checks if the read data completes session command response packet(s). Function is called only if there's a sessoin command being executed.
2014-10-30 16:54:27 +02:00
MassimilianoPinto
970511a275 Update for message errors in DB authentication
Update for message errors in DB authentication
2014-10-24 12:20:50 +02:00
MassimilianoPinto
35996a40cb Reply messages for failed db authentication
Reply messages for failed db authentication
2014-10-23 19:36:25 +02:00
MassimilianoPinto
3cdb1dc2ae Added db names as hashtable
Added db names as hashtable
2014-10-20 19:26:13 +02:00
MassimilianoPinto
220e1d9505 local authentication with db name for change_user
local authentication with db name for change_user
2014-10-20 10:26:00 +02:00
MassimilianoPinto
b8f590e67f Added database errmsg to change_user
Added database errmsg to change_user
2014-10-17 19:02:19 +02:00
MassimilianoPinto
273a445045 Code cleanup
Code cleanup
2014-10-13 10:47:27 +02:00
MassimilianoPinto
ee54310a73 Implementation of db auth
Implementation of db auth
2014-10-13 09:50:55 +02:00
VilhoRaatikka
29e53e150a Fix to bug # 565, http://bugs.mariadb.com/show_bug.cgi?id=565
Client flags are now copied to each backend and used in their connections.

log_manager.cc: fixed string allocation where one byte was missing.
mysql_client.c: fixed string allocation where one byte was missing.
2014-10-08 22:27:28 +03:00
VilhoRaatikka
aca8596efa mysql_client.c:gw_client_close didn't close client session in cases where session->state == SESSION_STATE_STOPPING. That is a bug and lead to situation where session wasn't closed at all.
Also changed 'authorization failed' to 'access denied'
mysql_common.c: fixed memory leak in gw_receive_backend_auth, and replaced error code '2800' with '28000'.
readconnroute.c:handleError didn't set *succp pointer so uninitialized value was used in caller's context.
makefile.inc: added -lm to linker flags
mysql_backend.c: added a few comments
2014-10-06 11:46:12 +03:00
Markus Makela
c4ca1ddb13 Updated non-source files with new company name. 2014-10-01 15:21:47 +03:00
Markus Makela
b0683d9b4d Updated the licensing year from 2013 to 2013-2014 2014-10-01 14:37:12 +03:00
Markus Makela
f4e591e382 Changed 'SkySQL Gateway' to 'MariaDB Corporation MaxScale' 2014-09-30 13:15:03 +03:00
Markus Makela
c344231f80 Renamed all occurences of SkySQL to MariaDB Corporation 2014-09-30 13:02:10 +03:00
VilhoRaatikka
5a28a73fcb gwbuf_append's return value wasn't read in gw_read_client_event 2014-09-12 18:10:42 +03:00