4342 Commits

Author SHA1 Message Date
Johan Wikman
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
Johan Wikman
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
Markus Makela
1f15843d61 Refactored schemarouter to use the resultset.h data types and functions
The generated responses to SHOW DATABASES are now generated by using the resultset.h
data types and functions.
2015-11-16 08:39:49 +02:00
Johan Wikman
b8fda016c9 Log: Some cleanup.
Stuff that does not need to be in the header moved to the
implementation file.
2015-11-15 19:43:45 +02:00
Johan Wikman
bcb918e60b Log: Another step in the move from logfiles to priorities.
skygw_[enable|disable]_log has now been removed from the external
interface and priorities must instead be set using
mxs_log_set_priority_enabled(int priority, bool enabled). A bitmask
is already being updated, but internally and as used by the LOG_IF
macros, the actual enabling is still made using logfile ids.

The configuration entries have been replaced as follows:

	log_messages -> log_notice
	log_trace    -> log_info

The old ones can be used, but cause a warning to be logged.

Similarily the maxadmin commands have been updated.
"[enable|disable] log ..." works as expected, but there will be
a message about it being deprecated. Instead there is now a
[enable|disable] log-priority err|warning|notice|info|debug
command that should be used instead.
2015-11-14 22:28:17 +02:00
Johan Wikman
2dcdab29b6 LOGIF_MAYBE macros cleaned away.
Used in few places and only obscured what was going on.
2015-11-14 22:28:17 +02:00
Johan Wikman
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
Markus Makela
8d0bd8150a Merge branch 'MXS-329-develop-20151111' into develop 2015-11-13 17:26:34 +02:00
Markus Makela
b0c48c3f66 Updated config.c to use PCRE2
config.c now uses PCRE2 to clean up parameter values.
2015-11-13 16:44:23 +02:00
Markus Makela
0b2e00118a Added missing initialization
The service->protocol->listener was never initialized in serviceAddProtocol
and caused a crash if the listener was not started.
2015-11-13 16:38:22 +02:00
Johan Wikman
841ec695e4 Incorrect error handling corrected. 2015-11-13 12:48:13 +02:00
Markus Makela
76856e6c90 Fixed compiler warnings. 2015-11-13 11:53:12 +02:00
Markus Makela
327c29849c Fixed spelling mistakes in documentation. 2015-11-13 10:39:21 +02:00
Markus Makela
6b88b6b17f Merge branch 'develop' into MXS-329-develop-20151111 2015-11-13 07:48:59 +02:00
Markus Makela
1433d28f5f Added missing initialization for monitor parameters
Monitor parameters were uninitialized and the pointer was used when
the monitors were started.
2015-11-13 06:54:13 +02:00
Johan Wikman
2c1b53c120 Log: Cleanup of API
skygw_ functions removed and replaced with mxs_ equivalents.
logfile_id_t removed.
2015-11-12 18:31:53 +02:00
Johan Wikman
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
Johan Wikman
c7a329e43e Log: skygw_logmanager_init renamed to mxs_log_init.
skygw_logmanager_init renamed to mxs_log_init and skygw_logmanager_done
renamed to mxs_log_finish. skygw_logmanager_exit removed alltogether as
all it did was to call skygw_logmanager_done. That appears to have been
a source for confusion as in many places a call to skygw_logmanager_done
was followed by a call to skygw_logmanager_exit. In addition, the function
skygw_log_done was removed from the header, since it lacked an
implementation.
2015-11-12 16:06:44 +02:00
Johan Wikman
680345d374 Whitespace cleanup of config.c
- Tabs replaced with spaces.
- Allman indentation style
2015-11-12 16:06:02 +02:00
Markus Makela
5efd564573 Fix to MXS-288: https://mariadb.atlassian.net/browse/MXS-288 Added MySQL 5.7 authentication
The change to the mysql.user table in MySQL 5.7 caused MaxScale to stop
working with it. This commit adds functionality that checks which version of
the user data query should be made. It also moves common code related to
server version strings to server.c
2015-11-12 15:24:27 +02:00
Johan Wikman
bdfd72404b Log: skygw_log_rotate replaced with mxs_log_rotate.
With only one log-file no arguments are needed. The maxadmin command
'flush log'  still accepts all the previous arguments, but warns about
them being deprecated.
2015-11-12 14:48:37 +02:00
Markus Makela
0705f38bb9 Fix to MXS-464: https://mariadb.atlassian.net/browse/MXS-464
The ownership change for the /var folders is now done recursively.
2015-11-12 09:42:24 +02:00
Johan Wikman
3cfd1ee4e8 Log: Logging is now done by priority and not logfile.
The native way for logging is now by syslog priority and not by
logfile id. In practice that means that there's a function -
mxs_log_message - that takes a syslog priority. The new logging
macros (MXS_ERROR and friends) call that directly and the old
ones as well after having the logfile id translated into the
equivalent priority.

