If auto_failover is disabled and an alternative master exists, the
monitor will swap the master. This may break replication, but the
situation requires that the dba has set up a cluster with multiple
masters.
MariaDBMonitor diagnostics printing is unsafe as some of the read
fields are arrays. To be on the safe side, the fields are now read
in the monitor worker thread.
Since diagnostics must work even for stopped monitors, a worker task
is used. In practice, it usually runs when the monitor is sleeping.
Because of monitor changes, the test had wrong assumptions.
Renamed the test and updated it to use MaxCtrl for some queries.
Also, changed the type of the cycle container in the monitor to an
ordered map so that results are predictable.
The C++ version with the lock guard is easier to manage when there are
multiple return points from a function. It also makes sure that the lock
is freed after it's used.
Spaces must be considered a part of the object name in tokenization. This
ensures that the name normalization process generates correct names and
that tokens are split at correct places.
The result collection now covers more cases, including the use of
COM_CHANGE_USER. The addition of COM_STMT_EXECUTE to the list of commands
that generate result set responses is needed in order for the code to take
the correct branch.
With the removal of the old session command implementation, the code that
used it can be removed or replaced with newer constructs. As a result, the
backend protocol no longer does any session command processing.
The three buffer types, GWBUF_TYPE_SESCMD_RESPONSE,
GWBUF_TYPE_RESPONSE_END and GWBUF_TYPE_SESCMD as well as their related
macros are no longer used and can be removed.
The test cases allocated servers in a way that doesn't comfortably suit
the way the servers are now allocated. Adding a helper C++ class to load
module defaults makes it easier to do explicit server initialization in
tests.
The binlogrouter was also fixed in this commit as it uses servers much
like a test would use.
The configuration system that modules use allows the SSL parameter
validation to be simplified. It should also provide more consistent error
messages for similar types of errors.
The SSL_LISTENER initialization is now done in one step. There was no good
reason to do it in two separate steps for listeners but in one step for
servers.
The `ssl` parameter now also accepts boolean values. As the parameter
behaves like a boolean and looks like a boolean, it ought to be a
boolean. It still accepts the custom `required` and `disabled` values
simply for backwards compatibility.
Also added the missing freeing functions for the SSL_LISTENER type. This
prevents failed SSL_LISTENER creations from leaking memory.
The test environment isn't always pristine after a test run so for the
sake of being able to actually test what we're attempting to test, we
should ignore duplicate databases for the time being.
The long-term fix is detect when a test doesn't clean up after itself.
The relay master status was assigned to a server based on the last known
replication status of the slaves that have at some point replicated from
it. This can cause false positives and the relay master status is assigned
to servers that have never been observed to act as relay masters.
The master failure verification would not work if the slaves did not have
a state change since MaxScale had started. This can be fixed by treating
the startup of MaxScale as an event of sorts.
The parameter type and value validation is now fully done for the base
module parameters as well. This fixes a problem that was introduced when
the listeners were moved to the module parameter system where the
`service` parameter values weren't fixed for the new naming style.
Added an explicit check for the module type that catches errors in the
type parameter. The lack of this parameter prevents the proper detection
of other parameters.
Also cleaned up and/or removed redundant sections of code. By treating
reserved parameters the same way as module declared ones, the same code
can be re-used for all types.
Some of the older tests expected results that didn't make much sense. The
mxs1643_extra_events test should expect the master to devolve into the
Running state when it is set into read-only. This is understandable as a
set of servers consisting only of slaves is rather disorienting.
In mxs1678_relay_master breaking the replication of the relay master
devolves it into the Running state as well as all slaves replicating from
it. This is a better result as in a real-life scenario only the valid and
up-to-date slaves would be used.
The master validity check now checks if the master is down. This requires
that the slave status is assigned even if no master is available.
The failover precondition is also fulfilled as long as one valid promotion
candidate is found. Previously a slave that didn't use GTID replication
appeared to prevent failover.
The common monitor parameters are now stored as module-style
parameters. This makes the error reporting as well as the type checks for
the parameters consistent with parameters declared by the modules.
The same mechanism that is used for modules can be used for the
configuration of the core objects. This removes the need for the redundant
code that validates various values that is already present in the code
that modules use.
The auto_failover is a more reliable solution and should be used instead. Several
unused parameters were removed, although they can still be defined in the config
file. Updated documentation on the relevant parts.
The process of stopping a service will not prevent new connections from
being created. The documentation needs to be extended so that the meaning
of `accepted` is explicitly and clearly stated.