Commit Graph

190 Commits

Author SHA1 Message Date
06c5da7b17 Minor fix to SSL authentication. 2015-06-09 02:56:55 +03:00
1c36cfb285 Added more debug output. 2015-06-08 18:04:43 +03:00
b8e55fe28d Fixed SSL_accept failing when more data was in the socket buffer than was used. 2015-06-07 12:45:08 +03:00
d19ccc6f84 Fixed SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE and SSL_ERROR_NONE causing a debug assert. 2015-06-05 20:36:04 +03:00
1989a1482c Fixed empty reads causing a debug assert with large packets. 2015-06-05 19:40:09 +03:00
61b1f34671 Added more descriptive debug output. 2015-06-05 18:52:44 +03:00
518ef5050e Fixed debug asserts. 2015-06-05 12:15:19 +03:00
e83799648a Fixed queries getting stuck when the SSL records were of the maximum allowed size. 2015-06-05 11:00:51 +03:00
cc1f720ea3 Removed log flushing on every dcb_read_SSL if debug log is enabled. 2015-06-04 21:12:16 +03:00
ce570685cd Moved assertions around. 2015-06-04 19:31:58 +03:00
dceccce2ef Changed gwbuf_length function to GWBUF_LENGTH macro in dcb_read_SSL. 2015-06-04 16:52:43 +03:00
a033cbf200 Added more informative error messages when SSL handshake fails. 2015-06-03 14:14:05 +03:00
a5de4fc503 Merge branch 'develop' into MXS-129 2015-06-02 12:21:05 +03:00
fc8918b1f2 Added a dcb_connect_SSL function which starts a client SSL connection. 2015-06-02 09:15:08 +03:00
d7232d8b6e Moved SSL structure to the DCB instead of the MySQL protocol.
This allows for non-MySQL SSL connections.
2015-06-01 20:51:26 +03:00
a2768955e7 SSL handshake now successfully completes when a client connects with SSL enabled. 2015-06-01 13:50:22 +03:00
0f814d3e73 Added SSL write and read functions. 2015-05-29 13:00:37 +03:00
fec1e66a5c Add comment for parameter, correct spelling in comment. 2015-05-12 11:53:11 +01:00
1b0fd4576a Merge branch 'maxinfo' into develop
Conflicts:
	server/core/service.c
	server/core/session.c
	server/include/session.h
2015-03-04 11:33:00 +02:00
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
8eb14235d1 Addition of DCB and Poll statistics in show status output 2015-02-20 10:05:50 +00:00
8e941f7523 Addition of the MaxInfo filter and the generic MaxScale resultset 2015-02-18 17:25:13 +00:00
da029140cd dcb_call_foreach now only calls the callbacks for those DCBs that are connected to the server. 2015-02-18 05:36:39 +02:00
98cbc34c6c Fix for bug #714
Fix for bug #714
2015-02-06 11:26:48 +01:00
270c0ebf8a Clean up, added comments, removed some dead code. 2015-01-27 10:24:37 +02:00
b3824a1eaf Clean up bits and pieces, removed some unnecessary checks. 2015-01-14 14:11:19 +02:00
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
073db0f1e2 Added checks that the query was cloned in clientReply before waiting for a reply. 2014-12-30 23:05:13 +02:00
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
2c2d6f8b66 Clean up. Removed dead code and added comments. 2014-12-30 10:05:13 +02:00
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
a1d7ccac2f Commented out a debug assert in dcb.c:917 2014-12-23 17:40:22 +02:00
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
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
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
726f221113 Added debug log to session closing and related functions 2014-12-19 12:18:25 +02:00
04a92e40df Fixes to Coverity defects 84879 84878 72752 72742 2014-12-15 06:28:47 +02:00
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
5fa87776b0 Fixes for Coverity bugs 2014-11-20 16:04:22 +00:00
a65b9fa8b3 Fixes to Coverity defects: 72662 82143 82144 82145 82348 82349 2014-11-20 06:44:43 +02:00
43ed77b52b Bug 515 Conditional arguemnt to gw_write 2014-11-19 16:43:21 +00:00
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
6cbbf7260f Improved logging and diagnostics 2014-11-19 10:49:40 +00:00
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
a30fc0c787 MAX-328, Add session identifier to trace log entries. Session id is given to session in session_alloc and stored to thread's local storage variable when thread picks a new event from epoll_wait. 2014-11-17 23:27:14 +02:00
8c1e7172f3 Added debug logging for #615 2014-11-14 20:48:33 +02:00
8311d02f61 Removed unnecessary local variables for errno since it is thread safe. 2014-11-11 14:51:55 +02:00
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
9a5168c3e8 Put errors ganerating code behind FAKE_CODE macro, which is not defined by default in any build. 2014-11-10 15:22:08 +02:00
62270412cf readwritesplit.c: prevent switching the master during session. Added logging to cases where master has changed.
Moved DCB's member errhandle_called behing DEBUG flags to Release build. It shows if handleError is called for a DCB and makes it possible to avoid redundant calls.
2014-11-10 14:15:32 +02:00