13130 Commits

Author SHA1 Message Date
Esa Korhonen
3c188bf421 Merge branch '2.3' into develop 2019-04-16 11:23:49 +03:00
Markus Mäkelä
b1e7e34ed0
Fix admin_user_is_inet_admin
The function is sometimes called with a null password.
2019-04-16 10:46:02 +03:00
Esa Korhonen
f8a22d0ac0 MXS-2344 Add setting for enabling SSL for replication
If the monitor setting "replication_master_ssl" is set to on, any CHANGE MASTER TO-command
will have MASTER_SSL=1. If set to off or unset, MASTER_SSL is left unchanged to match existing
behaviour.
2019-04-15 19:15:45 +03:00
Markus Mäkelä
e119077328
Merge branch '2.3' into develop 2019-04-15 16:17:54 +03:00
Markus Mäkelä
9941f7d763
Merge branch '2.2' into 2.3 2019-04-15 16:13:04 +03:00
Markus Mäkelä
21b4cc3944
Merge branch '2.3' into develop 2019-04-15 15:13:50 +03:00
Timofey Turenko
b9aec60d7a Merge branch '2.2' of github.com:mariadb-corporation/MaxScale into 2.2 2019-04-15 15:00:49 +03:00
Timofey Turenko
2e7ef72e3a make ~/.ssh/id_rsa.pub default key for loading into test VMs 2019-04-15 14:59:39 +03:00
Timofey Turenko
74ea0a844c remove whitespace at end of line 2019-04-15 14:56:07 +03:00
Timofey Turenko
87741b7190 Add copying of ssh public keys to test VMs
mdbci public_keys command copies ssh public keys from given file to all created VMs
2019-04-15 13:48:19 +03:00
Timofey Turenko
a920534e94 add / to MDBCI_VM_PATH
If case of MDBCI_VM_PATH variable does not have trailing slash full names of _network_config
and _lables files are defined in the wrong way: MDBCI_VM_PATH is interpreted as a part of file name
instead of direcoty name
2019-04-15 13:45:18 +03:00
Esa Korhonen
533d5b522b MXS-1662 Cleanup PAM conversation function
Check fuction call counter properly.
2019-04-15 13:28:44 +03:00
Esa Korhonen
5af022cc9f MXS-1662 Document admin_pam_readwrite_service and admin_pam_readonly_service 2019-04-15 13:28:44 +03:00
Esa Korhonen
969ef5f9f7 MXS-1662 Add PAM authentication option for admin users
If normal authentication fails and a PAM service is defined, PAM authentication
is attempted. Separate services can be set for read-only users and admin-level
users.
2019-04-15 13:28:44 +03:00
Timofey Turenko
7ecc70fd5d Move versions checks after nodes checks
In case when nodes/servers/replication/etc in backend are broken test can not
get proper version information and exits without doing anything.
To avoid it, test first checks backend, call fix_replication() if needed
and only after that tris to check if backend version is ok for this test
2019-04-15 13:01:03 +03:00
Markus Mäkelä
bd54efbb3f
Fix skip_encoded_int
A single byte integer wasn't skipped.
2019-04-15 12:18:30 +03:00
Markus Mäkelä
f6bd9fefa4
Move assertion after error message
Logging the internal state before the assertion makes it easier to figure
out why the assertion failed in the first place.
2019-04-15 12:07:48 +03:00
Markus Mäkelä
b3399dccc4
Remove useless templates from RWBackend functions
There's no need for templates as the code is only used with one
type. Changed the code to use std::advance as that might avoid a copy of
the iterator.
2019-04-12 16:31:43 +03:00
Johan Wikman
893059c537 MXS-2424 Use persisted nodes if bootstrap node missing
At runtime the Clustrix monitor will save to an sqlite3
database information about detected nodes and delete that
information if a node disappears.

At startup, if the monitor fails to connect to a bootstrap
node, it will try to connect any of the persisted nodes and
start from there.

