3420 Commits

Author SHA1 Message Date
Markus Mäkelä
fe124b79cc
MXS-1929: Fix state of services created at runtime
If a service was created at runtime, it would be in the Allocated state
until it was stopped. The serviceStart function isn't necessary from a
functional point of view (a new service cannot have listeners that need
starting) but it does set the correct state and it's the "right" thing to
do.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
065ee50d53
MXS-1929: Start monitors after creation
Monitors created via the REST API that were started and configured
successfully should also be started. This removes the extra step of
starting the monitor after creating it.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
a6bef0a80d
Add credentials for remove REST API calls
The base URL and credentials used for REST API calls can now be defined in
the [maxscale] section. This allows encrypted passwords to be used.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
fe7d7475a4
Improve PID file check
The executable name of the PID is now checked to be maxscale. This fixes
the problem where MaxScale would refuse to start if a stale PID file had a
PID of a process that's not a MaxScale process.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
ad36a50e97
Remove log initialization form print_log_n_stderr
The log manager must not be initialized twice. If an error is to be logged
to a file, the log manager has already been initialized.
2018-08-23 15:46:46 +03:00
Markus Mäkelä
1692765503
Enable query classifier cache by default
Enabling it will give a performance improvement and it offloads work from
the CPU. This leads to better and more complete utilization of system
resources.
2018-08-23 15:46:45 +03:00
Markus Mäkelä
13c04324cf
Add master extraction via REST API
The master server of a monitor can now be extracted with the
mon_get_external_master function. It uses the REST API to find a master
server in the set of servers monitored by a monitor.
2018-08-23 15:46:45 +03:00
Markus Mäkelä
934600f8fc
Add minimal HTTP GET test
The test does a request and prints the responses. It is done to see that
the functionality works. Also added a timeout of 10 seconds to both the
connection and data transfer phases.
2018-08-23 15:46:45 +03:00
Markus Mäkelä
f8fb9510c9
Add HTTP GET function
The function performs a HTTP GET on a URL and returns the HTTP response.
2018-08-23 15:46:45 +03:00
Johan Wikman
75c298f63c MXS-2011 Make listener_set_ssl_version() const correct 2018-08-23 09:24:46 +03:00
Marko
8e7b012852 Don't call some of atexit functions twice
Registering of atexit functions was fixed so these functions don't need
to be called here anymore.
2018-08-22 22:51:32 +03:00
Markus Mäkelä
5485f83e75
MXS-1929: Always store the module name parameter
Services, monitors and filters all use the parameters for object
serialization. This means that when the object is created, the module
parameter must be in the parameter list.
2018-08-22 16:43:17 +03:00
Markus Mäkelä
276ff70506
MXS-1929: Prevent alterations to filters and servers
These parameters must not be altered at runtime via the `alter service` or
`alter monitor` commands.
2018-08-22 16:43:17 +03:00
Johan Wikman
ab9a9f92cb MXS-2020 Remove maxscale/debug.h
- Removed from all files.
- maxbase/assert.h included where necessary.
2018-08-22 11:35:35 +03:00
Johan Wikman
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
Johan Wikman
b1e405442f MXS-2020 Replace ss_debug with MXB_AT_DEBUG 2018-08-22 11:34:06 +03:00
Johan Wikman
88c3cd567d Remove HASHTABLE
Not used anyware, should have been removed ages ago.
2018-08-22 10:48:12 +03:00
Niclas Antti
24ab3c099c Move top of the file "#pragma once" to after the following comment (swap them). If the comment is a BPL update it to the latest one 2018-08-21 13:13:15 +03:00
Esa Korhonen
03cefcc4ac MXS-2012 Write replication lag to SERVER
Allows routers to read the value.
2018-08-21 11:51:10 +03:00
Esa Korhonen
0d762b2019 MXS-2012 Remove old replication lag detection
The method was quite disruptive as it continuosly wrote to the database.
Also removed the MaxScale ID global, as it wasn't used for anything else.
2018-08-21 11:51:10 +03:00
Johan Wikman
3576780f78 MXS-2008 Update gateway and tests to initialize maxbase
Update gateway and tests to initialize maxbase using

  maxbase::init();

