316 Commits

Author SHA1 Message Date
Markus Makela
aff3f66fa6 Fixed compilation error for slavelag.c
There was an extra parenthesis left when skygw_log_write was changed to
MXS_ERROR which caused the compilation to fail.
2015-12-23 06:45:28 +02:00
Markus Makela
992d6fb3bc Fix to MXS-501: Tee filter and USE ... no longer hangs
Some of the data was not reset for the branch session when a query
was not duplicated which could lead to a hang. Also the COM_FIELD_LIST
duplicated to the branch session even though it doesn't change the
session state.
2015-12-10 09:56:06 +02:00
Johan Wikman
5ebdd6f47d Fix signed/unsigned problem in tee.c 2015-12-10 08:41:20 +02:00
Markus Makela
a663a8ec5c Fix to MXS-500: Statement cloning is now properly handled
If a statement wasn't cloned for the Tee filter, the session would be closed
leading to a possible hang. Instead of closing the session when a statement
isn't cloned, it should not expect a response from that server for that statement.
2015-12-09 13:48:20 +02:00
Markus Makela
a829b38873 Fix to MXS-363: Added soname versions to libraries
The soname version numbers were missing from all the library targets
properties which caused ldconfig to warn about non-symlink libraries
being installed.
2015-11-30 10:46:08 +02:00
Markus Makela
f441f72b75 Added support for librabbitmq-c 0.6.0 and newer
The 0.6.0 version of librabbitmq-c added two parameters to amqp_exchange_declare
which allow auto-deleted and internal exchanges. This change requires more
advanced version detection so that code could be conditionally compiled for
newer versions of the library.
2015-11-27 12:21:19 +02:00
Johan Wikman
916ee5ff2a Rename some log concepts
The mxs prefix is now uniformly used with all log components.
2015-11-26 17:34:53 +02:00
Markus Makela
63da12e5b5 Corrected bugs introduced by refactoring of the dbfwfilter
The limit_queries parsing used a bad initial value for the return value
which lead to a guaranteed failure. Other parts of the code used wrong values
for comparisons leading to sporadic parsing errors.
2015-11-26 09:59:39 +02:00
Markus Makela
443bbe73d2 Mqfilter is built if possible
The mqfilter was not built by default even though it should have been. This has
been fixed but the filter is built only if librabbitmq is found. This was done
to avoid having the librabbitmq and its development headers as a hard
dependency.
2015-11-26 09:28:27 +02:00
Markus Makela
b0458b3cc4 Fixed wrong value being used for users rules in dbfwfilter
A parsed, local copy of the string was duplicated instead of the original string
which caused the parsing to always fail.
2015-11-25 17:39:18 +02:00
Markus Makela
038877b8db Fixed minor format errors and resource leaks
Some format strings used integer values for unsigned integers.
Memory and file descriptors leaked in some error conditions.
2015-11-25 12:43:49 +02:00
Markus Makela
59b0555090 Made function parameters const where possible.
Some of the functions for dbfwfilter were taking char* arguments where
const char* was more appropriate.
2015-11-24 13:54:50 +02:00
Markus Makela
cbc1872b2b Refactoring of dbfwfilter limit_queries parsing
Moved parsing of limit_queries into a separate function.
2015-11-24 13:54:50 +02:00
Markus Makela
76dc63efa2 Moved rule definition parsing to its own function
A large part of parse_query was parsing of the actual rule definitions. This made
the function very large and hard to understand. For this reason the definition parsing
was moved to its own function.
2015-11-24 13:54:50 +02:00
Markus Makela
62ca9ab8ec Moved parsing of at_times rules to a separate function
This was done in order to make the parse_rule function smaller and easier to
comprehend.
2015-11-24 13:54:28 +02:00
Johan Wikman
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
Markus Makela
84d2c72db2 Formatted mqfilter
Mqfilter formatted according to the style guide.
2015-11-19 12:16:47 +02:00
Markus Makela
cbeead7c43 Formatted namedserverfilter
Namedserverfilter formatted according to the style guide.
2015-11-18 14:44:05 +02:00
Markus Makela
036fd6f16c Formatted qlafilter
Qlafilter formatted according to the style guide.
2015-11-18 14:31:02 +02:00
Markus Makela
a7c0952e66 Formatted tee filter
Tee filter formatted according to the style guide.
2015-11-18 14:18:00 +02:00
Markus Makela
e24504c427 Formatted topfilter
Topfilter is now formatted according to the style guide.
2015-11-18 13:46:23 +02:00
Markus Makela
7d9324ee12 Formatted regexfilter
Formatted regexfilter according to the style guide and removed trailing whitespace.
2015-11-18 13:35:04 +02:00
Markus Makela
da74bb7c3f Formatted dbfwfilter according to the style guide
Fixed indentation, bracket alignment and other minor things.
2015-11-18 10:12:04 +02:00
Johan Wikman
1bfe85099f server/module/filters: All LOGIF and skygw_log_write calls removed.
All LOGIF and skygw_log_write calls have been replaced with the
equivalent MXS_[ERROR|WARNING|NOTICE|INFO|DEBUG] calls.
2015-11-16 14:25:02 +02:00
Markus Makela
b22d40b06b Fixed PCRE2 beng built when CMake is configured
The bundled PCRE2 library will be built as a separate target and configuring
CMake no longer builds it. Instead, it will only be built when it is out of date.
This requires all targets to declare that they depend on the pcre2 target in
order for it to be built.
2015-11-16 13:59:47 +02:00
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
Markus Makela
6b88b6b17f Merge branch 'develop' into MXS-329-develop-20151111 2015-11-13 07:48:59 +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
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
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
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
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
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
846816a851 Changed from POSIX regular expressions to PCRE2 for the regexfilter. 2015-10-27 22:10:49 +02:00
Markus Makela
4f316419c5 Merge branch 'develop' into MXS-329 2015-09-30 12:47:28 +03:00
Markus Makela
447c3aa6c1 More code cleaning. 2015-09-29 12:03:21 +03:00
Markus Makela
abab715a21 Simplified the code in parse_time. 2015-09-29 12:03:21 +03:00
Markus Makela
f021d42820 Cleaned up the timerange string processing in dbfwfilter. 2015-09-29 12:03:21 +03:00
counterpoint
cfeaf7d6e9 Merge remote-tracking branch 'origin/develop' into MXS-329
Conflicts:
	server/core/session.c
2015-09-10 13:07:27 +01:00
Johan Wikman
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
Markus Makela
f1c3b65b15 Fixed mistake. 2015-08-28 19:52:02 +03:00
Markus Makela
d29c5909a6 Properly close the branch session of the tee filter. 2015-08-28 19:50:29 +03:00
Markus Makela
a74ed87d07 Removed redundant linking of the utils library. 2015-08-10 10:40:00 +03:00
Markus Makela
84db14d3da Fixed possible division by zero error. 2015-07-24 17:19:57 +03:00
Markus Makela
78eab19c62 Fixed compiler warnings. 2015-07-14 17:13:09 +03:00
Markus Makela
af6e010ba1 Added missing namedserverfilter documentation. 2015-07-10 13:51:32 +03:00
Markus Makela
3d3b397a67 Merge branch 'develop' of https://github.com/srirampatil/MaxScale into srirampatil-develop
Conflicts:
	server/modules/filter/qlafilter.c
2015-06-11 18:41:56 +03:00
Markus Makela
4cbcc4ecb6 Removed old unused cmake variables, updated documentation and fixed testall suite. 2015-05-26 15:12:29 +03:00