This means that in general it is sufficient if the Clustrix
monitor at the very first startup can connect to a bootstrap
node; thereafter it will get by even if the bootstrap node
would disappear for good.
2019-04-12 16:29:21 +03:00
Johan Wikman
164ca7b5f1 MXS-2424 Stop passing redundant information around
mysql_get_host_info(MYSQL*) returns enough information to identify
the connection.
2019-04-12 16:29:21 +03:00
Johan Wikman
c422aafe1d MXS-2424 Refactor for further changes
In subsequent change(s) persisted node information will be used
as a last resort to connect to a Clustrix node.
2019-04-12 16:29:21 +03:00
Johan Wikman
875146f53c MXS-2424 Store information about dynamic Clustrix nodes
Information about the detected Clustrix nodes is now stored to
a Clustrix monitor specific sqlite-database. This will be used
for bootstrapping the Clustrix monitor, in case a statically
defined bootstrap server is unavailable.
2019-04-12 16:29:21 +03:00
Johan Wikman
de3f4fe5a8 MXS-2346 Ttl should be stored as milliseconds
cacheconfig.hh had not been pushed earlier.
2019-04-12 15:48:28 +03:00
Johan Wikman
0c7a3240bd MXS-2346 Exclude core parameters
Core parameters are not handled by the module but by the core and
must hence be ignored when validating and configuring.
2019-04-12 15:03:02 +03:00
Johan Wikman
c381aefefc MXS-2346 Add config::ParamInteger and config::Integer 2019-04-12 15:03:02 +03:00
Johan Wikman
17aa494c87 MXS-2346 Update cache filter
As a proof of concept, the cache filter has been updated to
use the new configuration mechanism.
2019-04-12 15:03:02 +03:00
Johan Wikman
09702ab0a0 MXS-2346 Provide new configuration mechanism
The configuration mechanism consists of the following concepts:

Specification
  Specifies the available configuration parameters of a module,
  their names and their types.
Param
  Specifies a parameter, its name and its type.
Type
  Specifies the type of a configuration parameters; Bool, Size,
  Count, etc.
Configuration
  Specifies the configuration values of a particular instance of
  the module. Configuration walks hand in hand with Specification,
  the latter specifies what the former should contain.

A Specification is capable of configuring a Configuration from a
MXS_CONFIG_PARAMETER, checking in the process that all parameters
are of the correct type and that the required parameters are present.

A Specification is capable of persisting itself so that it later
can be read back.

The mechanism is closed for modification but open for extension in
the sense that if a module requires a custom parameter, all it needs
to do is to derive one class from Param and another from Type.

The canonical way for using this mechanism is as follows. Consider
a module xyx that has three parameters; a parameter called
"enabled" that is of boolean type, a parameter called "period"
that is of duration type, and a parameter "cache" that is of
size type. That would be declared as follows:

    // xyz.hh
    class XYZSession;

    class XYZ : public maxscale::Filter<XYZ, XYZSession>
    {
    public:
        static XYZ* create(const char* zName, MXS_CONFIG_PARAMETER* pParams);

    private:
        XYZ();

        static config::Specification                       s_specification;
        static config::ParamBool                           s_enabled;
        static config::ParamDuration<std::chrono::seconds> s_period;
        static config::ParamSize                           s_cache;

        config::Configuration                              m_configuration;
        config::Bool                                       m_enabled;
        config::Duration<std::chrono::seconds>             m_period;
        config::Size                                       m_cache;
    };

    // xyz.cc

    config::Specification XYZ::s_specification(MXS_MODULE_NAME);

    config::ParamBool XYZ::s_enabled(
        &s_specification,
        "enabled",
        "Specifies whether ... should be enabled or not."
        );
    config::ParamDuration<std::chrono::seconds> XYZ::s_period(
        &s_specification,
        "period",
        "Specifies the period. Rounded to the nearest second."
        );
    config::ParamSize XYZ::s_cache(
        &s_specification,
        "cache",
        "Specifies the size of the internal cache."
        );

    XYZ::XYZ()
        : m_configuration(&s_specification)
        , m_enabled(&m_configuration, &s_enabled)
        , m_period(&m_configuration, &s_period)
        , m_cache(&m_configuration, &s_cache)
    {
    }

    XYZ* XYZ::create(const char* zName, MXS_CONFIG_PARAMETER* pParams)
    {
        XYZ* pXyz = new XYZ;

        if (!s_specification.configure(pXyz->m_configuration, pParams))
        {
            delete pXyz;
            pXyz = nullptr;
        }

        return pXyz;
    }
2019-04-12 15:03:02 +03:00
Johan Wikman
d2c71472b0 MXS-2432 Recognize RESET
RESET QUERY CACHE is reported to be a session command, which will
cause it to be sent to all servers. RESET [MASTER|SLAVE] are
classified as write, which will cause them to be sent to the master.

