4236 Commits

Author SHA1 Message Date
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
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
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
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
Johan Wikman
49866b5959 ss_info_dassert now enabled also in release mode. 2015-11-10 21:19:50 +02:00
Johan Wikman
43c7ccdd08 Whitespace and indentation changes.
Whitespace and indentation changes of log manager test programs.
2015-11-09 10:40:13 +02:00
Johan Wikman
450078fa92 Interface of skygw_logmanager_init(int argc, char* argv[]) changed.
The previous interface of skygw_logmanager_init was conceptually
broken. With -o you could specify that logging should be done to
stdout. However, even if you did that, the log manager still checked
that the logging directory could be accessed. Unless it had been
specified using -j <path> the default was /var/log/maxscale.

That is, unless the program calling skygw_logmanager_init was invoked
by a user that had write access to /var/log/maxscale, there would be
a complaint even if nothing was ever written to that directory.
In practice this meant that even if -o was used you had to provide
a -j with a path that surely is writeable (e.g. "/tmp").

This has now been changed so that you explicitly must provide the
log directory and the flags -j and -o are removed.

  bool skygw_logmanager_init(const char* logdir, int argc, char* argv[]);

If /logdir/ is provided then logged messages are written to a log file
in that directory. If /logdir/ is NULL then messages are logged to stdout
and no checks for access to any directory is not made.
2015-11-06 14:20:05 +02:00
Johan Wikman
b19a4b9f4a Commands for enabling the log priority added to maxadmin.
Enabling log files is accepted but deprecated.
2015-11-06 10:06:54 +02:00
Johan Wikman
80344babd7 Log manager additions.
Changes related to the replacement of the notion of logfiles
with the notion of syslog priorities.
2015-11-06 10:06:54 +02:00
Johan Wikman
33294e4c95 Whitespace and indentation changes.
- Tabs replaced with spaces.
- Indentation level 4 spaces.
- Allman braces (except for part of commands)
- Space after ,
- Spaces around binary operators.

No other changes.
2015-11-06 10:06:35 +02:00
Markus Makela
548d03005b Added test for maxscale_pcre2.c 2015-11-05 10:19:24 +02:00
Markus Makela
603e737769 Cleaned up testbuffer.c and added a test for gwbuf_clone_all 2015-11-05 09:36:09 +02:00
MassimilianoPinto
c37b33c60e Merge branch '1.2.1-binlog_router_trx' into develop 2015-11-04 16:42:30 +01:00
MassimilianoPinto
685e674009 Log message update
Log message update
2015-11-04 16:41:27 +01:00
MassimilianoPinto
d51ac7ab7d Disconnect slave when pos is UNSAFE
Disconnect slave when pos is UNSAFE instead of sending an error that
stops the replication
2015-11-04 16:24:46 +01:00
Johan Wikman
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
Markus Makela
0accf869de Fix to MXS-365: https://mariadb.atlassian.net/browse/MXS-365 Added tracking of LOAD DATA LOCAL INFILE
While a LOAD DATA LOCAL INFILE query is being executed, all queries will be sent to the master
and they will not be processed as normal packets.
2015-11-04 12:47:55 +02:00
Johan Wikman
126b4c1d79 Whitespace-fixes of maxkeys and maxpasswd.
Whitespace and indentation fixes of maxkeys.c and maxpasswd.c.
No other changes.
2015-11-04 12:30:06 +02:00
Johan Wikman
e9ff89629b More obsolete functionality removed.
The log manager possibility for explicitly specifying the names
of the log files has never been used. In the name of simplicity
that functionality is removed.
2015-11-04 11:00:38 +02:00
Johan Wikman
865162dc54 Removed getopt options. 2015-11-04 10:29:42 +02:00
Johan Wikman
d7af979ad9 Removed obsolete functionality.
No need for debug, trace or messages prefixes or suffixes.
2015-11-04 10:29:42 +02:00
Markus Makela
d57b4cd531 Fix to MXS-54: https://mariadb.atlassian.net/browse/MXS-54
Added a new configuration parameter that allows the user to control
whether authentication warning messages are logged.
2015-11-04 09:18:20 +02:00
Markus Makela
d6230e68ef Moved warnings about session command history limits to message log. 2015-11-04 09:12:37 +02:00
Johan Wikman
f17803e892 Only one log_file.
The array of log_files replaced with single instance.
2015-11-03 23:27:51 +02:00
Johan Wikman
633f06cddd The notion of a particular file being enabled is removed.
The one and only message file is always enabled.
2015-11-03 22:52:20 +02:00
Johan Wikman
3348fab3c4 Only error log is created.
Only the error log is created anymore. The data structures for
the other files still exist, but they are to be removed next.
2015-11-03 22:34:03 +02:00
Johan Wikman
8798475a46 Some re-arranging of functionality.
Some thread specific functionality moved from thr_flush_file
to the caller thr_filewriter_fun.
2015-11-03 21:50:34 +02:00