91 Commits

Author SHA1 Message Date
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
96ed651466
Merge branch '2.2' into develop 2018-06-11 11:28:36 +03:00
Markus Mäkelä
1a24f0a956
Merge branch '2.1' into 2.2 2018-06-11 10:36:57 +03:00
Markus Mäkelä
0d73530ff3
Merge branch '2.2' into develop 2018-06-08 11:30:55 +03:00
Markus Mäkelä
a7dd2127d6
Merge branch '2.1' into 2.2 2018-06-08 11:21:35 +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
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
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ä
490d8c0963
Merge branch '2.2' into develop 2018-04-30 12:38:19 +03:00
Markus Mäkelä
bbe59732d8
MXS-1831: Return error on invalid monitor parameter
If a parameter that is not declared by the monitor is altered, an error is
returned instead of it being silently added to the monitor parameters.
2018-04-27 12:38:42 +03:00
Esa Korhonen
5d010ff712 Cleanup SERVER struct
Removed one unused field. Rearranged others, clarified comments.
2018-04-27 10:48:56 +03:00
Markus Mäkelä
b33f464eea
MXS-1506: Make heartbeat reads atomic
The old hkheartbeat variable was changed to the mxs_clock() function that
simply wraps an atomic load of the variable. This allows it to be
correctly read by MaxScale as well as opening up the possibility of
converting the value load to a relaxed memory order read.

Renamed the header and associated macros. Removed inclusion of the
heartbeat header from the housekeeper header and added it to the files
that were missing it.
2018-04-10 15:29:29 +03:00
Markus Mäkelä
a44e352f4f Fix default protocol module names for objects
If either a server or a listener was created at runtime, it would use the
old protocol module name and log a warning.
2018-01-15 16:14:50 +02:00
Markus Mäkelä
396b81f336 Fix in-source builds
The internal header directory conflicted with in-source builds causing a
build failure. This is fixed by renaming the internal header directory to
something other than maxscale.

The renaming pointed out a few problems in a couple of source files that
appeared to include internal headers when the headers were in fact public
headers.

Fixed maxctrl in-source builds by making the copying of the sources
optional.
2017-11-22 18:40:18 +02:00
Markus Mäkelä
07e58444f6 Improve error message for zero monitor timeout values
The error message was not 100% accurate about the value. In addition to
that, neither the value itself nor the monitor or parameter names were
printed in the error message.
2017-11-17 18:05:03 +02:00
Johan Wikman
3a35d49ffe Merge branch '2.2' into 2.2-mrm 2017-11-08 10:44:35 +02:00
Johan Wikman
b1b78a5be7 Remove references to QUEUE_CONFIG
Only used in conjunction with queued connections, which are not
enabled anyway. Once that comes on the table again, better to use
some standard data structures.
2017-11-08 10:44:14 +02:00
Markus Mäkelä
3a78b716b8 Merge branch '2.2' into 2.2-mrm 2017-10-30 11:06:34 +02:00
Markus Mäkelä
551bb81929 Loosen the atomicity requirement for the passive parameter
As the passive parameter is only used by the failover and the failover can
only be initiated by the monitor, there is no true need to synchronize the
reads and write of this parameter.

As all runtime changes are protected by the runtime lock, only partial
reads are of concern. For the supported platforms, this is not a practical
problem and it only confuses the reader when other variables are modified
without atomic operations.
2017-10-27 15:31:46 +03:00
Markus Mäkelä
2d1e5f46fa Remove use of timestamps in failover code
Using timestamps to detect whether MaxScale was active or passive can
cause problems if multiple events happen at the same time. This can be
avoided by separating events into actively observed and passively observed
events. This clarifies the logic by removing the ambiguity of timestamps.

As the monitoring threads are separate from the worker threads, it is
prudent to use atomic operations to modify and read the state of the
MaxScale. This will impose an happens-before relation between MaxScale
being set into passive mode and events being classified as being passively
observed.
2017-10-27 15:31:46 +03:00
Markus Mäkelä
6918842585 Add direct relationship updating to REST API
The JSON API specification states that all resources must support direct
modification of resource relationships by providing only the definition
for a particular relationship type to a /:type/:id/relationships/:type
endpoint.

The relevant part of the JSON API specification:

    http://jsonapi.org/format/#crud-updating-to-many-relationships
