584 Commits

Author SHA1 Message Date
Markus Mäkelä
0b6b9c3d81 Format core source code and headers
Formatted core source code and headers with Astyle.
2017-01-17 14:47:50 +02:00
Markus Mäkelä
c59711d04c Add test for new module command options
The tests test the matching of domain names to module names.
2017-01-17 10:47:44 +02:00
Markus Mäkelä
7e65e1ae27 Fix internal test suite
The tests were broken by changes to the core.
2017-01-17 10:47:43 +02:00
Johan Wikman
265e5c0593 Rename FILTER_DEF to MXS_FILTER_DEF
Provide functions that allows the actual definition of MXS_FILTER_DEF
to be made private.
2017-01-13 14:30:11 +02:00
Johan Wikman
356690c0e5 Filter.h split into public and private parts
- include/maxscale/filter.h
- server/core/maxscale/filter.h
2017-01-13 12:57:40 +02:00
Markus Mäkelä
a1293fbd79 Add unique constraint to enumeration parameters
Enum parameters can now be declared unique. This prevents multiple values
for enumerations which only accept one value.
2017-01-10 16:52:29 +02:00
Markus Mäkelä
180ed1616a Add configuration test
The test validates, parses and creates configuration parameters for
modules.
2017-01-09 14:17:33 +02:00
Johan Wikman
c3ddc3ac22 Cleanup server.h
- All (but the printing/debug functions) are now in snake_case.
- Functions made const correct.
- All function prototypes now have named arguments.

Documentation still to be moved, and file possibly split into
include/mascale/server.h and server/core/maxscale/server.h
2017-01-09 12:14:46 +02:00
Markus Mäkelä
c96bd64aa8 Rename MODULE_INFO to MXS_MODULE
The MODULE_INFO is now the main object which is used by modules to convey
information to the MaxScale core. The MXS_MODULE name is more apt as it
now contains the actual module definition.

The old MODULES structure was moved into load_utils.c as an internal
implementation and was renamed so that it is not confused with the new
MODULE structure.
2017-01-03 18:01:14 +02:00
Johan Wikman
b62db91ab3 Add gwbuf_compare
With gwbuf_compare the content of two GWBUFs can be compared.
2016-12-19 14:55:44 +02:00
Johan Wikman
f929932fc0 Move docs from buffer.c to buffer.h
- Move docs from buffer.c to buffer.h
- Arguments made const-correct.
      gwbuf_length
      gwbuf_count
      gwbuf_copy_data
- Boolean return values changes from int to bool.
      gwbuf_add_property
- Meaningless returnvalue changed from int to void.
      gwbuf_add_hint
- Unused function removed.
      gwbuf_clone_transform
      gwbuf_trim
2016-12-19 11:42:02 +02:00
Johan Wikman
6e6a3e4626 Replace gwbuf_clone_all with gwbuf_clone
gwbuf_clone cloned only the first buffer of a chain of buffers,
which never can be the desired outcome, while gwbuf_clone_all
cloned all buffers.

Now, gwbuf_clone behaves the way gwbuf_clone_all used to behave
and gwbuf_clone_all has been removed.
2016-12-19 11:00:47 +02:00
ekorh475
259e944b3d Server status changes now happen under a lock
MXS-873 To prevent monitors and MaxAdmin from interfering with each other,
changes to the server status flags now happen under a lock. To avoid
interfering with monitor logic, the monitors now acquire locks to all
of their servers at the start of the monitor loop and release them
before sleeping.
2016-12-12 15:04:05 +02:00
Markus Makela
49aa23468d Align statistics to cache lines
Aligning the statistics object indices to cache line size reduces the CPU
overhead of gathering the statistics. This allows the statistics to more
accurately measure the polling system without the measurement affecting
the outcome.
2016-12-12 10:48:49 +02:00
Markus Makela
9df3f154cf Detect duplicate objects
Creating a monitor or a listener twice is now detected and the proper
error is printed.
2016-12-03 11:31:18 +02:00
Markus Makela
adbd666991 Change module command parameter types
This commit introduces safe session references that can be handled without
holding locks. This allows the safe searching of sessions with the unique
ID of the session.

Remove the use of raw pointers passed as strings. Change the comments of
the argument types and add more details to the parsing function
documentation.
2016-12-02 14:26:56 +02:00
Johan Wikman
a6df875495 Make filter const correct and use snake case
CamelCase is still in use with the printing functions.
2016-12-01 15:20:34 +02:00
Markus Makela
076b810c1e Create thread specific zombie queues
Because each thread has their own epoll file descriptor and only one
thread can process a DCB, it makes sense to move to a per thread zombie
queue. This removes one of the last restrictions on scalability.
2016-11-30 10:28:22 +02:00
Markus Makela
3ba8525063 Remove old .gitignore files
The files were used to deal with old Makefile builds.
2016-11-28 14:37:26 +02:00
Markus Makela
691989ff04 Split the service header into internal and external parts
The service header in include/maxscale/ contains the public part of the
service API. These functions can be safely used by the modules.

