Commit Graph

336 Commits

Author SHA1 Message Date
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
d74990833b Move capture of user name for persistent connections; expand error message in mysql client to give more information. 2015-09-01 09:59:34 +01:00
a711b25fec Improve user name setting in DCB for persistent connections and to fix bug; change name of session_alloc_dummy to session_set_dummy to be more informative. 2015-08-28 18:20:32 +01:00
9c5f622481 Additional spinlock in random_jkiss. Initial attempt at implementing dummy sessions to provide total consistency - used in mysql_client in relation to authentication - a single static dummy session is used and linked from the client dcb when authentication is not yet complete. 2015-08-28 15:30:06 +01:00
1f6b544f33 Tidy dcb_free (prefer use of dcb_close) and remove from test code; add good random number generator. 2015-08-26 15:43:21 +01:00
e7c74c39cf Fix bug in persistent connections; add code to check for DCB session pointer in poll loop before invoking processing. 2015-08-25 12:19:02 +01:00
8425deab18 Fixed bugs by moving setting of thread bit mask from polling to DCB closing, fixed other mistakes. 2015-08-25 11:46:25 +01:00
ea09918312 Fix mistakes. 2015-08-25 09:54:56 +01:00
3dd20cb9ec Acquire user for DCB from DCB session sooner, needed for persistent connection handling. 2015-08-25 09:53:01 +01:00
980b56e7fa Fix stupid extra } 2015-08-25 09:33:40 +01:00
d27ffcf06a Fix mistake in debug STRDCBSTATE() 2015-08-25 09:31:54 +01:00
f18f233de2 Try to resolve unexpected compiler errors 2015-08-25 09:23:24 +01:00