Commit Graph

11405 Commits

Author SHA1 Message Date
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
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
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
0d934476b0 MXS-1992 Provide std::default_delete<json_t> 2018-08-03 07:33:12 +03:00
166ecfead6 MXS-1992 MaxAdmin uses RoutingWorker for QC stats 2018-08-03 07:33:12 +03:00
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
c302268ca3 MXS-1992 Provide maxadmin if for getting qc stats
- Equivalent functionality will be provided for maxctrl.
- Functionality for obtaining the data will be moved to RoutingWorker.
2018-08-03 07:33:12 +03:00
ae27ea92a0 MXS-1992 Thread-initialize internal QC module 2018-08-03 07:33:12 +03:00
25536af91f MXW-1992 Update size when inserting 2018-08-03 07:33:12 +03:00
1f5e23c674 MXS-1997: Increase object name length limits
Updated the limits to 1023 characters and documented the old value.
2018-08-02 22:12:06 +03:00
46ed043fb0 Display diagnostics for running monitors
If a monitor is not running, the diagnostics function will not be called.
2018-08-02 18:56:36 +03:00
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
d412b8d729 Move execute_worker_task into mxs::Worker
The function has use outside of the monitors as it makes execution of
worker tasks much more convenient. Currently, this change only moves the
code and takes it into use: there should be no functional changes.
2018-08-02 18:56:35 +03:00
107395f608 Fix debug assertion on MaxScale shutdown
The assertion didn't take into notice whether teardown had started.
2018-08-02 18:56:35 +03:00
8cd07def80 Add timeout to mxs1929_service_runtime
Some of the commands appear to be hanging.
2018-08-02 18:56:35 +03:00
b14cfea7e3 Fix alloc-dealloc mismatch
The filter was deleted using free but allocated with new.
2018-08-02 18:56:34 +03:00
8b9f7cc458 Fix alter_router configuration
The stale slave detection is needed.
2018-08-02 18:56:22 +03:00
a5e7c08973 MXS-1992 Pre-increment provides a slight benefit 2018-08-02 14:16:53 +03:00
e637acd0a2 MXS-1992 Canonicalize using std::string
Significantly reducing the number of allocations done.
2018-08-02 14:16:53 +03:00
bcdab394c1 MXS-1992 Provide canonical function for std::string 2018-08-02 14:16:53 +03:00
81297fb919 Update naming convention for structs
The earlier guideline was just a "formalization" of existing
conventions.
2018-08-02 14:16:53 +03:00
836db54800 Clean up server status printing
Uses mostly the status functions for reading the flags. Strickly
speaking this breaks the REST API since in some cases (status combinations)
the printed string is different from what was printed before.
2018-08-02 10:42:12 +03:00
f7e3d4c2fb Remove maxscale/thread.hh
A C++11-like implementation of thread, future, etc. that now is
obsolete as we use C++11.
2018-08-01 17:12:49 +03:00
9e084753b0 Reduce test verbosity on failure
The tests should stop attempting any queries after the first failure.
2018-08-01 16:48:05 +03:00
359f61c73b Improve shutdown signal safeness
The signal handler no longer acquires the service list lock which removes
a number of deadlock possibilities from the shutdown process. Instead, a
global shutdown flag is set that serves the same purpose as the individual
service shutdown flags did.
2018-08-01 16:48:05 +03:00
8a248dd930 Copy callbacks by value in mxs_rworker_broadcast
Copying by reference will not work as the references will refer to the
values passed to the function, not the actual callbacks.
2018-08-01 16:48:04 +03:00
2939779052 Merge branch '2.2' into develop 2018-08-01 16:47:19 +03:00
47c89d5b89 Remove duplicate variable
Caused by rebasing changes. Also fixed the comment to reflect the current
situation.
2018-08-01 15:06:39 +03:00
a0b0f7993e Create servers in configuration order
As we know servers don't have dependencies, we can construct them in
configuration file order.
2018-08-01 15:02:02 +03:00
f68da38b32 Clean up get_shard_target in schemarouter
get_shard_target had become little bloated with the recent changes so
some routing cases were moved to their own functions. Also removed
some code that was not needed.
2018-08-01 11:55:31 +03:00
ef7fa7f879 MXS-1992 Implement cache size control
The cache now enforces the defined maximum size by evicting some
entries in case the insertion of a new entry would cause the max
size to be exceeded. Currently the eviction algorithm simply
removes a random element.
2018-08-01 11:10:34 +03:00
466e8a923c MXS-1992 Handle 'query_classifier_cache_size' parameter
No effect yet on the caching.
2018-08-01 11:10:34 +03:00
6d5210b4cb MXS-1992 Add qc cache documentation 2018-08-01 11:10:34 +03:00
f584b481eb MXS-1992 Add program for measuring cache performance
With this program it is possible to find out the difference in
performance between cached and non-cached query classification.
2018-08-01 11:10:34 +03:00
18180cd4ac MXS-1624 Also explicit parsing should utilize the cache 2018-08-01 11:10:34 +03:00
a6afc7fcbd Update 2.2 version number
Updated version to 2.2.13 in preparation for the next release.
2018-07-31 22:53:11 +03:00
a91b054eb4 Fix out-of-source runs of mxs791_galera.sh
The test used the current directory instead of the source directory where
the script was located.
2018-07-31 22:53:10 +03:00
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
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
bd48db28ec MXS-1929: Simplify result set mechanism
The result set mechanism was ill-suited for iteration over
lists. Converting it into a class and inverting it by pushing rows into
the result set instead the result set asking for rows makes it very easy
to use with lists. It also solves some of the consistency problems that
existed with the previous implementation.
2018-07-31 22:32:32 +03:00
28e55b260f Fix test failures
Added timeouts to maxinfo_sql and mysqlmon_failover_stress, fixed
fwf_syntax to work with out-of-source test runs.
2018-07-31 22:32:31 +03:00
ad5762a2fb Fix debug assertion on shutdown
The debug assertion that asserts that services are destroyed only on the
main worker would be triggered on shutdown as there is no current worker
at that point in time. In addition to this, it is wrong to call
service_destroy at shutdown as that will remove persisted
configurations. The service_free function can be called directly as we
know no other thread are running when the services are being torn down.

