Commit Graph

356 Commits

Author SHA1 Message Date
64d25a48bd Merge commit 'a60bd376108f71fccf40001c1496f32c11137fe4' into develop 2019-06-18 15:51:17 +03:00
6cbe9d1258 MXS-2550: Fix default module parameters
The parameters weren't processed when they were added from the module
defaults.
2019-06-18 07:06:51 +03:00
6166da76ea Add arguments to mxb_assert_message
The macro can now be used to print runtime information in a printf-like
manner. This makes it easier to see exactly why an assertion has failed.
2019-06-11 21:30:45 +03:00
53606934a6 Merge branch '2.3' into develop 2019-06-11 16:35:26 +03:00
95606370c8 MXS-2551 Do not print deprecated parameters into serialized config files
In MaxScale, a "deprecated" parameter is not in use and can be ignored.
Leaving the parameters out of serialized configuration files avoids warning
messages.
2019-06-11 15:55:35 +03:00
4efa9dbeea Remove maxscale/alloc.h
The remaining contents were moved to maxbase/alloc.h.
2019-06-10 14:11:25 +03:00
e078f95a42 MXS-1550 Add net_write_timeout paramater for service
net_write_timeout is used to timeout writes take too long.
2019-06-10 10:31:35 +03:00
dda2c1964d Merge commit '05ed272c1627b21ff623b7fdf5a60f2ba2f4f5d0' into develop 2019-05-27 19:30:29 +03:00
eda547c86f MXS-1851: Add hard-coded protocol module check
This way a hard to track crash is avoided and the user knows how to fix
it.
2019-05-24 13:55:43 +03:00
4e2d350838 MXS-2483: Return std::unique_ptr from SSLContext::create
Smart pointers are far nicer than raw pointers.
2019-05-24 10:05:43 +03:00
68ad51bc52 MXS-2483: Address review comments 2019-05-20 15:46:53 +03:00
c78e907da0 MXS-2483: Minor SSL usage cleanup
Changed getter function return values to std::string, converted
MXS_CONFIG_PARAMETER::set_from_list to take std::strings instead of const
char pointers.
2019-05-20 15:45:19 +03:00
82add11e86 MXS-2483: Take SSLContext into use
SSLContext is now used everywhere except the binlogrouter which still
allocates the contexts itself. Fixing the binlogrouter's misuse of
internal structures is a rather large undertaking and for this reason the
SSLContext will be taken into use there in a separate commit.
2019-05-20 15:45:18 +03:00
73796be9d6 MXS-2483: Make SSLContext a C++ class
The class now encapsulates all the functionality that is related to
setting up a SSL context.
2019-05-20 15:45:18 +03:00
cab336ed89 MXS-2483: Rename SSL_LISTENER to mxs::SSLContext 2019-05-20 15:45:18 +03:00
5077ad62df Move monitor runtime modification functions to MonitorManager
Requires moving some general configuration checking functions to
config.cc.
2019-05-10 14:48:41 +03:00
50b5fe76ef Pass parameters as const ref to server_alloc 2019-05-10 09:21:52 +03:00
3813c728b1 Move listener parameter handling into Listener::create
The Listener::create method now takes a set of configuration parameters
from which it constructs a listener. This removes the duplicated code and
makes the behavior of listener creation similar to other objects in
MaxScale. It also allows the configuration parameters to be stored in the
listener object itself.
2019-05-10 09:21:52 +03:00
4e6ffc0381 Clean up server config parameter handling
Removes helper classes which are no longer required.
2019-05-07 15:39:34 +03:00
95fd61b8dc Fix listener search functions
The functions that searched for listeners compared both sockets and
addresses in the same function. This made its use error prone and caused
false positives in some cases.
2019-05-06 19:55:31 +03:00
6b8ca35408 Format core source files
Formatted core .cc files according to current uncrustify configuration.
2019-05-06 16:05:50 +03:00
5ac24de6b0 Remove log_to_shm
The feature was removed in 2.3 and was ignored if configured.
2019-05-06 16:05:50 +03:00
bc654849e8 Fix duration JSON representation
Duration values converted to JSON are now again returned as integers. This
keeps the REST API backwards compatible until suffixed durations are no
longer supported at which point all duration values can be represented in
milliseconds.
2019-05-02 16:54:19 +03:00
59be841939 MXS-2414: Rename max_auth_failures to max_auth_errors_until_block 2019-04-30 14:49:36 +03:00
db0e491ace MXS-2414: Add max_auth_failures parameter
The parameter controls how many authentication failures are allowed until
the host is blocked. The default is 10 failures per thread.
2019-04-30 14:49:35 +03:00
d1ab4fcb89 MXS-2329 Fix missing duration type 2019-04-30 14:31:47 +03:00
82b4338eca Remove MonitorManager calls from Monitor functions
Also adds admin thread checks to MonitorManager functions and combines
anonymous namespaces.
2019-04-30 13:45:48 +03:00
2115322737 MXS-2329 Change warning into info
Currently it's too laborious to use duration suffixes when saving
generated configs and also to handle suffixes when changes are made
dynamically using maxctrl.

