10410 Commits

Author SHA1 Message Date
Esa Korhonen
0b459c0496 Always check monitor permissions when starting monitor
Servers could have been added while monitor was down so better be on the safe side.
2018-05-14 11:11:08 +03:00
Johan Wikman
42c10cfa1c MXS-1848 Move Worker from internal to public include dir
maxscale::Worker needs to be public if monitors should be
implementable using it.
2018-05-14 10:10:18 +03:00
Esa Korhonen
370b3be576 MXS-1703 Support "Preparing" in Slave_IO_Running
Is interpreted as "Connecting".
2018-05-09 12:49:23 +03:00
Johan Wikman
13eecfbaa3 MXS-1809 Cancel all delayed calls when worker is going down
Unless the calls are canceled and deleted, there will be a leak.
2018-05-08 16:01:27 +03:00
Esa Korhonen
12035289f4 Remove server authenticator options
Was unused. A warning is printed if the parameter is defined. Any value is ignored.
2018-05-08 14:18:00 +03:00
Esa Korhonen
0c5af4b13f Merge branch '2.2' into develop 2018-05-08 14:10:52 +03:00
Esa Korhonen
39789c19d3 MXS-1856 Do not set read_only OFF if join_cluster() fails
This could in some cases leave read_only OFF even if the target slave
begins replication.
2018-05-08 13:56:57 +03:00
Esa Korhonen
ee2c3001d4 Merge branch '2.2' into develop 2018-05-08 13:51:26 +03:00
Johan Wikman
fe0ed99df4 MXS-1848 Fix typo 2018-05-08 13:44:28 +03:00
Esa Korhonen
7ede6b321c Merge branch '2.1' into 2.2 2018-05-08 13:35:08 +03:00
Esa Korhonen
bcbb823ab3 MXS-1772 Document netmask limitations
Only mentioned in the MySQL authenticator section, although the limitation
is likely in all authenticators.
2018-05-07 16:37:43 +03:00
Johan Wikman
401dc79dad MXS-1848 Implement GRMon using maxscale::MonitorApi 2018-05-07 14:53:48 +03:00
Johan Wikman
8ab247b237 MXS-1848 Introduce maxscape::MonitorApi
The purpose of this template class is to provide the
implementation of the monitor C-api. It's to be instantiated
with the class that actually provides the monitor behaviour.

A separate class maxscale::MonitorInstance will be provided
that then in turn implements the behaviour common to most
monitors. So, the structure will be like:

    class SomeMonitor : public maxscale::MonitorInstance {...}

    extern "C" MXS_MODULE* MXS_CREATE_MODULE()
    {
        static MXS_MODULE info =
        {
            ...
            &maxscale::MonitorApi<SomeMonitor>::s_api,
            ...
        };

        return &info;
    }
2018-05-07 14:48:35 +03:00
Johan Wikman
bf2a97812d MXS-1848 Destroy all monitors at system shutdown 2018-05-07 14:08:36 +03:00
Johan Wikman
44fa2a4be2 MXS-1848 Change prototype of startMonitor
StartMonitor() now takes a MXS_MONITOR_INSTANCE and returns
true, if the monitor could be started and false otherwise.
So, the setup is such that in createInstance(), the instance
data is created and then using startMonitor() and stopMonitor()
the monitor is started/stopped. Finally in destroyInstance(),
the actual instance data is deleted.
2018-05-07 14:08:36 +03:00
Johan Wikman
5c1083c4aa MXS-1848 Parameters are not available at createInstance time
The monitor parameters are not available when the monitor instance
is created so at least for the time being they are removed from
the API.
2018-05-07 14:08:36 +03:00
Johan Wikman
81654fb0e7 MXS-1848 Rename monitor types and instance variable
The following type name changes

  MXS_MONITOR_OBJECT   -> MXS_MONITOR_API
  MXS_SPECIFIC_MONITOR -> MXS_MONITOR_INSTANCE

Further, the 'handle' instance variable of what used to be
called MXS_MONITOR_OBJECT has been renamed to 'api'.

An example, what used to look like

   mon->module->stopMonitor(mon->handle);

now looks like

  mon->api->stopMonitor(mon->instance);