The internal header located in service/core/maxscale/ is used by the core
to initialize MaxScale at startup or to provide other services in a more
controlled way (the config_runtime, for example).
2016-11-28 14:37:26 +02:00
Markus Makela
e31afa28e4 Serialize created listeners to disk
The created listeners are now stored to disk like created servers
are. This allows them to be used even after a restart.

Currently, the listeners cannot be deleted and need to be manually
removed.
2016-11-24 15:22:55 +02:00
Markus Makela
dd63253261 Fix internal test suite failures
The server test used the wrong name.

MySQL users test loaded multiple modules in one function call and wasn't
appropriate for an internal test suite test as it requires a working
installation.

The cache filter didn't set the library paths before trying to load
modules.

The binlogrouter was missing a NULL check which caused a crash.
2016-11-24 15:22:55 +02:00
Johan Wikman
265aacaf15 GWBUF_DATA(...) explicitly returns uint8_t* 2016-11-24 13:31:29 +02:00
Markus Makela
3b5b616edf MXS-929: Add descriptions to module command arguments
Each argument now has a description describing what it does and what it's
used for.
2016-11-22 10:46:34 +02:00
Markus Makela
4137d58dd5 MXS-929: Implement DCB and SESSION pointer handling
DCBs and SESSIONs can be passed either as raw pointers or as the string
representations of them.

The preferred way to pass them is to use the raw pointer types. This
removes the need to convert the pointer to string form and back.
2016-11-22 10:46:34 +02:00
Markus Makela
d68172260d MXS-929: Add mapping function for module commands
The modulecmd_foreach function allows commands to be iterated without having
to manage the locking of the system. This allows the commands to be easily
iterated and gathered into filtered lists without having to build it into
the module command system itself.
2016-11-22 10:46:34 +02:00
Markus Makela
4a142b1ca9 MXS-929: Add errors to the modulecmd system
The modules can now return human-readable error messages to the caller of
the function. The internals of the modulecmd system also use this to
return errors to the users.

The error messages can be retrieved with a common error function which
should make it easy to use in various clients.
2016-11-22 10:46:34 +02:00
Markus Makela
4603e71987 MXS-929: Add domain function registration
A module can register a function to a domain. These function can then be
called by external actors enabling the modules to expand their
functionality beyond the module API. Each module should use its own domain
e.g the library name.

Currently, the functions do not return results. The possible next step
would be to alter the function entry point to return a result set of
sorts. This would allow the modules to convey structured information to
the client information which would handle the formatting of the result.

Although this sounds good, it is not required for the implementation of
MXS-929.
2016-11-22 10:46:34 +02:00
Markus Makela
08ebb88aec Make server creation simpler
Server creation and allocation are now the same apart from the fact that
allocation only adds the server to the running configuration where as the
creation of a server also persist it to disk.

The server serialization should not be seen through the server.h API. This
allows the serialization method to change without actually having to
change the interfaces.
2016-11-11 10:54:34 +02:00
Markus Makela
c9218351b8 MXS-922: Serialize created servers
When a server is created via MaxAdmin, it will be serialized to disk. This
allows created servers to be retained through a restart of MaxScale.

Currently, all serialized objects are stored in one folder and there is no
structure in the created files. In the future, servers could be created
under a `servers` subdirectory so that it is easier to see what was
added. Whether there is a need for this will be seen.
2016-11-10 15:15:10 +02:00
Markus Makela
28fc3d2b83 MXS-922: Add server serialization function
The function serializes a server to a file. This is intended to be used
with dynamically created servers. The output of the server serialization
will eventually be stored in the configuration file directory (default is
/etc/maxscale.cnf.d/) so that created servers persist even after a
restart.
2016-11-10 15:15:10 +02:00
Johan Wikman
8778e0c81e Make Users const correct 2016-11-03 09:35:49 +02:00
Markus Makela
d961864635 Fix tests and limit internal test set size
Some of the tests depended on a working installation where modules are all
located at the default paths. These tests now explicitly set the module
directory which fixes the immediate problem.

Disabled the starting of services in the service test as this will fail
with real modules. The dummy internal modules aren't build and should be
removed in a later commit. In general, it might be better to do service
level testing outside the internal test suite.
2016-10-24 13:16:59 +03:00
Markus Makela
4e07c3313c Move dbusers.c out of the core
The dbusers.c was a MySQL protocol specific file which was used directly
by some of the modules.