It will be trivial to do that when the new configuration mechanism
has been taken into use everywhere. That will not happen before
MaxScale 2.5.

So, in MaxScale 2.4 duration suffixes will be accepted in manually
created configuration files, but no warning will be logged if a
suffix is not used.
2019-04-30 13:02:53 +03:00
c60c5e4626 MXS-2329 Use durations in monitor (common parts) 2019-04-30 13:02:53 +03:00
ca51316364 MXS-2329 0 is a valid duration, with or without a suffix 2019-04-30 13:02:53 +03:00
b1a495b342 MXS-2329 Use durations with persistmaxtime 2019-04-30 13:02:53 +03:00
93e130bb48 MXS-2329 Use durations with max_retry_interval 2019-04-30 13:02:53 +03:00
75fbcc9393 MXS-2329 Use durations in log_throttling 2019-04-30 13:02:53 +03:00
9fb4116bf5 MXS-2329 Use durations with connection_timeout 2019-04-30 13:02:53 +03:00
638debcdc0 MXS-2329 Allow the restriction of duration units
It's now possible to specify in the config parameter declaration
that the smallest allowed unit is seconds. For parameters whose
granularity is seconds, allowing to specify a duration in
milliseconds would open up a possibility for hard to detect errors.
2019-04-30 13:02:53 +03:00
8a250a8b13 MXS-2329 Make duration misuse harder
Now the desired type must be specified when getting a duration.
The type also dictates how durations without suffixes should be
interpreted.

That removes the need for remembering that to convert a returned
millisecond duration to a second duration.
2019-04-30 13:02:53 +03:00
8bf0e00b1c MXS-2329 Use duration with users_refresh_time 2019-04-30 13:02:53 +03:00
3055e49f5a MXS-2329 Use durations with query_retry_timeout
Also change auth_[connect|read|write]_timeout to be time_t.
2019-04-30 13:02:53 +03:00
92cc31f0c0 MXS-2329 Use durations with auth_[connect|read|write]_timeout 2019-04-30 13:02:53 +03:00
4186f39616 Merge branch '2.3' into develop 2019-04-23 12:11:09 +03:00
61f728c05a MXS-2433: Reduce default query classifier cache size
Reduced the default cache size from 40% to 15%. Most cases don't benefit
from that much memory and the defaults have caused problems in live
environments.
2019-04-17 16:07:04 +03:00
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
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
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
c643f9bc8d Merge branch '2.3' into develop 2019-04-12 13:23:49 +03:00
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
7fb840ac9e Sort CN_ definitions 2019-04-09 09:43:18 +03:00
aad29404c6 Fix parameter value error
The argumets were given in the wrong order.
2019-04-05 13:33:16 +03:00
b54e67223f MXS-2423: Add missing parameters to maxscale endpoint
Also updated the REST API documentation to include the newer output
(automating this update would be valuable).
2019-04-05 13:33:16 +03:00
2aa3515fc8 Merge commit '09cb4a885f88d30b5108d215dcdaa5163229a230' into develop 2019-04-04 14:34:17 +03:00