which makes it more obvious what is going on.
2018-05-07 14:08:36 +03:00
Johan Wikman
851cefefc6 MXS-1848 monitor_[alloc|free]() -> monitor_[create|destroy]
As these will call the createInstance and destroyInstance functions
of the monitor, they are more appropriately named like this.
2018-05-07 14:08:36 +03:00
Johan Wikman
510eb7ec7c MXS-1848 Change monitorCamelCase to monitor_snake_case 2018-05-07 14:08:36 +03:00
Johan Wikman
83f3d6d71d MXS-1848 Rename monitorDestroy to monitor_deactivate
MonitorDestroy() (renamed to monitor_destroy()) will be used for
actually destroying the monitor instance, that is, execute
destroyInstance() on the loaded module instance and freeing the
the monitor instance.

TODO: monitor_deactivate() could do all the stuff which is currently
      done to the monitor in config_runtime(), instead of just
      turning off the flag.
2018-05-07 14:07:05 +03:00
Johan Wikman
60228f0f26 MXS-1848 Implement createInstance() and destroyInstance()
CreateInstance() (renamed from initMonitor()) and destroyInstance()
(renamed from finishMonitor()) have now tentatively been
implemented for all monitors.

Next step is to

1) change the prototype of startMonitor() to

       bool (*startMonitor)(MXS_SPECIFIC_MONITOR*,
                            const MXS_MONITOR_PARAMETER*);

   and assume that mon->handle will always contain the
   instance,
2) not delete any data in stopMonitor(),
3) add monitorCreateAll() that calls createInstance() for all
   monitors (and call that in main()), and
4) add monitorDestroyAll() that calls destroyInstance() for
   all monitors (and call that in main()).
2018-05-07 14:07:05 +03:00
Johan Wikman
02cd7b9275 MXS-1848 Add initMonitor() and finishMonitor() functions.
Not called and implementations are dummies.
2018-05-07 14:07:05 +03:00
Johan Wikman
ec8b9c773a MXS-1848 Use MXS_SPECIFIC_MONITOR type in monitor APIs
Now, all monitor functions but startMonitor takes a
MXS_SPECIFIC_MONITOR instead of MXS_MONITOR. That is, startMonitor
is now like a static factory member returning a new specific
monitor instance and the other functions are like member functions
of that instance.
2018-05-07 14:07:05 +03:00
Johan Wikman
d4008f7b28 MXS-1848 Introduce a specific monitor type
Instead of using void there's now a MXS_SPECIFIC_MONITOR struct
from which monitor specific types can be derived. This change
does not bring about other benefits than a bit of clarity but
this is the first step in clearing up the monitor API.
2018-05-07 14:07:05 +03:00
Johan Wikman
1f6cc6db8a MXS-1840 Compile all routers as C++
Minimal changes, only what is needed in order to make it compile.
2018-05-07 14:06:22 +03:00
Esa Korhonen
10b2b4ac37 MXS-1703 Use monitor-specific array instead of linked list
Also starting cleanup of server specific monitor code.
2018-05-07 13:51:27 +03:00
Esa Korhonen
b44f2cfa36 Remove SERVER->slaves field
The field was only used by MariaDB-Monitor. A later commit will add equivalent
information to the monitor diagnostics function.
2018-05-07 13:51:06 +03:00
Markus Mäkelä
b6eff12334
Merge branch '2.2' into develop 2018-05-07 09:57:47 +03:00
Markus Mäkelä
689c02d301
Send error on reauthentication failure
When the reauthentication of a client fails, the correct error should be
sent.
2018-05-07 09:57:09 +03:00
Markus Mäkelä
43cfa5eab5
Fix TSV output in MaxCtrl
The output in --tsv mode could break the TSV format if newlines or tabs
were included in the data.
2018-05-07 09:57:08 +03:00
Markus Mäkelä
4a0df97e02
Merge branch '2.2' into develop 2018-05-04 10:18:48 +03:00
Markus Mäkelä
2bb6c84be0
MXS-1847: Return value length in server_get_parameter
Returning the length of the value instead of a boolean allows the user to
know when the parameter value exceeded the buffer size passed as the
parameter.
2018-05-04 10:16:31 +03:00
Markus Mäkelä
8b5221e13a
Fix error message when no command is given
The error message when no commad was given referred to the unknown command
[""]. Due to the way the command was printed, it was quite confusing.
2018-05-03 10:48:32 +03:00
Johan Wikman
eba6c0c596 MXS-1842 Compile all authenticators as C++
Minimal changes, only what is needed to compile.
2018-05-03 10:07:43 +03:00
Johan Wikman
aa1c956aa7 MXS-1841 Compile all filters as C++
Minimal changes to make the files compile with a C++ compiler.
2018-05-03 10:04:44 +03:00
Markus Mäkelä
658329b648
Merge branch '2.2' into develop 2018-05-03 10:00:44 +03:00
Markus Mäkelä
42c468ff16
MXS-1847: Make server parameter updates atomic
The updates to server parameters are now performed in an atomic manner.
2018-05-03 09:50:52 +03:00
Markus Mäkelä
612b4e1a32
MXS-1847: Fix server_get_parameter
The function now takes an output buffer as a parameter. This prevents race
conditions by copying the parameter value into a local buffer.
2018-05-03 09:50:52 +03:00
Markus Mäkelä
e311b86800
MXS-1826: Respond with AuthSwitchRequest to COM_CHANGE_USER
To support a wider range of client connectors, MaxScale should respond
with an AuthSwitchRequest packet to all COM_CHANGE_USER commands. Only
MariaDB connectors understand the OK packet as the only response to a
COM_CHANGE_USER but all connectors understand the AuthSwitchRequest
packet.
2018-05-03 09:50:52 +03:00
Markus Mäkelä
66d7281d97
MXS-1846: Send correct packet number in errors
The mysql_create_standard_error function accepted a packet number as a
parameter but did not use it as the actual packet number. As the value it
used happened to coincide with 50% of the use-cases, it went unnoticed.

