Commit Graph

397 Commits

Author SHA1 Message Date
5122777829 Try to fix problem if balancing free client DCB and free session so that auth data is always available and client DCB is not freed until session is ready to be freed. Also fix problem in auth logic. 2016-02-24 10:00:45 +00:00
395cbdc103 Simplify handling of "client data" by having a pointer to it only in DCB and not in session structure. Change name of session->client to session->client_dcb for greater clarity. Temporary free of client data in DCB, to be moved to authenticator when it becomes a module. Fix incorrect name of listener_alloc. 2016-02-23 11:13:21 +00:00
5077933e41 Fix bug in mysql_client.c (over optimisation of protocol setting); various clarifications and improvements re code review. 2016-02-22 11:05:02 +00:00
5cfe352a8a Remove inline from function definition. 2016-02-18 11:44:59 +02:00
866e91c088 Changes to improve robustness of SSL processing, separate it so far as possible from protocols. Separate the detailed mechanism of authentication from the MySQL protocol with a view to making it into a module later. 2016-02-15 09:29:07 +00:00
971d1d5de2 Redesign logic of SSL connections to work with status in client DCB instead of in the protocol. This eases the way to moving SSL logic out of a specific protocol (currently MySQL) so as to be available across any protocol. Also, some simplification. 2016-02-03 08:54:55 +00:00
8367d93746 Migrate SSL functionality out of service and into listener. Develop config handling accordingly, including making provision for SSL parameters in servers for future use in implementing SSL to backend servers. Some elements still to be tidied mainly in mysql_client.c - but that will be part of detaching the SSL authentication from the MySQL protocol. 2016-01-27 15:46:19 +00:00
5515c71988 Reapply MXS-504 changes subsequent to optimisation changes. Merge SSL processing into non-SSL processing so far as possible, correct usage of OpenSSL, simplify where possible. 2016-01-13 10:08:37 +00:00
23ebd581dc Fix mistake in optimise-core branch, dcb.c. 2016-01-08 14:11:50 +00:00
fb5fdb17db Switch bitmask_clear to be locking and offer bitmask_clear_without_spinlock for non-locking version, in response to review comments. Revert poll.c to use bitmask_clear (with locking) and amend dcb.c to use the non-locking version and to take advantage of the return of an indication of whether the whole bitmask is then clearn. 2016-01-08 13:47:34 +00:00
78b5777d6e Fixes to Coverity defects
Few fixes to possible use of freed memory and resource leaks.
2015-12-15 13:13:53 +02:00
2afe60dd0e Reindent server/core/dcb.c 2015-11-30 12:42:13 +02:00
916ee5ff2a Rename some log concepts
The mxs prefix is now uniformly used with all log components.
2015-11-26 17:34:53 +02:00
a8535f42af Remove all traces of logfile_t
The earlier log file based approach for enabling and disabling
messages has now been completely replaced with the syslog priority
based approach.

Similarly as with log files before it is now possible to enable
and disable a log priority for a particular session, even though
it apparently has not been used much.

The local test-programs of the logging has got minimal attention
only to make them compile. They should get an overhaul as they did
not work before either.
2015-11-23 19:10:53 +02:00
910ddb99fd Reset sessionid upon exit.
Since the sessionid is now unconditionally set, it also needs to
be unconditionally reset.
2015-11-23 18:44:38 +02:00
62b0e5fab0 Session info always copied to tls
Maxadmin earlier gave the impression that you could change whether
messages for different log files could be specifically enabled for
a session. In practice that was true only for trace messages as the
session id and the bitmask telling what logfiles are enabled, were
copied to thread local storage only as far as trace messages were
concered.

The code for setting that information in place is quit short and
efficient, so there is really no reason not to do that always.
This also means that it always will be possible to get your hands
on the session object if there is a need for that.
2015-11-23 18:14:46 +02:00
6164b7f301 Fixed unsafe use of localtime
Since localtime is not thread-safe it should not be used in multithreaded
contexts. For this reason all calls to localtime were changed to localtime_r
in code where concurrency issues were possible.

