11245 Commits

Author SHA1 Message Date
Marko
7ea8ff9e59 MXS-1763 Move default location of maxadmin socket to /run/maxscale
MaxAdmin socket is now placed to piddir used by MaxScale.
2018-08-07 08:40:28 +03:00
Markus Mäkelä
56d4e5a645
Fix target dependencies
Added missing dependencies to targets that were missing it.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
a1d5a06ba7
Use only backend DCBs with session_unlink_backend_dcb
The client DCB isn't in the set of DCBs managed by the session.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
9d30c524e3
MXS-1929: Fix mock testing framework
The testing framework extended the public struct, not the private
one. Also moved the internal Session class inside the mxs namespace to
prevent conflicts with the mock testing Session class.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
6c6567cce7
MXS-1929: Add alter service filters MaxCtrl command
The command sets the active set of filters for a service. This allows
modifications to the filter list at runtime via MaxCtrl.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
03553783fb
MXS-1929: Process filter relationships for services
The filter relationships of a service are now interpreted as an ordered
list of filters being used by the service. As the relationship data in the
JSON API specification is represented as an array, it does not prevent
multiple relationships from appearing. For MaxScale, this means that
interpreting the filter's order does not break it.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
56ede5bbf4
MXS-1929: Remove string parsing from Service
As the filters are only passed as a pipe separated list when the
configuration is being processed, there's no need to have the interface
conform to that. Passing a list of filter names makes it more flexible and
will make it's use in the runtime configuration easier.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
3a185902b7
MXS-1929: Implement filter destruction
Now that the filters are fully reference counted, their destruction is
trivially simple to implement.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
8cb3a85afd
MXS-1929: Fix MaxCtrl errors
The filter parameters were a mandatory argument even for filters that
don't need parameters. Also fixed the usage information.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
0777de348b
MXS-1929: Fix handling of version_string
The parameter was set to 5.5.5- if it wasn't defined.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
356c607907
MXS-1929: Move global filter data into a struct
The global filter data is now stored in a single static struct.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
10b01a7e91
MXS-1929: Store global service data in a struct
The this_unit struct in service.cc contains all global data used by the
services.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
2e60d5fd71
MXS-1929: Store filters inside Session
The Session now holds a reference to the filters it uses. This makes the
use of filters safe even if they are destroyed mid-session.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
7e64d6b3df
MXS-1929: Move use of C++ inside the Session
The Session class now handles the work involved in dealing with the
private member variables.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
945510e735
MXS-1929: Add Session class
The Session class now contains all of the C++ objects that were previously
in the MXS_SESSION struct. It is also allocated with new but all
initialization is still done outside of the Session in session_alloc_body.

This commit will not compile as it is a part of a set of commits that make
parts of the session private.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
710f2d3c79
Unify unit test naming
The tests now all use snake_case naming.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
02b330e4fe
Explicitly include <vector> in cache filter
The filter relied on the session.h including.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
47176d9bf1
MXS-1929: Take local filter lists into use
The session creation function now uses the local filter list of the
worker. This also removes the need for the has_filters function.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
f59fda0d9f
MXS-1929: Move configuration dumping into Service
The service now generates the configuration file that represents the
serialized form of it. Also removed the unused service_serialize_servers
function.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
478d07efc0
MXS-1929: Cache filter lists in workers
The services will now store a local copy of the filter lists in the worker
local data associated with the service. This removes the instance level
lock and removes the performance penalty that was previously imposed by
it.

The only remaining performance "regression" compared to 2.2 is the extra
two atomic operations per filter that a session does when it is being
created. This is quite hard to get rid of without significant amounts code
and will hopefully be just a drop in the ocean.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
3038eb3326
MXS-1929: Move user reloading to Service
The Service class now handles the reloading of users. This removes the
need to expose the rate limits.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
373fb89dca
MXS-1929: Initialize service like a class
The most relevant string variables of a service are now duplicated as C++
strings. This should ease the eventual transition to a fully C++ internal
representation of the service. The array of refresh rates was also wrapped
inside a std::vector to remove the need to manually manage memory.

Separated the SERVICE_USER struct into its individual components as there
was no real need to have them inside a struct.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
b20decfe1c
MXS-1929: Output const strings from serviceGetUser
The values aren't meant to be modified by the caller.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
7d6338d65b
MXS-1929: Make filters configurable at runtime
The filters can now be altered at runtime. Currently, the filter usage
uses a service level lock. The next is to allocate a per-service key to
the worker local data and use that to orchestrate the storage of the
filter lists.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
1d92eabb91
Format and clean up service.cc
Formatted sources and removed unused or unnecessary variables.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
5d085f5cdf
MXS-1929: Remove service parameter setters
Removed the explicit setters for the service parameters. Not all of them
were implemented and they were only used internally. Moved the parameter
validation and update processing inside the Service class to reduce the
load on the other parts of the core.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
dc8414db9f
MXS-1929: Remove SPINLOCK from service
The service now has a private std::mutex that is used for
synchronization.

