4707 Commits

Author SHA1 Message Date
Johan Wikman
5e5a522d27 Rename EMBEDDED_LIB to MYSQL_EMBEDDED_LIB
Makes it clearer what embedded lib we are talking about.
2016-01-29 16:32:01 +02:00
Johan Wikman
475dfb7288 Use common function for setting up MySQL connection.
Earlier the same (or almost the same) code was duplicated in
several places.

A conflicting declaration was also removed. There was no
implementation for that declaration.
2016-01-29 16:30:48 +02:00
Markus Makela
0902297fe5 Clear passwords provided via arguments
If a password is gived as an argument, that password is shown to other users.
Changed it so that the password is copied locally and the argument cleared.
2016-01-29 11:47:15 +02:00
Johan Wikman
d054f5d7bd Cleanup of dbusers.[h|c]
- All functions used only in c-file declared as static.
- All module functions declared.
- A few camelClase names changed to underscore.
2016-01-29 10:54:41 +02:00
Johan Wikman
5ed58df9f6 Make hashtable const correct.
Hashtable need not modify the filename when loading or saving
the hashtable; consequently the filename can be passed as const.
2016-01-29 10:53:01 +02:00
Markus Makela
59031adba6 MM monitor is built by default
Previously the mmmon module was not built unless -DBUILD_MMMON=Y was added to
the cmake command. The module is now a part of the default build.
2016-01-28 13:17:07 +02:00
Markus Makela
8fd515ec8b Fixed MM monitor build failure
The MM monitor was using wrong types of arguments to thread_start and
thread_wait.
2016-01-28 13:14:03 +02:00
Markus Makela
743a1b1037 Removed unnecessary calls to atomic_add
The polling statistics collection used atomic_add to increment values. This
is not an optimal way to update statistical values. Moved to per thread
values which are summed up when they are read.

Moved the functions used to gather polling statistics to their own file and
created a specific data type for statistics.
2016-01-28 09:55:26 +02:00
Johan Wikman
5e8ba4b519 Introduce MySQL-embedded based query classifier plugin.
Currently not used, but the existing query_classifier will be
changed into being just a wrapper around a dynamically loaded
query classifier plugin, i.e. qc_mysqlembedded.
2016-01-28 08:26:32 +02:00
Johan Wikman
d6840cd16a Add query classifier plugin interface.
Added a query classifier plugin interface using which plugins
export their functionality. Cleaned up header slightly as well.

This is the first step in the process of making the loading of
the query classifier truly dynamic.
2016-01-28 08:24:32 +02:00
Markus Makela
0111df3767 Cleaned up the use of thread types
The THREAD type was not used everywhere and pthread_t was used instead.
The thread creation function also returned the address of a stack allocated
value which isn't guaranteed to be usable.
2016-01-27 09:07:55 +02:00
Johan Wikman
da1a717dd8 Add extern "C" to modules.h. 2016-01-26 14:50:41 +02:00
Johan Wikman
9a8838474c Add query classifier plugin.
Basic infrastructure added for being able to load query classifier
plugins using the same mechanism other plugins are loaded with.
2016-01-26 10:40:43 +02:00
Johan Wikman
42b1722e49 Make query classifier self-contained.
Only the query classifier needs the functionality of the embedded
server, while the rest of MaxScale is content with the client
library or Connector/C.

This have now been rearranged so that query-classifier links with
the embedded static library and then explicitly exports its own
functions using the query_classifier.map linker script. That way
query classifier will use the embedded library, while the rest of
maxscale use the client library, and this without conflicts.

Currently, query_classifier is not linked to maxscale-common,
but executables must link to maxscale-common and query_classifier.
2016-01-25 21:43:49 +02:00
Johan Wikman
0b742977dd Add specific thread main function.
Earlier thread initialization was done in poll_waitevents(),
which was somewhat confusing, since the main thread also calls
into poll_waitevents().

Now there is a specific thread "main" function, which first
performs thread specific initialization and then calls into
poll_waitevents().
2016-01-25 20:41:30 +02:00
Johan Wikman
80cee351c4 Add platform.h
Platform.h is intended to contain definitions and workarounds
for concepts that depend upon the used compiler and/or platform.

Currently it ensures that /thread_local/ is available irrespective
of whether the source is compiled in pre- or post C11 or C++11 mode.

This file should be included first by all MaxScale headers.
2016-01-25 11:20:16 +02:00
Johan Wikman
1f241a5ed1 Rearrange libraries and build files.
This is the first change in an attempt to arrange the linking so that
more errors are detected at link-time.

- All files in server/core but for gateway.c are linked to one shared
  library called maxscale-common.
- The files log_manager/log_manager.cc and utils/skygw_utils.cc are
  built into maxscale-common as well.
- MaxScale itself consists now only of gateway.c and is linked with
  maxscale-common.
- All plugins link with maxscale-common.
- All executables link in addition with {EMBEDDED_LIB}.

After this change, the change (MXS-517) where query_classifier is the
only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can
be made much cleaner.