Internal tests were left unchanged because they aren't multithreaded.
2015-11-19 17:17:16 +02:00
a355e1beef Printf format checking added to logging function.
Printf format checking added to logging function and all
issues that were revealed by that fixed.
2015-11-16 12:40:49 +02:00
44df53d846 LOGIF and skygw_write_log removed from server/core/*.c
LOGIF and skygw_write_log removed from server/core/*.c and
replaced with calls to MXS_(ERROR|WARNING|NOTICE|INFO|DEBUG).
This is a mechanism change, no updating of the actual message
has been performed.

Currently this causes a very small performance hit, since the
check whether the priority is enabled or not is performed in
the function that is called and not before the function is called.
Once all LOGIFs and skygw_write_logs have been replaced, the
behaviour will be altered back to what it was.
2015-11-16 09:49:12 +02:00
86dcd1cc0f LOGIF_MAYBE macros cleaned away.
Used in few places and only obscured what was going on.
2015-11-14 21:51:27 +02:00
6b88b6b17f Merge branch 'develop' into MXS-329-develop-20151111 2015-11-13 07:48:59 +02:00
05fbdb1b76 Log: skygw_log_flush replaced with mxs_log_flush.
skygw_log_flush replaced with mxs_log_flush and skygw_log_sync_all
with mxs_log_flush_sync.
2015-11-12 18:28:34 +02:00
dee20fe077 Merge remote-tracking branch 'origin/develop' into MXS-329-develop-20151111
# Conflicts:
#	server/core/CMakeLists.txt
#	server/core/buffer.c
#	server/core/service.c
#	server/modules/filter/tee.c
#	server/modules/monitor/mysql_mon.c
#	server/modules/routing/binlog/blr.c
#	server/modules/routing/binlog/blr_slave.c
#	server/modules/routing/debugcmd.c
#	server/modules/routing/readwritesplit/readwritesplit.c
#	utils/skygw_utils.cc

- resolved.
2015-11-11 11:08:02 +00:00
834a88aeda Log variables moved to log_manager.h
The log manager variables lm_enabled_log_files_bitmask, log_ses_count
and tls_log_info that earlier were declared separately in every
c-file are now declared in the log_manager.h header.
2015-11-04 14:26:53 +02:00
5507624326 Fixed typo'd sizeof. 2015-10-29 18:19:05 +02:00
c29858d215 Added a definition for the size of the SSL error message buffer and changed all buffers to use it. 2015-10-29 16:39:38 +02:00
f819f164b5 Cleaned up dcb_accept_SSL and added missing logging. 2015-10-29 16:39:38 +02:00
482db5e84d User friendly bit mask display for DCB print; monitors to work via inserting hangups instead of callbacks. 2015-10-17 20:00:05 +01:00
57f5dd15bc Resolve problem of lingering backend database processes; alter MySQL monitor to insert fake events when backend server unavailable; fix problem with count of current connections. 2015-10-16 17:55:07 +01:00
d000af33f6 Remove obsolete function. 2015-10-13 16:21:17 +02:00
efc0c7420e Correct misplacement of decrementing current connections counter. 2015-10-13 16:19:24 +02:00
5c985b42ba Fix problem with persistent DCB disposal 2015-10-05 16:36:07 +01:00
d582c5880c Impose locking on dcb_call_foreach DCB callback mechanism. Add counters and maxima for DCBs and zombies to aid diagnosis. 2015-09-29 11:58:31 +01:00
2231d0870c Place checks in callback routines because DCB will not always contain a reference to a router session, and the associated data will be invalid in this case. 2015-09-25 12:17:18 +01:00
2dfb9e3c11 Merge branch 'develop' into MXS-329 2015-09-24 17:59:36 +03:00
89667294b3 Fix exceptional cases in DCB dcb_call_callback and in MySQL backend gw_error_backend_event - close DCB and return. 2015-09-24 07:39:47 +01:00
3b19acd1de Write queue emptied in dcb_final_free.
NOTE: Invalid indentation for reduced conflicts with MXS-329.
2015-09-23 15:16:19 +03:00
7aa36b77ea Guarantee router session is present for call to clientReply; properly free callbacks; attempt to set all necessary values for dbusers; do more to ensure buffers freed. 2015-09-21 14:25:12 +01:00
88716c35fb Various changes to block loopholes in different cases and tidy up. 2015-09-21 09:23:22 +01:00
b8af047a25 Remove excessively tight conditions for selecting persistent connections, add more information to debug output when connection is rejected. 2015-09-18 11:03:23 +01:00
31c6666278 Ensure DCB for closing session does not become persistent; remove bref_was_not_in_use. 2015-09-17 14:38:56 +01:00
357c4bcae5 Add to or take from persistent pool only if server is running; add conditions to DCB close in read-write handleError to check backend reference was in use. 2015-09-17 12:53:59 +01:00
fe9babe9ec Cleaned up code. 2015-09-16 10:22:29 +03:00
5d1895561c Moved parts of dcb_read_SSL to separate functions. 2015-09-14 09:54:42 +03:00
96fdb5eb8d Fixed SSL write failures not being handled properly. 2015-09-10 18:36:59 +03:00
cfeaf7d6e9 Merge remote-tracking branch 'origin/develop' into MXS-329
Conflicts:
	server/core/session.c
2015-09-10 13:07:27 +01:00
f6916a23bd Move responsibility for closing DCB on error to router error handling. Check that routers remove or disable links to closed DCB. 2015-09-09 09:33:00 +01:00
160bbb70ee MXS-251: strerror
Replaces all calls to strerror with calls to strerror_r. The former
is non-thread safe while the latter is.
2015-09-05 15:52:13 +03:00
42c9532a56 Simplify logic and reverse list to kill, so as to cancel out the reversal in the original zombie list. Probably not significant, but might be helpful. 2015-09-05 00:32:29 +01:00
d3cdaa4346 No need to process zombie victims if queue is empty. 2015-09-04 18:09:43 +01:00