It could be argued that RESET [MASTER|SLAVE] should cause an error
to be sent to the client.
2019-04-12 14:51:01 +03:00
Johan Wikman
3127aa85c5 MXS-2432 Add test that reveals issue
RESET is neither parsed not tokenized, so RESET statements ends
up being sent to the master. That is fine for all but RESET QUERY
CACHE that should be sent to all servers.
2019-04-12 14:51:01 +03:00
Markus Mäkelä
c643f9bc8d
Merge branch '2.3' into develop 2019-04-12 13:23:49 +03:00
Markus Mäkelä
382d485c2e
Add history to maxctrl cli 2019-04-12 13:02:02 +03:00
Markus Mäkelä
961cb80521
MXS-2313: Add hint test case
The test verifies that hints override priority.
2019-04-12 13:02:02 +03:00
Markus Mäkelä
1c87e2facf
Add changes to admin user hashing to release notes 2019-04-12 13:02:01 +03:00
Johan Wikman
4131f09c16 MXS-2431 Recognize the XA keyword
Recognize the XA keyword and classify the statement as write.
Needs to be dealt with explicitly as sqlite3 assumes there are
no keywords starting with the letter X.
2019-04-12 11:05:15 +03:00
Johan Wikman
62f2a86a5f MXS-2431 Add test that reveals the problem 2019-04-12 10:30:36 +03:00
Markus Mäkelä
1652b18a7b
Fix whitespace in canonicalized queries
Trailing whitespace was not removed and whitespace wasn't normalized to
spaces.
2019-04-12 09:18:07 +03:00
Markus Mäkelä
d2ecaa83a6
Move result start handling into separate function
The largest part of the code deals with the start of a response. Moving
this into a subfunction makes the function clearer as the switch statement
inside a switch statement is removed.
2019-04-12 09:18:07 +03:00
Markus Mäkelä
746bd53668
Simplify RWBackend result handling
By processing the packets one at a time, the reply state is updated
correctly regardless of how many packets are received. This removes the
need for the clunky code that used modutil_count_signal_packets to detect
the end of the result set.
2019-04-12 09:18:05 +03:00
Markus Mäkelä
e6526dd9ea
Add extra info logging to readwritesplit
Added logging into RWBackend reply state processing code to know more.
2019-04-12 09:17:48 +03:00
Johan Wikman
139651c092 MXS-2253 Runtime ttl changes are made in seconds
Internally durations are stored in milliseconds but runtime changes
using SQL are made in seconds. Consequently, the provided value must
be multiplied by 1000 before being stored.
2019-04-11 15:53:45 +03:00
Timofey Turenko
4128937d37 fix rhel repo copying 2019-04-09 15:33:52 +03:00
Esa Korhonen
74634abc80 MXS-1662 Move PAM authentication function into maxbase
The same code can be used for REST-API authentication.
2019-04-09 14:41:40 +03:00
Timofey Turenko
0ce5f87a91 Add support for RHEL8 repository creation 2019-04-09 13:57:25 +03:00
Markus Mäkelä
bc5f9da6c4
Add classification test case
Also removed the dead code that was never used to get coverage to 100%.
2019-04-09 10:56:38 +03:00
Markus Mäkelä
9a5b60a071
Add forced maintenance mode tests
Tested that the force option works and is accepted.
2019-04-09 10:00:50 +03:00
Markus Mäkelä
0932d10169
Do node checks in parallel
The checking of MariaDB and Galera nodes is now done asynchronously while
the MaxScale check is done which leads to faster testing. Rough
measurements show that doing all the work in parallel reduces test startup
time by two seconds. Most of the time appears to still be in the MaxScale
startup which takes on average three to four seconds per test.
2019-04-09 09:43:19 +03:00
Markus Mäkelä
5e3af05d48
Speed up test startup
The VM connectivity and log truncation is now done in parallel.
2019-04-09 09:43:19 +03:00
Markus Mäkelä
55bb3e9250
Make tests less verbose
The numeric values of the labels aren't of value when inspecting test
results. For this reason, it makes sense to put them behind the verbose
flag to make test framework debugging happen purpose.
2019-04-09 09:43:19 +03:00
Markus Mäkelä
a102efa01f
Backport: Document the force option for set
Added documentation for the new option and mentioned it in the release
notes.
2019-04-09 09:43:19 +03:00
Markus Mäkelä
0cb15976e8
Backport: Add force option to set endpoint
The new `force=yes` option closes all connections to the server that is
being put into maintenance mode. This will immediately close all open
connections to the server without allowing results to return.
2019-04-09 09:43:18 +03:00