Commit Graph

3711 Commits

Author SHA1 Message Date
6451b1f21a MXS-2183: Fix memory leaks
Under heavy load some of the basic network operations could fail which led
to some of the allocated memory to leak.

Also the backend protocol never freed the current protocol command if it
was not completed. This would happen if a user executed a session command
as the first command but backend authentication would fail.
2018-11-28 02:03:00 +02:00
05c9aea04d MXS-2186: Make SHOW DATABASES a read
Since SHOW TABLES is a read, SHOW DATABASES should be one as well.
2018-11-27 12:52:44 +02:00
01628dd0de Cleanup server version updating 2018-11-21 17:36:52 +02:00
1591ff7f46 MXS-2179 Activate WD workaround when fetching users
Fetching the users may potentially take longer than the watchdog
timeout. To ensure that MaxScale is not killed by systemd, we must
ensure that the notifications are generated also when MaxScale
synchronously is fetching the users.
2018-11-21 13:47:04 +02:00
f1a113aff0 MXS-2178 Reduce accessbility of workarounds
Some rearrangements to ensure that what should be private
can be kept private.

- WatchdogNotifier made a friend.
- WatchdogWorkaround defined in RoutingWorker and made a friend.
- mxs::WatchdogWorker defined with 'using'.
2018-11-21 13:31:49 +02:00
78829429ae MXS-2178 Add WD workaround to REST-API and maxadmin 2018-11-21 13:31:49 +02:00
be12cab16d MXS-2178: Provide workaround for watchdog notifications
The systemd watchdog mechanism requries notifications at
regular intervals. If a synchronous operation of some kind
is performed by a worker, then those notfications will not
be generated.

This change provides each worker with a secondary thread that
can be used for triggering those notifications when the worker
itself is busy doing other stuff. The effect is that there will
be an additional thread for each worker, but most of the time
that thread will be idle.

Sofar only the mechanism; in subsequent changes the mechanism
will be taken into use.
2018-11-21 13:31:49 +02:00
cbe1483028 MXS-2167: Add support for extra_port
This allows MaxScale to connect to the server even when max_connections
has been reached.
2018-11-15 14:24:41 +02:00
37d38593d5 MXS-2100: Treat unknown global parameters as errors
Previously they merely generated warnings.
2018-11-14 16:23:47 +02:00
f9d18606a8 Remove unused code
The code that required these parameters was not added into 2.3 as it was
not needed.
2018-11-14 16:23:47 +02:00
77f8a3b71b MXS-2057 System test 2018-11-14 16:20:42 +02:00
e371964f8b MXS-2057 Add log output for system test, and two random code fixes 2018-11-14 16:20:42 +02:00
ae0e9b359d Fix use of zero-weight servers
The servers with a zero weight would be always used over ones that have a
weight. This means that the behavior was inverted and caused the
mxs2054_hybrid_cluster test to fail in 2.3.

Also fixed a typo in the deprecation message.
2018-11-12 10:13:59 +02:00
1108132cbd MXS-2057 Do not require systemd libraries
Exclude systemd usage if the library is not installed.
Only excluding what is necessary. This keeps the object size the
same and still compiles most of the code.
2018-11-09 16:45:59 +02:00
f29e5b65de MXS-2057 systemd watchdog
Systemd wathdog notification at a little more than 2/3 of the
systemd configured time. In the service config (maxscale.service)
add e.g. WatchdogSec=30s to set and enable the watchdog.
For building: install libsystemd-dev.

The next commit will modify cmake configuration and code to
conditionally compile the new code based on existence of libsystemd-dev.
2018-11-09 16:45:59 +02:00
00d0ec5f8e Move wait_for_maxscale functionality inside MaxScale
By exposing a (currently undocumented) debug endpoint that lets one
monitor interval pass, we make the reuse of the monitor waiting
functionality a lot easier. With it, when MaxScale is started by the test
framework it knows that at least one monitor interval will have passed for
all monitors and that the system is ready to accept queries.
2018-11-09 09:13:27 +02:00
ecc7442358 Detect manual commands faster
Previous, MariaDBMonitor would wait until the next monitor interval before detecting
a new manual command. The commands are now checked every 100 ms.
2018-11-08 19:12:00 +02:00
d65269fabb Always process responses inside RootResource
The REST API would skip propagation of the requests to the RootResource if
it was a request to the empty resource.
2018-11-08 12:14:36 +02:00
7d54df74dc Hard-code minimum suggestion distance to 4
This way only close matches are suggested.
2018-11-08 12:14:36 +02:00
809d3549ae MXS-2149 Add REST-API watchdog
This will simply cause a task to be posted to each worker.
If the workers are running normally, the task will reach the
workers and the associated semaphore posted, and the REST-API
call will return. If any worker is not running normally, the
task will not be processed and the REST-API call will hang.
2018-11-08 12:13:02 +02:00
32f2e769f4 MXS-1780 Make retain_last_statements service specific 2018-11-08 12:08:42 +02:00
2bd2b4a32e MXS-1780 Report times using localtime instead of gmtime 2018-11-08 12:08:42 +02:00
dd712a06fa MXS-1780 Make statement retaining session specific
Whether or not a session should retain its statements is now
a property of the session. This in preparation for making the
whole functionality a property that can be enabled and disabled
at runtime, of the service.
2018-11-08 12:08:42 +02:00
c899f00541 MXS-1780 Collect server response information
As the router is the only one that knows what backends a particular
statement has been sent to, it is the responsibility of the router
to keep the session bookkeeping up to date. If it doesn't we will
know what statements a session has received (provided at least some
component in the routing chain has RCAP_TYPE_STMT_INPUT capability),
but not how long their processing took. Currently only readwritesplit
does that.