Added a new return value for the loadusers authenticator entry point which
allows fatal failures to occur when users are loaded. Currently this is
only taken into notice when the service is first started. If a listener
later returns a fatal error, it is only logged but the service stays in
operation.

Moved the MySQLAuth authenticator sources and the tests that relate to
this module into a subdirectory in the authenticator
directory. Eventually, all authenticators could have a subdirectory of
their own.
2016-10-21 18:33:35 +03:00
Markus Makela
623acfe1b5 Build MaxScale in debug mode for Travis
The internal test set depends on SS_DEBUG being defined and it is only
defined for debug builds.
2016-10-18 21:58:59 +03:00
Johan Wikman
1333da0712 Remove skygw_utils.h
The general purpose stuff in skygw_utils.h was moved to utils.h
and the corresponding implementation from skygw_utils.cc to utils.c.
Includes updated accordingly.

Skygw_utils.h is now only used by log_manager and by mlist, which
is only used by log_manager. Consequently, skygw_utils.h was moved
to server/maxscale.

Utils.h needs a separate overhaul.
2016-10-14 19:50:54 +03:00
Johan Wikman
03dbc6df80 Remove dependency on skygw_utils.h
- STRERROR_BUFLEN moved to cdefs.h and renamed to MXS_STRERROR_BUFLEN.
  Better would be to provide a 'const char* mxs_strerror(int errno)'
  that would have a thread specific buffer for the error message.
- MIN and MAX also moved to defs.h as MXS_MIN and MXS_MAX.
- Now only mlist.h of the headers depend upon skygw_utils.h.
2016-10-14 15:42:02 +03:00
Johan Wikman
0800bf4a59 Rename skygw_debug.h to debug.h
Also remove unneded includes in debug.h
2016-10-14 13:48:10 +03:00
Johan Wikman
1a978be6b6 Cleanup header files
- All now include maxscale/cdefs.h as the very first file.
- MXS_[BEGIN|END]_DECLS added to all C-headers.
  Strictly speaking not necessary for private headers, but
  does not hurt either.
- Include guards moved to the very top of the file.
- #pragma once added.
2016-10-14 11:54:37 +03:00
Johan Wikman
2fe58ebe5b Move test_utils.h to server/core/test 2016-10-13 22:59:39 +03:00
Johan Wikman
d04cb54b9f maxscale/maxscale_pcre2.h renamed to maxscale/pcre2.h 2016-10-13 22:59:39 +03:00
Johan Wikman
3a18b64bdd mysql_client_server_protocol.h moved.
Moved to include/maxscale/protocol/mysql.h
2016-10-13 22:59:39 +03:00
Johan Wikman
e41589be10 Move headers from server/include to include/maxscale
- Headers now to be included as <maxscale/xyz.h>
- First step, no cleanup of headers has been made. Only moving
  from one place to another + necessary modifications.
2016-10-13 16:19:20 +03:00
Markus Makela
9d8c5cd410 MXS-862: Add authenticator options and instances
Authenticators now have a similar mechanism to the `router_options`
parameter which enables configurable authentication.

The authenticators also have a new initialize entry point which is similar
to the createInstance entry point of the filters and routers. The value of
`authenticator_options` is passed as a parameter to this function. The
return vaulue of the `initialize` entry point is passed to the `create`
entry point.
2016-10-13 15:58:18 +03:00
Markus Makela
cb7c112764 MXS-862: Create common MySQL library
The MySQLCommon library contains functions used by both the protocol and
authenticator modules. The contents of the modutil.c file could also be
moved to this file if the functions in that file are only used by modules
and not the core.
2016-10-13 15:51:52 +03:00
Markus Makela
cc01ce5c16 Remove obsolete parts from testlog.c
The code used the log manager in the wrong way which caused the test to
hang from time to time.
2016-10-03 15:40:49 +03:00
Markus Makela
ca9021b835 Merge branch '2.0' into develop 2016-09-21 02:51:27 +03:00
Markus Makela
92ef33327e MXS-870: Handle non-contiguous session command responses
Session command responses with multiple packets could be spread across
multiple, non-contiguous buffers. If a buffer contained a complete packet
and some extra data but it wasn't contiguous, the debug assertion in
gwbuf_clone_portion would fail. With release builds, it would cause
eventual out-of-bounds memory access when the response would be sent to
the client.
2016-09-19 09:58:20 +03:00
Markus Makela
da9c7db231 Fix Travis builds
The travis builds failed due to outdated build scripts. The queuemanager
also failed to build on non-Debug builds.
2016-09-15 07:13:10 +03:00
Johan Wikman
d7f79942be Merge branch '2.0' into develop 2016-09-09 15:12:58 +03:00