Renamed the vector of services to use snake_case.

Use lock guards with mutexes to make usage easier and safer. This makes
the code smaller as well as slightly easier to read.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
4d3dbb2040
MXS-1929: Take SFilterDef into use
The service now uses a std::vector<SFilterDef> to store the filters it
uses. Most internal parts deal with the SFilterDef but debugcmd.cc still
moves raw pointers around (needs to be changed).
2018-08-06 21:20:29 +03:00
Markus Mäkelä
00ab890b19
MXS-1929: Store filters in smart pointers
The FilterDef structs are now stored in a vector<std::shared_ptr>. This
should make it easier to use filters even if they are deleted before the
session using them closes.

All internal functions now take a smart point as a parameter. One
problematic case will be debugcmd.cc which moves information around as
pointers cast into unsigned longs.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
d793fcbcb0
Remove element from CONFIG_CONTEXT
The variable was set but never used.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
a252b45f18
Don't use auto&& in non-template code
Use explicit types instead.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
4c7a5017bc
MXS-1929: Create internal server representation
The server now has an internal C++ version that extends the public one.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
ea8b522c8a
MXS-1929: Combine service creation and configuration
The servers and filters are taken into use immediately after the service
is created. This removes the need for a second configuration step.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
c01840ffb3
Remove unnecessary SConfig from readwritesplit
The configuration doesn't need to be contained in shared pointer as each
session holds its own version of it. This removes most of the overhead in
configuration reloading. The only thing that's left is any overhead added
by the use of thread-local storage.
2018-08-06 21:20:29 +03:00
Markus Mäkelä
403b9e09f5
Remove old LICENSE file
The tests had it from the time before they were merged into MaxScale.
2018-08-06 21:19:49 +03:00
Markus Mäkelä
7425d80436
Increase query_retries for mxs1507_migrate_trx
The switchover sometimes fails due to a broken connection when the STOP
SLAVE on the new master is executed. Nothing is logged on the server in
question and the error message simply states that the connection was lost
in the middle of a query.

Increasing the query_retries to 1 reduced the likelihood of failure from
about 1/3 of tests failing to roughly 1/6 of tests failing. Increasing it
to 5 seems to remove it completely. As to what is the real reason this
happens, we do not yet know.
2018-08-06 21:19:48 +03:00
Markus Mäkelä
376cd3aa9e
Enable query_retries by default
Enabling it with a value of 1 should remove the vast majority of
connection related problems that appear in MaxScale. This should filter
out most of the errors caused by transient network problems.
2018-08-06 21:19:48 +03:00
Markus Mäkelä
0795d60007
Use MASTER_GTID_WAIT in binlog tests
This should help with the slave synchronization problem.
2018-08-06 21:19:48 +03:00
Esa Korhonen
0a81f78442 Use unique pointer instead of auto-pointer 2018-08-06 13:24:05 +03:00
Esa Korhonen
c0bd5ca3a1 MXS-1905 Switchover if master is low on disk space
Required quite a bit of refactoring.
2018-08-06 13:24:05 +03:00
Johan Wikman
84b3e4672f Merge branch '2.2' into develop 2018-08-06 13:08:55 +03:00
Johan Wikman
ec178fd8da MXS-1983 Add missing semicolon 2018-08-06 12:59:13 +03:00
Johan Wikman
6945e82b3f Merge branch '2.2' into develop 2018-08-06 12:31:58 +03:00
Johan Wikman
05129540b4 Update change log and release notes 2018-08-06 12:10:12 +03:00
Markus Mäkelä
5b04e492c6
MXS-1983: Retry message posting
If the posting of a message to a message queue fails due to the queue
being full, it is retried for a limited number of times. This is a
temporary fix to the problem that fixing MXS-1948 introduced. A proper
solution that leverages SO_REUSEPORT should be implemented in the next
major release.
2018-08-03 23:29:25 +03:00
Markus Mäkelä
6fc3fbd697
Fix debug assertion when a DCB is printed
All DCBs don't have the server pointer set so it needs to be checked
before calling any functions that take a server as a parameter.
2018-08-03 10:34:50 +03:00
Markus Mäkelä
d22b02047f
Disable parameters on main worker
Disabling the parameter on the main worker prevents deadlocks if the
parameter is disabled at the same time a monitor diagnostic is executed.
2018-08-03 10:34:47 +03:00
Johan Wikman
0d934476b0 MXS-1992 Provide std::default_delete<json_t> 2018-08-03 07:33:12 +03:00
Johan Wikman
166ecfead6 MXS-1992 MaxAdmin uses RoutingWorker for QC stats 2018-08-03 07:33:12 +03:00
Johan Wikman
b76cdc944b MXS-1992 RoutingWorker provides access to QC stats
This will be used in the context of MaxAdmin and MaxCtrl.
2018-08-03 07:33:12 +03:00