3573 Commits

Author SHA1 Message Date
Markus Mäkelä
1e90b3623b MXS-1346: Disallow convoluted rule names
The rule names could have punctuation in them which caused unnecessary
complexity. Keeping the identifiers simple makes it easier to process.
2017-09-08 09:31:35 +03:00
Markus Mäkelä
b9302f11cc MXS-1346: Minor cleanup of grammar rules
Cleaned up the grammar rules by splitting long lines at roughly 80
characters and removed the redundant code for the columnlist type.
2017-09-08 09:31:35 +03:00
MassimilianoPinto
c239477630 MXS-1387: checking slave connection in COM_BINLOG_DUMP phase
MXS-1387: checking slave connection in COM_BINLOG_DUMP phase
2017-09-06 15:09:50 +02:00
MassimilianoPinto
795722506b MXS-1387: check if MariaDB 10 Slave has GTID request set.
MXS-1387: check if the connecting MariaDB 10 Slave has the GTID request
set and return error code which stops replication.
2017-09-06 11:13:15 +02:00
Johan Wikman
84300c6d97 Do not manipulate read queue directly
Protocol modules should not manupulate the read queue directly,
but always access it via the functions created for that purpose.
2017-09-06 11:21:47 +03:00
MassimilianoPinto
ff94a39038 Binlog server: fix closing slave connections called by MySQL admin connection
Binlog server: fix closing slave connections called by MySQL admin
connection
2017-09-04 15:23:24 +02:00
MassimilianoPinto
4c5f0d184c Binlog server: force fake Client DCB close in errorReply
Binlog server: force fake Client DCB close in errorReply. This fixes an
issue when START SLAVE, with new config, is called after a previous one
with errors.
2017-09-04 15:23:24 +02:00
MassimilianoPinto
0a1608d90d Log proper message in errorReply when master state is BLRM_SLAVE_STOPPED
Log proper message in errorReply when master state is BLRM_SLAVE_STOPPED
2017-09-01 16:48:20 +02:00
MassimilianoPinto
85f395394b Connection retry limit minor changes
Connection retry limit minor changes
2017-09-01 13:52:40 +02:00
MassimilianoPinto
9230420872 The blr_master_close() is now called in the main worker thread.
The blr_master_close() is now called in the main worker thread by:
blr_stop_slave() and blr_stop_start_master()
2017-09-01 11:49:27 +02:00
MassimilianoPinto
cfe06a563e Remove saving/updating GTID repo when maxscale starts
Remove saving/updating GTID repo when maxscale starts.
The repo update slows down the maxscale startup.
The saving was added in order populate GTID repo with current file but
it costs extra time to event validation routine when current binlog has
many events and it has a big size.
2017-08-31 17:27:52 +02:00
MassimilianoPinto
e1efb91ea5 MXS-1156: MASTER_CONNECT_RETRY is a new option for CHANGE MASTER TO
MXS-1156: MASTER_CONNECT_RETRY is a new option for CHANGE MASTER TO.

The ‘connect_retry’, ‘master_retry_count’ options are now in use for
both service and
router_options.
2017-08-31 11:01:03 +02:00
MassimilianoPinto
42833386f5 MXS-1156: added configuration entry point for connection retry parameters.
MXS-1156: added configuration entry points for connection retry
parameters.

Variable names have been also changed.
2017-08-31 11:01:03 +02:00
MassimilianoPinto
c91187d4de MXS-1156: added limit to master connect retry
MXS-1156: added limit to master connect retry
2017-08-31 11:01:03 +02:00
MassimilianoPinto
3c7a0014a9 MXS-1156: Store master_heartbeat_period in master.ini
MXS-1156: Store master_heartbeat_period in master.ini
2017-08-31 11:01:03 +02:00
MassimilianoPinto
0f5f9f8228 MXS-1156: Disable heartbeat if value is set to 0
MXS-1156: Disable heartbeat if value is set to 0.