Also added the missing check that the destroyInstance function is
implemented before calling it.
2018-07-31 22:32:31 +03:00
cc2ae7a0cb Resolve object dependencies
When the configuration was loaded, the dependencies were resolved at the
time the objects were constructed. To remove the need to check whether a
dependency exists at object creation time, the dependencies can be
resolved by the core as a part of the configuration processing.

The circular dependency resolution uses a template function to solve the
problem in a generic fashion. This might be slightly overkill but it is a
good way to test the waters and see whether the functon would be usable in
as a utility function.

Only explicit object dependencies are resolved. If a module declares a
parameter as a string but uses it like an object name, the dependency is
not resolved and can fail.

As the dependency resolution uses Tarjan's algorithm, it has a side-effect
of creating the correct order of objects to meet their dependencies.
2018-07-31 22:32:30 +03:00
d95b1f834d Factor out module parameter set extraction
Factored out the extraction of the parameter set that a module has. Also
cleaned up the configuration to use STL containers and types.
2018-07-31 22:32:30 +03:00
1e33ab69f2 Rename server_is_running() to server_is_usable()
The previous name was misleading. The new server_is_running() only
checks for the running bit so that a server is always either running
or down.
2018-07-31 14:53:56 +03:00
89dfc80f86 Better tracking for slave status bits
The monitor can now differentiate between slaves with a running
series of slave connections to the master from slaves with broken
links. Both still get the SERVER_SLAVE-flag if 'detect_stale_slave'
is on.

Also, relay servers must be running.
2018-07-31 14:53:29 +03:00
3be975ba5d Fix fixing of std::string object names
Comparing two fixed std::strings would have equal C strings but comparing
with operator== they would be different. This was a result of the string
modification done by fix_object_name.

Converted the internal header into a C++ header, added std::string
overload and fixed use of the function.
2018-07-31 09:41:15 +03:00
afde1fa072 MXS-1929: Cache readwritesplit configurations
By using the worker local data mechanism, data can be efficiently cached
on the local worker. This avoids all synchronization on reads and only
requires synchronization on a configuration update.

As an additional observation, the testing of std::mutex and SPINLOCK shows
that std::mutex far outperforms the MaxScale SPINLOCK even on
non-conflicting workloads.
2018-07-31 09:41:14 +03:00
ff07009d8c MXS-1929: Add worker local storage of data
Data can now be stored on thread-local storage of the worker. By acquiring
a unique handle from the worker, a module can store a thread-local
value.

This functionality will be used to store configurations that are sometimes
updated at runtime but are largely read-only. By avoiding shared data
altogether, performance is not affected. The only synchronization that is
done is on update.

Also added a helper functions for broadcasting tasks on all routing
workers. With the old mxs_rworker_broadcast_message function, if a
function call was broadcasted it was always queued for execution. The
mxs_rworker_broadcast will immediately execute the task on the local
worker and queue it for execution of other routing workers.
2018-07-31 09:41:14 +03:00
a833f39196 MXS-1929: Load global configuration as soon as possible
There exists a dependency on the configuration for the workers: the total
number of worker thread is defined by the `threads` parameter. This means
that the global configuration section must be read before workers are
started.

Commit 411b70e25656317909e54f748f8012593120041f broke MaxScale and turned
it into a single threaded application as the default configuration value
of one worker was used.
2018-07-31 09:41:14 +03:00