After a few additional steps, all shared libraries can be linked with
the linker flags "-Wl,-z,defs", which directs the linker to resolve
all symbols. That will require that all shared libraries list all the
libraries they need, but will at the same time ensure that any
missing symbols are detected at link-time and not at run-time.
2016-01-22 23:26:17 +02:00
Markus Makela
a61cedb1aa Fixed freeing of wrong pointer
The wrong pointer in server_free was used to clear the server parameters.
2016-01-22 18:55:54 +02:00
Markus Makela
5ac1ab412e Formatted utils library sources
Formatted all utils library sources according to the style guide.
2016-01-22 18:55:54 +02:00
Markus Makela
cceeb2d234 Formatted maxadmin.c
Formatted maxadmin.c according to the style guide.
2016-01-22 18:55:54 +02:00
Johan Wikman
608924beba Build pcre2 as PIC.
If pcre2 is to be included in a shared library, it needs to be PIC.
2016-01-22 15:09:50 +02:00
Johan Wikman
c8253cc767 Pass CMAKE_C_FLAGS to pcre2.
Now possible to affect CFLAGS of pcre2 build.
2016-01-22 15:08:02 +02:00
Markus Makela
872d02db3e Finalized configuration processing cleanup
All parts of the configuration processing are now in their own functions.
This allows new objects to be created after MaxScale has started.
2016-01-20 09:25:03 +02:00
Markus Makela
508c91be32 Cleaned up monitor configuration processing
Moved the monitor configuration processing into its own function and cleaned
it up.
2016-01-19 14:23:44 +02:00
Markus Makela
53ac88a1a1 Cleaned up the process of adding filters and servers to a service
Moved the adding of filters, servers and router options to its own function.
2016-01-19 14:23:44 +02:00
Markus Makela
0aaba891a3 Cleaned up server configuration processing
Moved the creation of new servers into a separate function and cleaned up
the configuration processing.
2016-01-19 14:23:44 +02:00
Markus Makela
c6dfcb66f5 Cleaned up service configuration processing
Moved the allocation and configuration of services into their own function.
Moved SSL parameter validation into a separate function.
2016-01-19 14:23:44 +02:00
Markus Makela
f12be9fea2 MXS-549: Change MaxScale's working directory on startup
MaxScale now changes the working directory to the log directory when it is
started. If this fails, the file system root is used instead.
2016-01-19 13:59:38 +02:00
Markus Makela
c2310327fc Fixed idle session processing
The current implementation of idle connection timeouts is not safe. The sessions
are handled in a way which is not thread-safe and the checking is done from
a non-polling thread.

With this change, the checks for the session timeouts are done in one of the
polling threads in a thread-safe manner only if at least one service has enabled
the timing out of idle client connections.
2016-01-19 10:53:55 +02:00
Markus Makela
cdeb921b1b Added missing freeing of monitor resources
Monitor servers were not freed.
2016-01-15 21:38:40 +02:00
Markus Makela
d41fe5b9c7 Added extra checks to readwritesplit
Added a check that the master server reference is actually in use before
doing anything with it. Also removed a false assertion.
2016-01-15 16:25:05 +02:00
Markus Makela
c5947285cf Added missing freeing of filter resources
Filters were not freeing their options or parameters.
2016-01-15 16:24:32 +02:00
Markus Makela
1656840417 Added missing freeing of service resources
The service resources weren't freed when the service is freed.
2016-01-15 16:23:41 +02:00
Markus Makela
a2bc15c870 Removed obsolete functions from dbfwfilter
The filter defined its own hashing and string comparison functions even though
there are common functions for both.
2016-01-15 16:22:18 +02:00
Markus Makela
47f6c6613e Added missing freeing of server resources
The server did not release the parameters or the slave ID list.
2016-01-15 12:42:12 +02:00
counterpoint
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
Johan Wikman
d13bec0647 Reformat testprotocol.c 2016-01-12 15:52:29 +02:00
Johan Wikman
183202466d Reformat telnetd.c 2016-01-12 15:49:09 +02:00
Johan Wikman
fd9698e705 Reformat mysql_common.c 2016-01-12 15:43:33 +02:00
Johan Wikman
da29ee0f4a Reformat mysql_client.c 2016-01-12 15:21:33 +02:00
Johan Wikman
244d7ee86c Reformat mysql_backend.c 2016-01-12 14:57:26 +02:00
Johan Wikman
1b94c5b519 Reformat mascaled.c 2016-01-12 14:20:11 +02:00
Johan Wikman
018b87d304 Reformat httpd.c 2016-01-12 14:14:40 +02:00
Johan Wikman
040c67127a Reindent schemarouter.c
- Untabify
- 4 space indent
- Allman + other style issues.
2016-01-12 13:54:23 +02:00
Markus Makela
0a3e6b4352 MXS-498: Username and source address added to QLA filter output
The filter now logs the username and remote address of each client. This will
make tracking of users and their queries a lot easier.
2016-01-12 09:30:03 +02:00
Markus Makela
985543dbb2 Fixed merge conflict
One function in the query classifier used the old name which led to undefined
symbols.
2016-01-12 09:19:46 +02:00
Markus Makela
54ca1ab2de Canonicalized queries remove non-executable comments
The comments which do not alter the functionality of a query are now removed
from canonicalized queries.

Also fixed missing semicolon in the comment removal regex and added tests
for comment removal.
2016-01-11 17:14:57 +02:00
Markus Makela
8ee110efa8 Fixed canonicalization and added more tests
Fixed mistakes in the canonicalization regular expressions and altered the
functions to use a source and destination buffers. This reduces the amount
of memory allocations that take place.

Added more canonical query tests to the internal test suite.
2016-01-11 17:14:44 +02:00
Markus Makela
e0c84e0fe3 Added removal of MySQL style comments to query canonicalization.
Also fixed minor issues with the canonicalization regular expressions.
2016-01-11 17:13:14 +02:00
Markus Makela
c067bbe34a Formatted the canonical query test.
The file is now formatted according to the style guide.
2016-01-11 17:13:01 +02:00