13142 Commits

Author SHA1 Message Date
Markus Mäkelä
11814762b5
MXS-1662: Test PAM admin authentication
The test checks that the vagrant user has access to the REST API.
2019-04-17 13:24:59 +03:00
Esa Korhonen
067660e3e7 Merge branch '2.3' into develop 2019-04-16 16:55:12 +03:00
Esa Korhonen
2ca9337da1 Merge branch '2.2' into 2.3 2019-04-16 16:34:57 +03:00
Johan Wikman
8b29e70f63 MXS-2428 Allow fixed Clustrix configuration
If 'dynamic_node_detection' has been set to false, then the
Clustrix monitor will not dynamically figure out what nodes are
available, but instead use the bootstrap nodes as such.

With 'dynamic_node_detection' being false, the Clustrix monitor
will do no cluster checks, but simply ping the health port of
each server.
2019-04-16 13:58:27 +03:00
Johan Wikman
e09a6c8100 MXS-2428 Add 'dynamic_node_detection' 'health_check_port'
'dynamic_node_detection' specifies whether the Clustrix monitor
should dynamically figure out what nodes there are, or just rely
upon static information.

'health_check_port' specifies the port to be used when perforing
the health check ping.
2019-04-16 13:58:27 +03:00
Markus Mäkelä
df3950dbc0
MXS-2349: Amend create server documentation
The explanation for the socket behavior was missing.
2019-04-16 11:52:38 +03:00
Markus Mäkelä
2f243b8f08
MXS-2349: Document socket
Added documentation for the parameter and changed the minimum required
server definition in the REST API.
2019-04-16 11:52:38 +03:00
Markus Mäkelä
0cd00e888e
MXS-2349: Add socket support for maxctrl
A server can now be created with a socket.
2019-04-16 11:52:37 +03:00
Markus Mäkelä
ddf004b733
MXS-2349: Extend REST API tests
Added tests to the REST API that make sure the `socket` parameter works.
2019-04-16 11:52:37 +03:00
Markus Mäkelä
993334b9fd
MXS-2349: Add socket parameter
Servers now accept the `socket` parameter in the configuration as well as
in the REST API.
2019-04-16 11:52:37 +03:00
Markus Mäkelä
70450ce881
MXS-2349: Add support for UNIX domain sockets
Added core functionality for UNIX domain sockets in servers. Currently the
address parameter accepts them both but a separate `socket` parameter is
needed.
2019-04-16 11:52:37 +03:00
Esa Korhonen
5ba305c2c1 MXS-2426 Do not permanently disable automatic cluster operations when they fail
Only disabled for "failcount" monitor ticks. Also turns some related log
messages to notices.
2019-04-16 11:26:34 +03:00
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