The remaining 50% occurred when a KILL command was executed with an
unknown connection ID.
2018-05-03 09:50:51 +03:00
Markus Mäkelä
e10b62e246
Add package-lock.json to maxctrl
The npm package-lock.json file locks down the dependencies to certain
versions.
2018-05-03 09:50:46 +03:00
Markus Mäkelä
bc21a28741
Add sum helper to api command
Calculating sums for values is useful for monitoring and scripting
purposes.
2018-05-03 09:50:45 +03:00
Markus Mäkelä
121d255780
Add protocol packet statistics to servers
The individual servers were missing a statistic that would give an
estimated query count. As there is no simple way to count queries for all
modules, counting the number of routed protocol packets is a suitable
substitute.
2018-05-03 09:50:45 +03:00
Markus Mäkelä
c33460cb53
MXS-1804: Update limitations document
Changed the wording of the limitation to apply only to versions older than
2.3.0.
2018-05-03 09:46:47 +03:00
Markus Mäkelä
d6c44aaf52
MXS-1804: Allow large session commands
Session commands that span multiple packets are now allowed and will
work. However, if one is executed the session command history is disabled
as no interface for appending to session commands exists.

The backend protocol modules now also correctly track the current
command. This was a pre-requisite for large session commands as they
needed to be gathered into a single buffer and to do this the current
command had to be accurate.

Updated tests to expect success instead of failure for large prepared
statements.
2018-05-03 09:46:47 +03:00
Markus Mäkelä
dc4086b182
MXS-1828: Create test case
Created a test case that performs two LOAD DATA LOCAL INFILE statements in
one query. Currently, the test will fail as the issue is not resolved.
2018-05-03 09:46:46 +03:00
Markus Mäkelä
9ef1ffa878
MXS-1507: Test transaction replay with switchover
Added a test case that verifies that a successful transaction replay is
performed when a master switchover is performed.
2018-05-03 09:46:46 +03:00
Markus Mäkelä
ff8a7c8b93
MXS-1507: Add transaction replay statistics
Added a simple counter for the number of replayed transactions.
2018-05-03 09:46:46 +03:00
Markus Mäkelä
8a52478afa
Remove redundant diagnostic output
Readwritesplit had redundant parameter values in the
`router_diagnostics`. All module parameters with their current values are
already displayed in the `parameters` member of the resource.
2018-05-03 09:46:46 +03:00
Markus Mäkelä
4b95bbc7b8
Enable info log for failing tests
The three tests appear to hang in unexpected places. Enabling the info log
should reveal where the hang happens.
2018-05-03 09:46:46 +03:00