A warning log is written in maxscale log file when heartbeat is not set.
2017-08-31 11:01:03 +02:00
MassimilianoPinto
5b2cfac3cb MXS-1156: Added new option MASTER_HEARTBEAT_PERIOD to CHANGE MASTER TO
MXS-1156: Added new option MASTER_HEARTBEAT_PERIOD to CHANGE MASTER TO
2017-08-31 11:01:03 +02:00
Markus Mäkelä
e6f78bfcb3 Pass modutil function state as a struct
This allows the type to change without changing it at the call sites.
2017-08-29 22:46:35 +03:00
Markus Mäkelä
13f7015e7b Fix EOF packet calculation for large rows
The EOF packet calculation function in modutil.cc didn't handle the case
where the payload exceeded maximum packet size and could mistake binary
data for a ERR packet.

The state of a multi-packet payload is now exposed by the
modutil_count_signal_packets function. This allows proper handling of
large multi-packet payloads.

Added minor improvements to mxs1110_16mb to handle testing of this change.
2017-08-25 17:00:42 +03:00
Johan Wikman
9c25e6d995 MXS-1376 All zombie related code removed
As dcbs are now closed when dcb_close() is called and there is
no zombie queue, the zombie state can also be removed.
2017-08-25 14:48:16 +03:00
Markus Mäkelä
894ef3d3a9 MXS-1346: Compile dbfwfilter as C++
Compile the dbfwfilter as C++ to allow STL container usage.
2017-08-25 13:54:10 +03:00
MassimilianoPinto
8927298abe MXS-1075: Avoid loops when missing binlog file is detected.
MXS-1075: Avoid loops when missing binlog file is detected.
2017-08-24 16:03:30 +02:00
Johan Wikman
ad4e8dad94 MXS-1364 Drop the usage field
But for the most trivial statements did not really provide
useful information.

The arguments of the "function" '=' are now reported.
2017-08-24 09:58:18 +03:00
Markus Mäkelä
c05bb3593a MXS-1346: Take the new query classifier features into use
The function usage by column is now used by the dbfwfilter. This finishes
the implementation of blocking function usage per column.
2017-08-24 09:46:03 +03:00
Markus Mäkelä
da74ebb959 Add error string helper function to dbfwfilter
The helper function is a wrapper for snprintf and strdup which removes
some of the redundant code in dbfwfilter.
2017-08-24 09:46:02 +03:00
Markus Mäkelä
ae2b9fd30d Fix hang with queries larger than 2^24 bytes
Readwritesplit didn't track multi-packet queries which resulted in them
being confused for pipelined queries.
2017-08-24 09:46:02 +03:00
Markus Mäkelä
2ef9fbc47a MXS-1346: Add uses_function type rule
The uses_function type rule matches when any of the columns given as
values uses a function. With this, columns can be denied from being used
with a function.
2017-08-24 09:46:02 +03:00
MassimilianoPinto
0aa1b8a4d0 MXS-1344: MySQL monitor detects MaxScale Binlog Server
If MaxScale Binlog Server is detected by MySQL monitor, then Server
status is ‘Relay Master, Running’ without ‘Slave’: this way Binlog
Server cannot be used by any statement routing.
Additionally SELECT for replication lag is skipped as well.
2017-08-23 14:11:17 +02:00
MassimilianoPinto
1c4ae9f89a MXS-1344: Allow SET SQL_MODE='' statement from mysql monitor
When SET SQL_MODE='' statement is received from mysql monitor an OK
packet is sent.
2017-08-23 14:11:16 +02:00
MassimilianoPinto
965173dd88 MXS-1344: Binlog server reports real master id and its server id in monitor queries
MXS-1344: Binlog server reports the real master id in SHOW SLAVE STATUS
| SHOW ALL SLAVES STATUS, no matter the value of ‘master_id’ identity
parameter.

Binlog server report its own server id or the identity value of
‘master_id’ in MySQL monitor query SELECT @@global.server_id,
@@read_only;

Note: SELECT @@global.server_id (no other fields) still reports the
real master server id or the value set in ‘master_id’
2017-08-23 14:11:16 +02:00
Markus Mäkelä
ae5260bec7 MXS-1288: Deprecate reload config
The `reload config` command is now deprecated. The same functionality can
be found in the MaxScale REST API.
2017-08-22 21:15:12 +03:00
Markus Mäkelä
655f8b9170 Close binlogrouter connections in thread 0
The internal connections of the binlogrouter should be closed in the same
thread that created them. This should be the "main" thread, i.e. thread 0,
that starts the original binlogrouter service.
2017-08-21 20:30:36 +03:00
Markus Mäkelä
cc8fb995cd MXS-1354: Make new users backwards compatible
The `add user` and `enable account` commands create fully privileged
administrative users like they did in 2.1. This makes the addition of
read-only users backwards compatible.

