14 Commits

Author SHA1 Message Date
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ä
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ä
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ä
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ä
be6a404c0b
Fix crash on failure to create service
The service would not be in the list if it failed before it was placed
there. Moving the actual freeing of memory into the Service destructor
allows it to be called directly when we know the service is not in the
list. This also only allows valid services to be placed into the global
list of services.

To prevent freeing a partially constructed service, the memory allocation
checks were replaced with a runtime assertion. This can be changed when
the creation of the service is done only at a point where we know it can't
fail. Currently, the createInstance call expects the service as a
parameter which prevents this.
2018-08-02 18:56:36 +03:00
Markus Mäkelä
ec420332ea
MXS-1929: Take ResultSet into use
Replaced the previous RESULTSET with the new implementation. As the new
ResultSet doesn't have a JSON streaming capability, the MaxInfo JSON
interface has been removed. This should not be a big problem as the REST
API offers the same information in a more secure and structured way.
2018-07-31 22:50:08 +03:00
Markus Mäkelä
8ababa1d39
MXS-1929: Make core ResultSet functions private
The functions in the core that generate a ResultSet are now private.
2018-07-31 22:32:32 +03:00
Markus Mäkelä
b0e74ac4ae
MXS-1929: Move internal functions to internal header
Converted the internal service header to a C++ header and moved all
functions there that are for internal use only.

Added the new Service type that inherits the SERVICE struct. This is to
distinct the opaque external C interface from the C++ internals.
2018-07-31 09:41:13 +03:00