What is enabled or not is still by logfile id and hence the
priority is internally translated into a logfile id when checking
whether something really should be logged or not.
2015-11-12 08:40:29 +02:00
Markus Makela
e37ba0a63d Fixed build failures due to conflicts
Due to an odd rebase, a conflict was left in externcmd.c
2015-11-11 21:38:37 +02:00
Markus Makela
ba9da9ae3d Fixed invalid EXTERNCMD allocation
externcmd_allocate now returns either a valid EXTERNCMD or NULL.
2015-11-11 21:26:10 +02:00
Markus Makela
2d600868f5 Added argument substitution to monitor scripts 2015-11-11 21:19:07 +02:00
Markus Makela
466224b316 Moved common monitor code to externcmd.c
File existence and permission checks are now done in externcmd_can_execute
2015-11-11 21:19:07 +02:00
Markus Makela
d56843835c Cleaned up externcmd_allocate and externcmd_free 2015-11-11 21:19:07 +02:00
Markus Makela
9ab5326960 Fix to MXS-438: https://mariadb.atlassian.net/browse/MXS-438
Maxinfo now supports the shutdown command which shuts down a service, monitor
or MaxScale itself and the restart command which restarts a stopped monitor
or service.
2015-11-11 18:59:39 +02:00
Markus Makela
3ea55e3b50 Fix to MXS-437: https://mariadb.atlassian.net/browse/MXS-437
Maxinfo now allows users to flush logs and change the server status
through the MySQL interface.
2015-11-11 18:57:19 +02:00
Markus Makela
30d1fc66b7 getCapabilities no longer takes arguments and returns an int. 2015-11-11 18:14:03 +02:00
Markus Makela
264944ff23 Service users are set to NULL after they are freed. 2015-11-11 18:02:01 +02:00
Markus Makela
c5c416e7fe Fixed modification of parameters
Monitor parameters were being modified in externcmd_allocate which caused truncation
of the arguments to the commands.
2015-11-11 18:01:09 +02:00
Markus Makela
8363673be6 Added number of inserted elements to hashtable
Added tracking of the number of inserted elements to the hashtable.
Also added utility function to get the size of the hashtable.
2015-11-11 17:57:35 +02:00
Markus Makela
cd6f7ce046 Fix to MXS-447: https://mariadb.atlassian.net/browse/MXS-447
Monitors are now started after they have been fully configured.
2015-11-11 17:54:41 +02:00
counterpoint
49d4a2019e Clarify and fix logic around router capabilities, with particular reference to crash relating to binlog router. 2015-11-11 15:43:23 +00:00
Johan Wikman
b6783c24d0 Log: Some gotos removed. 2015-11-11 15:20:25 +02:00
Johan Wikman
b4e9dcd567 Log: succp renamed to succ. 2015-11-11 15:18:08 +02:00
Johan Wikman
001d2df96c Log: Consistency of global variables ensured.
The value of global variables that can change copied before being
accessed to ensure that the used value is the same for the duration
of a function call. No locks are needed, because even if the copying
would not be atomic, it doesn't matter since all that matters is that
the used value does not change for the duration.
2015-11-11 15:05:42 +02:00
Johan Wikman
42cf1c58d6 No need to handle impossible things.
The string given to logmanager_write_log cannot be NULL.
The id given to logmanager_write_log cannot be invalid.
Consequently we need not handle those possibilities.
2015-11-11 14:42:43 +02:00
Johan Wikman
acb0a523a7 Log: No more argv parsing for log manager.
Earlier, the global setting for the syslog decided whether syslog
was enabled when skygw_logmanager_init was called, but not whether
logging to syslog actually was made.

Now syslog logging is enabled by default and the global setting
decides whether or not syslog logging actually is made. That is,
this opens up the possiblity for making it possible to turn on
and off sysloging at runtime.

Further, although the API led you to believe otherwise, it was
hardwired that LOGFILE_ERROR and LOGFILE_MESSAGE messages were
written to syslog.

The changed removed the need for passing an argv array explicitly.
2015-11-11 13:53:14 +02:00
Johan Wikman
0b7de96eff Log: Module variables collected into anonymous struct.
Modules variables collected into anonymous struct. Easier to
see whether something has module scope.
2015-11-11 13:51:20 +02:00
Johan Wikman
24bed47794 Syslog ident must be provided explicitly.
The syslog ident must be provided explicitly when calling
skygw_logmanager_init (and not provided via the argv array).
It can be NULL, in which case it automatically will be the program
name.

The openlog() call is now always made, irrespective of what the
value of the global syslog flag is. That way it will be possible
to turn syslog logging on or off after the fact.
2015-11-11 13:48:57 +02:00
Johan Wikman
55dbaa49c0 Logging target must be explicitly defined.
Whether the log-file should be written to the filesystem or to
shared memory must now be explicitly defined when calling
skygw_logmanager_init() (instead of passing that via the argc/argv
construct).

Also, the meaning of '-l' when invoking maxscale has been changed.

Earlier -l [file|shm] specified whether the trace and debug logs
should be written to shared memory (while the error and message
logs always were written to the filesystem) and the _default_
was to write them to shared memory.

Now, with only one file, '-l' has still the same meaning, but it
decides whether the one and only logfile should be written to shared
memory, or the filesystem and the _default_ is to write it to the
filesystem.
2015-11-11 13:47:34 +02:00
Johan Wikman
90a8646ac2 Whitespace and indentation changes.
Also changed line-endings from DOS CRLF to only LF.
In addition, made functions const correct.
2015-11-11 13:43:15 +02:00
Johan Wikman
14b8dbc4d8 Miniman changes to make testlog work.
testlog.c can never have worked, or then it cannot have been
kept up to date for a very long time.
2015-11-11 13:41:26 +02:00
counterpoint
2183d5d3c5 Fix mistakes in merging. 2015-11-11 11:31:07 +00:00
Johan Wikman
abea233a2e If log manager not inited messages are written to stdout.
If the log manager has not been inited, then messages are written
to stdout. In practice this can happen if something is directly or
indirectly logged during the startup of maxscale, before
skygw_logmanager_init() has been called. Some refactoring is needed
to allow skygw_logmanager_init() to be called very early at program
startup.
2015-11-11 13:30:12 +02:00
counterpoint
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
counterpoint
1fc6b00211 Add conditionally compiled mechanism to "show buffers" to give a list of the currently allocated buffers, with a trace for each one of the calls that led to its creation. 2015-11-11 09:03:48 +00:00