Updated and expanded the documentation on administrative interface
users. Added entries into the release notes as well as the upgrading
document about relevant changes between 2.1 and 2.2.
2017-08-19 09:27:15 +03:00
MassimilianoPinto
7c296d746f Binlog server: handle filestem in blr_handle_missing_files()
Routine blr_handle_missing_files() is called by
blr_handle_fake_rotate().

Field ‘filestem’ is updated in order to avoid wrong file name creation.

Additionally router is not creating any missing filenames if
router->binlog_name is empty (no previous binlog files)
2017-08-18 09:45:24 +02:00
Markus Mäkelä
6cc3986db5 MXS-1354: Prevent removal of last admin account
Removing the last admin account is now forbidden. This should prevent most
cases where users could lock themselves out of the administrative
interface.

This change does allow a non-root network user to be the last admin
account. In practice this does not prevent the root user from gaining
access to maxadmin. Access can be gained by removing the users file and
restarting MaxScale or by editing the users file by hand.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
828649ba99 MXS-1354: Add user authorization to maxadmin
All commands that modify the internal state of MaxScale now require admin
level authorization.
2017-08-18 10:28:21 +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ä
ec045b7ab6 MXS-1354: Add creation of basic user via MaxAdmin
MaxAdmin can now create basic users for both network and UNIX domain
socket use. Currently the basic and admin types have the same permissions
in maxadmin but for the REST API, only admin accounts can modify MaxScale.
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ä
253d6d211f MXS-1354: Allow creation of basic users
The type of the user being created is defined at creation time. This
allows the creation of basic users.

Although the users can be created internally, they cannot yet be created
via maxadmin or the REST API.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
af4e852649 MXS-1354: Take refactored users into use
The refactored interface is now in use. The only module that used it
directly was the CDC protocol module. This should probably be changed so
that it uses the adminusers interface instead of the users interface
directly.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
ca4dbf5d0d Refactor readwritesplit connection creation
The connections for a router session can now be done without a constructed
router session. This simplifies the creation of new router session by
removing the need to handle memory allocations.

Readwritesplit router sessions are now created in the static `create`
function which handles the actual creation of the connections and
allocation of the session itself.
2017-08-18 10:27:49 +03:00
Markus Mäkelä
46b7db1d45 Refactor readwritesplit session creation
Moved the initialization of the router session's member variables into the
constructor. Changed two functions that calculated server counts into the
router instance as they don't relate to a particular session.
2017-08-18 10:27:49 +03:00
Markus Mäkelä
55c704a3dd Ignore repeated errors
Only the first error for each DCB should invoke the error handler
routine. All other errors for the same DCB should be ignored.

In practice this appears to happen when epoll return two different types
of error events for the same DCB.
2017-08-18 10:27:28 +03:00
Markus Mäkelä
727b4baa86 Fix application and exemption of masking rules to users
The applies_to and exempted values were only evaluated if both of them
were present.
2017-08-18 10:27:28 +03:00
Markus Mäkelä
6c5ae24dff Fix out-of-bounds reads with LOAD DATA LOCAL INFILE
When a LOAD DATA LOCAL INFILE is done, the last packet is an empty packet
which does not contain the command byte. Some parts of the MySQL protocol
modules expected that a command is always present. The proper way to
handle this is to use the mxs_mysql_get_command function which does bounds
checking.
2017-08-18 10:27:28 +03:00
Markus Mäkelä
d723201d22 Add missing list terminator in debugcmd.c
The pingoptions list of commands was not terminated by an EMPTY_OPTION
value.
2017-08-17 15:05:19 +03:00
Markus Mäkelä
6bdd959f6c Reset client DCB pointer after closing it
The client DCB was not reset in one of the cases where it was closed.

Also fixed use of overlapping memory addresses in strcpy.
2017-08-17 15:04:37 +03:00
Markus Mäkelä
71ca174313 Reset master DCB pointer if it is closed
If the master DBC is closed, the pointer should be set to NULL as it is
used to check whether the connection is still valid.
2017-08-17 15:04:37 +03:00