instead of initializing individual components.
2018-08-21 10:02:39 +03:00
Johan Wikman
88f1795412 MXS-2008 Move Worker and MessageQueue to maxbase 2018-08-21 10:02:39 +03:00
Markus Mäkelä
02ed338afa
Remove mxs::Closer<json_t*>
As std::unique_ptr can now be used with a json_t, there's no need for the
closer.
2018-08-20 13:57:00 +03:00
Markus Mäkelä
0a0623003e
MXS-1929: Factor out parameter validation
The parameter validation for all module types follows roughly the same
path: first check whether it's a known parameter and then whether the
value is valid. This can be moved into common functions that removes
duplicated code.
2018-08-20 13:57:00 +03:00
Markus Mäkelä
20994351ef
MXS-1929: Fix SSL JSON detection
The SSL initialization should only be attempted if `ssl_key`, `ssl_cert`
or `ssl_ca_cert` is defined. In addition to this, the SSL parameters
requirements for servers and listeners are different: servers require only
`ssl_ca_cert` but listeners require all three.
2018-08-20 13:57:00 +03:00
Markus Mäkelä
eddae78b42
Remove repurposing of servers
This was not very safe or correct. For example statistics and parameters
were reused by a new server.
2018-08-20 13:57:00 +03:00
Markus Mäkelä
6a06654ee9
Serialize servers from parameters
The config and JSON serialization of servers is now from the
parameters. As the server's use a different parameter type, a temporary
adapter was required. Eventually, a lock-free and globally safe way to
"disable" parameters is needed.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
e5c2b1a8c4
Create JSON serialization from object parameters
The services, monitors and filters now construct the JSON format
parameters from the configuration parameters. This reduces the need for
the amount of explicit operations and makes adding new parameters easier.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
a9ff2a7056
MXS-1929: Serialize objects using parameters
The main "non-static" objects are now serialized using their
parameters. This makes it possible to use common code for most modules.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
e2ace578d2
Validate parameters before storing them
The runtime modification of servers, services and monitors now validates
the parameters before starting the update process. This guarantees that
the set of parameters is valid before it is processed.

After the validation, the parameters are now also stored in the list of
configuration parameters. This will simplify the serialization process by
removing the need to explicitly serialize all common object parameters.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
3c20b47a8d
Change parameters in dump_param
Putting the file descriptor first keeps it in line with dprintf.

Making the parameter set an initializer list allows matching against
multiple sets of parameters in one function call. This will compact the
parameter serialization by using the same code for the common service
parameters and the module parameters.
2018-08-20 13:56:59 +03:00
Markus Mäkelä
fe7a73e5c3
Register atexit functions in the correct place
The atexit functions should be registered after there is a need for
them. This fixes the problem where cleanup functions were called before
the initialization for them was done. Also removed the header and footer
printint to stdout.
2018-08-20 13:56:59 +03:00
Johan Wikman
40a5ae81c7 MXS-2008 Store worker as MXB_WORKER* and not void* 2018-08-20 11:15:14 +03:00
Johan Wikman
e0cb11151f MXS-2008 Move maxscale/worker.h to maxbase/worker.h 2018-08-20 11:15:14 +03:00
Johan Wikman
932956d5f6 MXS-2008 Add maxbase/poll.[h|hh]
Remove maxscale/poll_core.h
2018-08-20 11:15:14 +03:00
Johan Wikman
aaad63ee5e MXS-2008 Move content of maxscale/platform.h to maxbase/cdefs.h
No good reason for keeping that platform adjustments anywhere
else but in cdefs.h.
2018-08-20 11:15:14 +03:00
Markus Mäkelä
90960ec07f
Make Worker::run(mxb::Semaphore*) private
The semaphore is only used when Worker::start() is called to synchronize
the startup of the two threads. Also asserted that the state is what we
expected it to be.
2018-08-20 10:10:23 +03:00
Markus Mäkelä
af70dc3973
Fix build failures
Fixed build failures caused by merges and rebases.
2018-08-17 18:23:04 +03:00
Markus Mäkelä
667e9df97c
Merge branch '2.2' into develop 2018-08-17 18:10:44 +03:00
Markus Mäkelä
208949f1cb
Synchronize the worker thread with the starting thread
This guarantees that the caller of the start function will know whether
the worker is running by looking at its state.

This will prevent multiple successive stop calls to a worker which
happened when the monitors were altered via the REST API.
2018-08-17 18:09:51 +03:00
Markus Mäkelä
0fbd789572
MXS-2019: Fix atexit handlers
The code now registers all functions once instead of one function multiple
times.
2018-08-17 17:35:41 +03:00
Johan Wikman
d8255d0cac MXS-2017 Move maxscale::Semaphore to maxbase::Semaphore 2018-08-17 15:53:54 +03:00
Markus Mäkelä
f09afa2967
Combine regression test suite and main CMake projects
Combining the projects makes it easier to use common components. This
fixes the build failure of maxutils due to missing jansson definitions.
2018-08-17 14:29:28 +03:00
Johan Wikman
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
Johan Wikman
894d4eb034 MXS-2014 Explicitly set the MaxScale log identification 2018-08-17 10:59:37 +03:00
Esa Korhonen
57706e7758 Hide the MonitorInstance m_state field
The field had the same purpose as MXS_MONITOR->state. Now the field
is only used for checking if the MonitorInstance thread is running.
2018-08-17 09:47:32 +03:00
Esa Korhonen
fe5df6d379 Remove duplicate monitor state definitions
The state is still stored in two different variables. Also, removed the
ALLOC and FREED states.
2018-08-17 09:47:32 +03:00
Johan Wikman
9a8bb95be6 MXS-2014 Rename mxs_log_priority_is_enabled
- Renamed to mxs_log_is_priority_enabled
- That function instead of the macro is now consistently used
2018-08-16 09:59:43 +03:00
Johan Wikman
952ee0c15f MXS-2014 Implement MaxScale log manager using maxbase/log.h 2018-08-16 09:59:43 +03:00
Johan Wikman
17418572f9 MXS-2014 Move maxscale/jansson.h to maxbase/jansson.h 2018-08-16 09:58:00 +03:00