Commit Graph

11592 Commits

Author SHA1 Message Date
57471c7baa Improve MaxCtrl test coverage
A few missing cases that simple to solve were reported by the coverage
tool.
2018-08-13 10:28:03 +03:00
46dee98b25 MXS-1929: Report runtime module loading errors to users
If a module is not found, a proper error message is now given to the
user. Other system errors are also printed if errno is set. Dynamic
library errors aren't printed as they are apparently reset after a call to
`dlerror`, at least according to documentation.
2018-08-13 10:28:03 +03:00
064ad8fa4f Improve MaxScale startup and shutdown in NPM tests
The tests are now less violent in how they stop MaxScale. Also the logs
are now removed before a new test run is executed.
2018-08-13 10:28:03 +03:00
3bbf58ad1f Update MaxCtrl packages
Updated needed and pruned unneeded dependencies from maxctrl. Also updated
the packages in the REST API test suite.
2018-08-13 10:28:03 +03:00
06df290aeb Use DevToolSet 6 with CentOS 6
DevToolSet 4 was EOL'ed December 2017.
2018-08-13 10:28:02 +03:00
c1f930d23d Fix query classifier initialization data race
The initialization code does some modification to the global code
(something about a page cache) and causes warnings with TSAN.
2018-08-13 10:28:02 +03:00
70fa300fe1 Remove unnecessary mxs_log_flush_sync calls
The calls were unnecessary in the context where they were made.
2018-08-13 10:28:02 +03:00
cb990f28dc Remove dead log_manager code
SS_LOG_DEBUG was never defined.
2018-08-13 10:28:02 +03:00
8b39373577 MXS-1929: Document readwritesplit runtime changes
Added a note about the new behavior in 2.3.
2018-08-13 10:28:01 +03:00
4fc6b43fb3 Update pkg version
Using the newer version removes the deprecation warnings for some of the
packages.
2018-08-13 10:28:01 +03:00
09239a1c7a MXS-1929: Update REST API documentation for filters
Added the DELETE and clarified the POST documentation.
2018-08-13 10:28:01 +03:00
f9e5d3135d Allow null parameter values
If a resource parameter is defined as a null JSON value, it is ignored.
2018-08-13 10:28:01 +03:00
8bbc2c3f33 MXS-1929: Clarify service destruction
The prgress of service destruction can be monitored via the `sessions`
endpoint.
2018-08-13 10:28:01 +03:00
a399c58df3 Make NPM tests runnable by root
The tests can now be run as root. This is most likely required in some
cases and it should not break things if they are run as root (e.g. inside
a VM with no other users).

NPM prevents the use of the root user (due to modules getting root access)
and uses an unprivileged user to install the modules. As maxctrl has to
generate the version information at install time, running `npm install` as
root will fail due to missing privileges to the current working
directory. To work around this, an explicit step was added.

Also changed the maxadmin checks to maxctrl to remove the dependency on
the socket file location being writable by non-root users
(/var/run/maxscale/ might not be accessible to all users).
2018-08-13 10:28:00 +03:00
c495abcca7 Remove excessive platform checks
The constants set by the header checks aren't used and removing them cuts
the configuration time in about half (from 5 to roughly 2 second).
2018-08-13 10:28:00 +03:00
7438a0f186 Remove unnecessary MaxScale parts for NPM tests
Some of the CMake arguments were redundant, unnecessary or just a
hindrance to testing.
2018-08-13 10:28:00 +03:00
e2902b6513 MXS-2002 Remove GenericFunction typedef
It does not save much in characters compared to std::function<void ()>
and it's a bit misleading as not just any callable object will do, but
only one that takes no argument and returns void.
2018-08-13 08:30:05 +03:00
43b53fda7a MXS-2002 Replace task with std::function 2018-08-13 08:30:05 +03:00
4193c4d3db MXS-2002 Add additional versions of Worker::[call|execute]() 2018-08-13 08:30:05 +03:00
e9758ebaf1 MXS-2002 Rename Worker::post() to Worker::execute()
The main point is that tasks/functions are executed, not that
they are posted.
2018-08-13 08:30:05 +03:00
3013adb14f MXS-2002 Worker::execute() renamed to Worker::call()
In preparation for Worker::post() to be renamed to Worker:execute().
The concept of _posting_ will be reserved to mean the transfer of
something over the message queue to the worker for processing and
nothing else.
2018-08-13 08:30:05 +03:00
6335d3776c MXS-2002 Replace auto_ptr with unique_ptr
Given 'Derived : public Base', a unique_ptr<Derived> converts
implictly to a unique_ptr<Base>.
2018-08-13 08:30:05 +03:00
9cfd451a1d MXS-2002 Make Worker excecution mode explicit
This is the first step in some cleanup of the Worker interface.
The execution mode must now be explicitly specified, but that is
just a temporary step. Further down the road, _posting_ will
*always* mean via the message loop while _executing_ will optionally
and by default mean direct execution if the calling thread is that
of the worker.
2018-08-13 08:30:05 +03:00
f499b22a9e MXS-2007: Check for no rows
If the query returns no rows, a NULL row is returned.
2018-08-11 23:33:48 +03:00
b9ec3f5130 Monitor json diagnostics printing cleanup
The 'events' and 'script' config values were defined for every monitor.
Removed the extra definitions and moved the variables to MXS_MONITOR.

MariaDBMonitor was printing config values a second time, they are
already printed by the caller.

Moved the events enum definition to the internal header since it's no longer
required by modules.