All queries are stored and not just COM_QUERY as that makes the
overall bookkeeping simpler; at clientReply() time we do not need to
know whether or not to bookkeep information, we can just do it.

When session information is queried for, we report as much information
we have available.
2018-11-08 12:04:55 +02:00
c78c5a615d MXS-1780 Store time when statement was received 2018-11-08 12:03:50 +02:00
c6378e1006 MXS-1780 Make retained statements available via REST-API 2018-11-08 12:03:50 +02:00
fa13b8036a MXS-1780 Store last statement as cloned GWBUF
The last statements of a session are now stored as a cloned
GWBUF instead of as a copy of the SQL.
2018-11-08 12:03:50 +02:00
c692c864e2 MXS-2078 Take new statistics into use 2018-11-08 10:44:32 +02:00
5175d2b2d7 MXS-2078 Add support for holding router specific server data.
New class to hold the statistics, part of which is currently in
RWSplitSession. Simple API in Backend to create session
specific data.
2018-11-08 10:44:32 +02:00
a99ab62cb7 MXS-2136: Convert 'passwd' to 'password'
The old 'passwd' parameter is now converted to the 'password' parameter
and a warning about its deprecation is logged. This keeps the mandatory
parameter detection functional while still allowing old-style
configurations to be used.
2018-11-06 15:09:14 +02:00
f7f6bcea9e Add parameter name suggestions
If an unknown parameter is detected, a suggestion is now given from the
set of known parameters if they are similar enough.
2018-11-06 15:09:14 +02:00
b05385e0ac Cleanup monitor stop/start during runtime modification
The stop/start between different callers of do_alter_monitor was
confusing.
2018-11-06 11:44:50 +02:00
fe3900be0e MXS-2102 Allow runtime change of disk_space_threshold for monitor
This is currently disallowed for the server parameter, as the value could be
read/written concurrently. The monitor parameter can be changed since the
monitor is stopped during write.
2018-11-06 11:44:50 +02:00
2c280e27f2 Free qc thread resources at worker exit 2018-11-06 11:44:50 +02:00
6dc038aa4e MXS-2137 Remove meaningsless statistics
The removed statistics variables have no meaning anymore and
were not updated.
Decided to simply drop the variable from the JSON output. It
gets far too rigid if fields of objects cannot be changed without
bumping the REST-API version.
2018-11-06 09:49:25 +02:00
ab70231c12 Fix per thread memory use log message
The query classification cache size was not correctly calculated for the
message.
2018-11-05 13:43:22 +02:00
b8a595a0e6 Fix DCB closing debug assertion
The assertion for a DCB with a fd of -1 needs the internal DCBs as well
since they do not have valid file descriptors.
2018-11-05 13:43:22 +02:00
f8c132903b Fix query average measurment and average text output.
The query_ended() call was not in the right spot. Tests did not
detect it. Changed textual output to reflect the fact that they
are for RWSplit reads.
2018-11-04 17:18:09 +02:00
e5d6e5329a Format source code
Formatted all of the source code that was not accordance with the coding
style. This was caused by merges from 2.2 into 2.3.
2018-11-01 14:05:15 +02:00
a349f0ad0d MXS-1779 Implement the classify REST-API 2018-10-31 10:19:40 +02:00
3631388f75 MXS-1779 Add initial support for classification URL
This commit introduces the plumbing support for obtaining
classification information of a statement using the REST-API.
It introduces a URL like

    /v1/maxscale/query_classifier/classify?sql=SELECT+1

that in the response will return a JSON object with the
information. Subsequent commits will provide the actual
information.
2018-10-31 10:19:40 +02:00
cd92b6d4d7 MXS-2122: Close listener socket on destruction
Even though directly closing the socket is not very neat in the
architectural sense of things, it allows the best of both worlds: the
socket is instantly closed and is open for reuse while the listener struct
is still available as a reference.

This change needs to be revised when the listeners are refactored into
separate objects.

Updated documentation to reflect the change in behavior.
2018-10-31 09:53:50 +02:00
47d2898818 MXS-2121: Allow destruction of static listeners
If a listener is defined in a static configuration file, it can now be
destroyed at runtime. If MaxScale is restarted, the listener will be
created again unless the configuration file is modified.
2018-10-31 09:53:49 +02:00
906d8cee5b Format all files
Formatted all files with uncrustify.
2018-10-31 09:46:02 +02:00
8d1b26060a MXS-2109: Change semantics of query_classifier_cache_size
The cache size now refers to the total memory used by the cache instead of
the per thread limit. This makes it easier to use as well as more
predictable by removing the dependency on the number of worker threads.
2018-10-31 09:46:02 +02:00
06d1189e94 Remove unused and confusing variable
The global version_string variable was never set.
2018-10-31 09:13:07 +02:00
7deed35587 Merge branch '2.2' into 2.3 2018-10-31 09:03:09 +02:00
ce35b0d541 Merge branch '2.2' into 2.3 2018-10-30 14:16:33 +02:00
91c5f8580c MXS-2119: Fix file permissions
The admin files are now created with 640 permissions and automatically
created directories now properly set the permissions for the group as
well. All files and directories created by avrorouter and binlogrouter
also now correctly limit the read and write permissions only to the owner
and the group.
2018-10-30 12:45:36 +02:00
4d8a95d041 Merge commit '262f1d7e471bacca6b985ec3f2cd5cb76d6e2584' into 2.3 2018-10-26 12:44:57 +03:00