1924 Commits

Author SHA1 Message Date
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
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
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
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
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ä
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ä
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
Markus Mäkelä
d3a77b64c0 Fix response counter discrepancy on retried read
When a read was successfully retried, the original expected response was
not decremented from the reponse counter. This caused one extra response
to be expected for successfully retried reads which caused a hang after a
retried read.
2017-08-17 15:02:16 +03:00
Markus Mäkelä
db8ad7efa8 Fix MXS-1323 regression
The check for session command count on failed session command was inverted
so that only session command failures would be routed to the client.
2017-08-16 13:27:39 +03:00
Markus Mäkelä
5a5ab1fb26 Fix routing of stored queries in error handler
When a session command was executed and the last slave that was executing
dies, readwritesplit would route any pending queries before closing the
slave connection. This could cause a hang if the routing logic decided to
pick the failed server as the target of the stored query.

This fixes the MXS-1323 related regression in the develop branch.
2017-08-16 13:26:46 +03:00
Johan Wikman
de7004cb95 Merge branch '2.1' into develop 2017-08-15 10:31:30 +03:00
geaaru
3485a32731 Fix compilation errors/warning with gcc-5.4.0 (#137)
Warning are like this:
 error: ‘delimiter’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
2017-08-15 09:56:22 +03:00
MassimilianoPinto
bdb0f7d8d7 Binlog server: error message was truncated due to error size computation.
Binlog server: error message was truncated due to error size
computation.
2017-08-14 13:41:04 +02:00
Johan Wikman
4798810f76 Merge branch '2.1' into develop 2017-08-14 10:36:34 +03:00
MassimilianoPinto
7da092843f MXS-1343: send hostname to master with COM_REGISTER_SLAVE
A new option ‘slave_hostname’ allows the setting of hostname in
COM_REGISTER_SLAVE.

SHOW SLAVES HOSTS; in master server can show the hostname set in binlog
router:

MariaDB [(none)]> SHOW SLAVE HOSTS;
+-----------+-----------------------------+------+-----------+
| Server_id | Host                        | Port | Master_id |
+-----------+-----------------------------+------+-----------+
|        93 | maxscale-blr-1.mydomain.net | 8808 |     10124 |
+-----------+-----------------------------+------+-----------+
2017-08-09 17:09:50 +02:00
Markus Mäkelä
512c3c018d Add recycling of destroyed monitors
If a destroyed monitor is created again, it will be reused. This should
prevent excessive memory growth when the same monitor is created and
destroyed again.
2017-08-09 11:39:24 +03:00
MassimilianoPinto
b9588a89ac MXS-770: Removed support for PURGE BINARY LOGS without TO option.
PURGE BINARY LOGS doesn’t exist in MySQL/ MariaDB without options.

MaxScale binlog router supports only PURGE BINARY LOGS TO ‘file’
2017-08-08 10:02:48 +02:00
MassimilianoPinto
a9b0eb791b MXS-770: PURGE BINARY LOGS, minor improvements.
PURGE BINARY LOGS, minor improvements.
2017-08-07 10:26:28 +02:00
MassimilianoPinto
113d2ad87a MXS-770 Addition of PURGE BINARY LOGS feature
PURGE BINARY LOGS; deletes all files in binlogdir and GTID maps repo
but keeps current binlog file.

PURGE BINARY LOGS TO ‘file’; deletes all files in binlogdir and GTID
maps repo up to specified file.

mariadb10_slave_gtid=On option is needed in order to keep the list of
binlog files.
2017-08-07 10:26:28 +02:00
MassimilianoPinto
75b17151f3 Removed FULL option from SHOW BINARY LOGS
If option ‘binlog_structure’ is set to ‘tree’ then SHOW BINARY LOGS
displays the tree details of the binlog files.

MySQL [(none)]> SHOW BINARY LOGS;
+--------------------------+-----------+
| Log_name                 | File_size |
+--------------------------+-----------+
| 0/10122/mysql-bin.000117 |      1167 |
| 0/10122/mysql-bin.000118 |       652 |
| 0/10124/foo-bin.000016   |      5082 |
| 0/10124/foo-bin.000017   |       491 |
+--------------------------+-----------+

With option set to ‘flat’ (which is the default) the output contains
only
names:

MySQL [(none)]> SHOW BINARY LOGS;
+------------------+-----------+
| Log_name         | File_size |
+------------------+-----------+
| mysql-bin.000110 |       425 |
| mysql-bin.000111 |     10409 |
| mysql-bin.000112 |      9659 |
+------------------+-----------+
2017-08-04 10:08:11 +02:00
MassimilianoPinto
ae5eb004fe SHOW [FULL] BINARY LOGS is now able to report the same log file in use with different server_ids
SHOW [FULL] BINARY LOGS is now able to report the same filename in use
with different server_ids: this can happen with binlog_structure=tree

example from SHOW FULL BINARY LOGS

0/10122/mysql-bin.000113
…
0/10122/mysql-bin.000116
…
0/5306/mysql-bin.000113

SHOW BINARY LOGS shows the same file twice:

mysql-bin.000113
…
mysql-bin.000116
…
mysql-bin.000113
2017-08-03 11:11:37 +02:00