Added a default config setting "all" to 'events' to clarify that it enables
all events.
2018-08-10 11:19:09 +03:00
6661680c4e MXS-1929: Add direct filter relationship updates
The filters of a service can now be directly updated via the relationships
endpoint.
2018-08-10 09:53:33 +03:00
f93658e487 MXS-1929: Document REST API additions for services
Added documentation about creation and destruction of services as well as
updates to service parameters and relationships. The direct updating of
service relationships for filters is not yet implemented.
2018-08-10 09:53:33 +03:00
8351bf8451 Add missing value initialization
The query classifier cache statistics returned an uninitialized pointer.
2018-08-10 09:53:31 +03:00
7c627144fb Fix basic parameters
The ssl parameters were defined as strings even thought they were actually
enums. The events parameter was also a string even though it was an enum.

Also added the missing "all" value to the events enum. This fixes the
regression of scripts not being launched on all events by default.

Moved the definition of the default version string where it should be and
removed the empty value check.
2018-08-10 09:50:56 +03:00
390c749d4a Test runtime size validation
Added tests into the MaxCtrl test suite that confirm size types are
properly handled.
2018-08-10 09:50:56 +03:00
290dcff48e Add runtime size type check
Took the size type validity check function into use in runtime
configuration. This fixes the problem with zero not being accepted as a
valid size for query_classifier_cache_size.
2018-08-10 09:50:54 +03:00
ac098c4a02 Check validity of size types
The get_suffixed_size function is now exposed in the internal config
header and it also checks for the validity of the size types.

Took the new function into use and added the appropriate error messages.
2018-08-10 09:44:44 +03:00
f14380243b Rename cppdefs.hh to ccdefs.hh
For obvious reasons; the c++ suffix is .cc and not .cpp
2018-08-10 07:50:18 +03:00
b7c94abb34 Keep track of previously observed slave connections
This reduces the ambiguity of server id:s in the slave status contents.
If a slave connection has been seen properly connected at an earlier time,
it can be trusted to report the correct master server id. This also
fixes some wrong status assignment edge cases with the SERVER_WAS_SLAVE-bit.
The bit will be removed in a later commit.

Even this does not solve the situation when MaxScale is started with
some servers down.
2018-08-09 20:39:19 +03:00
66061be58b Remove duplicate REST API section
The listeners section was duplicated. Also fixed a typo.
2018-08-09 18:56:58 +03:00
a05b8c3ab4 Fix run_npm_test.sh
`docker exec` must be invoked without the -t flag as no terminal is
present.
2018-08-09 12:56:53 +03:00
f6cd8b6454 Fill the gaps in MaxCtrl testing
The MaxCtrl test suite now covers most of the code that can be tested
within reasonable limits. Also removed some dead code in `list servers`.
2018-08-09 12:56:53 +03:00
50c20e79ee MXS-1929: Reject promise on invalid input
If a value that is not of key-value format was given to the create
commands, the code previously threw an exception. This causes tests to
misbehave so changing it to a rejected promise is more appropriate.
2018-08-09 12:56:52 +03:00
db09996bb8 MXS-1929: Prevent destruction of services with filters
If a service has filters, they must first be removed before the service
can be destroyed. This is not a functional requirement but it keeps the
behavior consistent so that the relationships of a service must be empty
before it is destroyed.
2018-08-09 12:56:52 +03:00
ccdf1c5679 Improve MaxCtrl test coverage
Added tests that cover areas that weren't tested before.
2018-08-09 12:56:51 +03:00
1447ac2eb9 Fix MaxCtrl cluster tests
The configuration used an invalid parameter name which caused the two
MaxScales to use the same directory for persisted configurations.

The test also tried to sync with the wrong server causing the same
listener to be created twice on the same port but on different MaxScales.

Cleaned up the startup and shutdown scripts to always start from a clean
state.
2018-08-09 12:56:51 +03:00
b69fc4d32c Fix startup of MaxScales in NPM tests
The output was overwritten for each new test.
2018-08-09 12:56:50 +03:00
38219556b6 Fix crash on failure to listen on port
If a listener was created at runtime and at some point it fails (e.g. the
port is already taken), the listener would be removed from the service. In
2.2, the removal of the listeners simply marked the listener as
inactive. In 2.3, the functions were combined so that the listener is
marked as inactive and removed from the workers. The fact that the
listener had a NULL DCB at that point caused the crash.

The correct thing to do is to not remove the listener from the service and
to mark the listener as inactive in the close_port helper function. The
listener will be freed once the service is destroyed.
2018-08-09 12:56:50 +03:00
679ab6a0e9 Remove printing to console in test
The test case, for whatever reason, printed data to the console.
2018-08-09 12:56:49 +03:00
207a8609dc Use docker directly in NPM test runner
The checking of the container status should use docker directly.
2018-08-09 12:56:49 +03:00
6e481a0f95 Fix REST API tests
The tests expected results that weren't correct.
2018-08-09 12:56:49 +03:00
37d9c09c5f Make NPM tests faster
The test now builds with multiple jobs.
2018-08-09 12:56:49 +03:00
81d1a6122c MXS-1929: Test atomic swap of filters
When the filters of a service are modified, each session to that service
should either see the old filters or the new filters i.e. the operation
must be atomic.
2018-08-09 12:56:49 +03:00
b4a748ab8f MXS-1929: Test creating filters under load
Extended the test to repeatedly create and destroy filters under load.
2018-08-09 12:56:48 +03:00
f560172665 MXS-1929: Fix creation of filters that have no parameters
If the filter does not declare defaults and no parameters are defined, the
list of parameters would be NULL. This was interpreted as an error and the
filter creation failed.
2018-08-09 12:56:48 +03:00