2017-10-23 19:37:24 +03:00
Markus Mäkelä
d371ecb30f Only remove explicitly deleted relationships
Only when a relationship is defined as a null JSON value, it should be
deleted. If it is missing, it should be ignored.
2017-10-23 19:37:24 +03:00
Markus Mäkelä
0b1e2ae0a5 Improve error messages for service parameter changes
Made the error messages clearer when an attempt to change service
parameters that cannot be altered at runtime is made.
2017-10-23 17:34:11 +03:00
Johan Wikman
438b4e0341 Merge branch '2.2' into 2.2-mrm 2017-10-02 15:49:08 +03:00
Johan Wikman
68432bbaa3 Rename MXS_MONITOR::databases to MXS_MONITOR::monitored_servers
More descriptive name. Some local varaibles could now also be
renamed to be more descriptive, but that's for another day.
2017-10-02 15:33:58 +03:00
Johan Wikman
89d1f81e37 Merge branch '2.2' into 2.2-mrm 2017-09-28 15:19:20 +03:00
Markus Mäkelä
e55968b808 Fix listener creation via REST API
The check for SSL parameters was wrong as it tested whether all SSL
parameters were defined even when the check was not needed.
2017-09-28 13:03:04 +03:00
Markus Mäkelä
d4fd34cecd MXS-1446: Move failover parameters into mysqlmon
The `failover` and `failover_timeout` parameters are now declared as a
part of the mysqlmon module. Changed the implementation of the failover
function so that the dependencies on the monitor struct can be removed or
moved into parameters.
2017-09-28 08:23:34 +03:00
Markus Mäkelä
895d950da0 Format all source files with Astyle
Formatted all source files Astyle.
2017-09-28 07:04:21 +03:00
Markus Mäkelä
4c3d6f6884 MXS-1446: Add execution of dummy failover command
The failover command is simulated by executing a call to /usr/bin/echo
with all possible monitor parameters. This allows testing of the failover
mechanism without actually using the failover command.
2017-09-27 19:44:21 +03:00
Markus Mäkelä
316f792242 MXS-1446: Make failover_timeout configurable
The time that MaxScale waits for a failover is now configurable.
2017-09-27 19:37:41 +03:00
Markus Mäkelä
ef2ee38ccf MXS-1446: Store more detailed event information
The timestamp of the last change from passive to active is now
tracked. This, with the timestamps of the last master_down and master_up
events, allows detection of cases when MaxScale was failed over but the
failover was not done.

Currently, only a warning is logged if no new master has appeared within
90 seconds of a master_down event and MaxScale was set to active from
passive.

The last event and when the event was triggered is now shown for all
servers. The latest change from passive to active is also shown.
2017-09-27 19:32:58 +03:00
Markus Mäkelä
1d2ba10a68 MXS-1446: Add passive parameter
The `passive` parameter can be given in the configuration file or on the
command line. It is displayed in the diagnostic output and changes to it
are persisted.

The variable itself does nothing.
2017-09-27 19:32:58 +03:00
Markus Mäkelä
f20005dddc Add missing parameters to alter monitor
The `script_timeout` and `journal_max_age` parameters weren't handled in
the monitor alteration code.

Also added missing documentation to maxadmin help output for
`alter monitor`.
2017-09-27 19:26:05 +03:00
Johan Wikman
02b9e0a01d Merge branch '2.1.7' into develop-2.1-merge 2017-09-12 11:08:02 +03:00
Markus Mäkelä
730072e2ef Add format checks for printf-style functions
Added format checks to functions that expect printf style arguments and
fixed any broken calls to these functions.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
486024aaf4 MXS-1390: Add missing SSL parameter processing to servers resource
Added missing SSL parameters to servers resource output as well as added
the processing of these parameters when servers are created. It is
preferable to define servers as either encrypter or plain and to prevent
the modification of this at runtime.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
3d5ac7e32d Clean up variable types in config_runtime.cc
Used std::string and created a typedef for std::set<std::string>.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
9f81f0775f MXS-1354: Rename user account type enum
Renamed the enum and its values.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
9d24a63c10 MXS-1354: Add user account types to REST API
The user accounts can now be created with a specific account type. This
allows read-only users to be created for the REST API.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
2708942762 MXS-1354: Store users in a new format
The users are now stored as an array of JSON objects. Legacy users are
automatically upgraded once they are loaded and a backup of the original
users file is created.

Removed the password parameter from the `remove user` maxadmin command as
well as all of the relevant functions. Requiring that an administrator
knows the password of the account to be deleted is not a sound requirement
now that, at least in theory, two types of accounts can be created.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
e627740777 MXS-1354: Enable muting of admin interface authentication failures
The warnings generated by the admin interface can now be silenced.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
c2a2688b93 Fix duplicate listener checks
Only the protocol, port and address of the listener were used to check if
a listener exists. The check should also use the name of the listener to
be sure that each name is unique.

Expanded tests to check that the creation of duplicate listeners is
detected. Did minor improvements to related test code.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
1b65bd2a9d Improve runtime listener creation error messages
The error messages for listener creation are now more detailed. In
addition to this, they are also conveyed to the runtime error system.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
d2543c4841 Fix refactoring errors
The monitor deletion would mistakenly label all monitors as not being
created at runtime. Due to this, the deletion of monitors would fail.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
05d185fc02 Fix monitor repurposing
The monitor active state is now modified under the same lock. This should
make creation and destruction of monitors deterministic.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
1743f4c1b7 Handle server repurposing under a lock
By moving the repurposing of the servers under the global server lock, the
repurposing of a server and allocation of a new server behave in the same
way.

Also fixed the wrong error message on server creation failure referring to
invalid server relationships.
2017-08-09 11:39:24 +03:00