4117 Commits

Author SHA1 Message Date
Johan Wikman
5326c8db5c Merge branch '2.2' into develop 2018-02-08 12:48:06 +02:00
Johan Wikman
b15a460416 MXS-1659 Do not include C++ headers from C header 2018-02-08 12:45:18 +02:00
Johan Wikman
6c42221c9c MXS-1654 Prevent crash in debug mode if no master is found 2018-02-07 16:43:13 +02:00
Markus Mäkelä
14a4008c84
MXS-1653: Remove false error message
Removed false error message about failed session commands. An error in
response to a session command is a perfectly valid result.

Also added the explicit commands that the master and slave return to the
warning that is logged when the results differ.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
6dbec397dc
Fix false debug assertion and clarify error message
The debug assertion wasn't well placed as it is perfectly possible that a
master connnection exists but it is not in use. This can be further
checked by asserting that the master is indeed closed and not in use.

Moved the original debug assertion into a separate branch that should
catch any errors in the routing logic.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8558ace801
Clean up ignore_external_masters code
Removed redundant checks and cleared only bits that aren't already
cleared.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8bf756ca56
Update root_master when using a standalone master
When detect_standalone_master is enabled, the root_master variable was not
updated after the master was changed by the standalone server detection
mechanism. This caused debug assertions to fire in addition to possibly
causing some of the ignore_external_masters logic to break.
2018-02-07 16:07:16 +02:00
Esa Korhonen
1cf3de4a74 Add config parameter for excluding servers from failover
"servers_no_promotion" is a comma-separated list of servers
which cannot be chosen when selecting a new master during failover
(auto or manual), or when automatically selecting a new master
for switchover (currently disabled).

The servers in the list are redirected normally and can be promoted
by switchover when manually selecting a new master.
2018-02-07 14:07:10 +02:00
Esa Korhonen
4a478d31f3 Print Gtid IO position during monitor diagnostics 2018-02-05 17:21:20 +02:00
Markus Mäkelä
f6afb0c6d1
MXS-1643: Make Master and Slave status mutually exclusive
The Master status now prevents Slave status from being assigned to a
server. In practice this simply means that the master will not have both
the Master and Slave status bits.
2018-02-05 16:53:43 +02:00
Johan Wikman
099b976773 MXS-1646 Remove non-blocking/timed epoll_wait calls
Since a shutdown message will now be sent via the regular epoll route,
there is no need to regularily wake up from epoll in order to check
whether shutdown has been initiated, but we can simply wait in epoll_wait
until told to wake up.
2018-02-05 10:35:14 +02:00
Markus Mäkelä
771716e9db
Merge branch '2.2' into develop 2018-02-05 10:22:43 +02:00
dapeng
8a0c8e63f2 MXS-199: Support Causal Read in Read Write Splitting (#164)
* MXS-199: Support Causal Read in Read Write Splitting

* move most causal read logic into rwsplit router and get server type from monitor

* misc fix: remove new line

* refactor, move config to right place, replace ltrim with gwbuf_consume

* refacter a little for previous commit

* fix code style
2018-02-05 09:09:18 +02:00
Johan Wikman
e1f1d8e58a Merge branch '2.1' into 2.2 2018-02-02 16:05:14 +02:00
Markus Mäkelä
8c8aaeae8e Prevent double closing of client DCB
If the client is closing the connection but routing the COM_QUIT fails,
the DCB would be closed twice.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
9f0a691233 Always stop the session by closing the client DCB
By always starting the session shutdown process by stopping the client
DCB, the manipulation of the session state can be removed from the backend
protocol modules and replaced with a fake hangup event.

Delivering this event via the core allows the actual dcb_close call on the
client DCB to be done only when the client DCB is being handled by a
worker.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
ebf0d6fc5f Close client DCB with a hangup in the backend protocol
Directly closing the client DCB in the backend protocol modules is not
correct anymore as the state of the session doesn't change when the client
DCB is closed. By propagating the shutdown of the session with a fake
hangup to the client DCB, the closing of the DCB is done only once.

Added debug assertions that make sure all DCBs are closed only
once. Removed redundant code in the backend protocol error handling code.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
7093a5bdf8 Fix CREATE TABLE tokenization
The token skipping function did not check for a period or an opening
parenthesis when parsing the test. Also fixed a debug assertion when only
NULL values were inserted.
2018-02-02 12:24:26 +02:00
Esa Korhonen
a83b36ca45 Use 64 bits for storing server id
In debug mode, when scanning the server id from a string, check that resulting
number is 32bit. Also, when querying the server id, query the global version.
Now, if a super user modifies the server id the monitor will notice it.

Server id:s in gtid:s are handled similarly.
2018-02-02 11:34:32 +02:00
Markus Mäkelä
26d3de7a3b Skip parsing when in read-only transaction
As chages to the transaction state are detected by the protocol level
mini-parser, there's no need to fully classify queries inside read-only
transactions. This should be a good performance boost for loads that
heavily use read-only transactions.
2018-01-31 13:38:45 +02:00
Markus Mäkelä
f53e112bf4 Don't write errors to dummy sessions
If a DCB is closed before a response to the handshake packet is received,
the DCB's session will point to the dummy session. In this case no error
should be written to the DCB.
2018-01-31 13:38:28 +02:00
Esa Korhonen
255250652d Refactor pre-switchover, add similar checks as in failover
Now detects some erroneous situations before starting switchover.
Switchover can be activated without specifying current master.
In this case, the cluster master server is selected.
2018-01-31 10:40:09 +02:00
Markus Mäkelä
ea58b16a7a Add missing include for vector
The vector header was not included in dbfwfilter.hh.
2018-01-30 19:14:28 +02:00
Esa Korhonen
c7474e439e Print new parameters during diagnostics
Also, copy using strdup instead since config_copy_string()
returns null for empty strings.
2018-01-30 18:40:33 +02:00
Markus Mäkelä
3dfb972d87 Merge branch '2.1' into 2.2 2018-01-30 16:28:11 +02:00
Markus Mäkelä
6dcc71d862 MXS-1621: Fix minor bugs caused by previous changes
Used the correct value in table_create_alloc and remove unused
parameter. Use the pre-calculated end pointer when looking for events.
Always use the column count of the TABLE_MAP event as all mismatches are
detected earlier.
2018-01-30 15:59:06 +02:00
Markus Mäkelä
93923acafb MXS-1621: Skip unneeded ALTER TABLE operations
Some ALTER TABLE operations (e.g. ADD INDEX) are not useful to the
avrorouter. These need to be detected and skipped.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
e14710ab2b Fix ALTER TABLE detection regex
The regular expression expected that the COLUMN keyword was always
present.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
df86ee3579 Fix buffer overflow assertions
The buffer overflow assertions were off by one: The data pointer can be
equal to the end pointer when the last column of the row is processed.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
9146a215f7 Fix DDL table identifier parsing
The parsing was inadequate and did not support all forms of quoted
identifiers.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
b7e475f316 MXS-1621: Detect TABLE_MAP ↔ TABLE_CREATE column count mismatch
If the TABLE_MAP and TABLE_CREATE have different column counts, an error
is logged and the row events are skipped.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
c000b3186c MXS-1575: Fix optional COLUMN keywork handling
The COLUMN keyword is optional and cannot be assumed to exist.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
8dfb1d0113 MXS-1621: Add ALTER TABLE ... [FIRST | AFTER col ] parsing
The parser checks whether the FIRST or AFTER keywords are used and, if
AFTER is used, extracts the relevant column name.

Added a test case that checks that the parsing works and detects the
correct column names.
2018-01-30 15:59:05 +02:00
Johan Wikman
6410b4f19a MXS-1633 Turn off collecting of sqlite3 memstats
According to customer reports collecting the statistics has a significant
impact on the performance. As we don't need that information we can just
as well turn off that.

Further, since maxscale-common now links to the sqlite3-library, no
module needs to do that explicitly.
2018-01-30 13:58:37 +02:00
Esa Korhonen
e455e8d43c Simplify monitor start and stop during switchover/failover
If these operations failed, the monitor could be left stopped.
2018-01-29 15:44:32 +02:00
Johan Wikman
0db538db9a MXS-1583 Treat independent 'users' line in OR-fashion
If there are several 'users' lines in a rule file, for a particular
user, the rules each matching line will be checked independently
until a rule match is found.

That is, the rules of each 'users' line are treated in an OR-fashion
with respect to each other.
2018-01-29 15:25:21 +02:00
Esa Korhonen
9ded584836 Check that all slaves use gtid replication before performing failover 2018-01-29 13:33:16 +02:00
Markus Mäkelä
6068850b18 MXS-1627: Only load users that use default auth plugin
The list of users that is used for authentication shoudl only consist of
users that do not use an explicit authentication plugin. This way
authentication fails before any connections to the backend servers are
done.
2018-01-29 13:10:19 +02:00
Johan Wikman
dccf508e54 Merge branch '2.2' into develop 2018-01-29 12:59:06 +02:00
Dapeng Huang
a035c91fa6 add doc for session_track_trx_state and refactor little 2018-01-29 10:16:03 +02:00
Esa Korhonen
e918810a4f MXS-1604: PAMAuth Use "mysql" as default service name, fix authentication data updating
If a user has an empty service name, use "mysql" as default.

Authentication data was only updated inside get_pam_user_services() if no service
was found. It was possible that the PAM service changed but the old service
would be used for authenticating, causing a false negative.

Now, the auth data is updated outside the function if authentication fails for
any reason. The new service data is compared to the old and if equal, password
check is not attempted again. This gives a false negative only if user password
has changed after the previous attempt.

Also, fixed some comments.
2018-01-26 11:00:04 +02:00
Markus Mäkelä
7b04d17ce3 Use correct function for consuming LEncStrings
Length-encoded strings should be consumed with the correct
functions. Doing pointer arithmetic with the same pointer as a parameter
appears to fail only on CentOS 6 whereas on newer systems it performs as
expected.
2018-01-24 20:30:02 +02:00
Markus Mäkelä
dfbecc41e2 Format protocol modules
Formatted the MariaDB protocol modules with Astyle.
2018-01-24 11:20:11 +02:00
Markus Mäkelä
fe73458d65 Merge remote-tracking branch 'ybbct/MXS-1603' into develop 2018-01-24 11:15:14 +02:00
Markus Mäkelä
af70b00197 Merge branch '2.2' into develop 2018-01-24 10:23:51 +02:00
Esa Korhonen
257034bf3e Clarify master failure verification
The two previous functions were somewhat overlapping.
2018-01-23 16:14:50 +02:00
Esa Korhonen
1222d2a400 Use C-string as parameter to fix compile error 2018-01-23 12:28:15 +02:00
Esa Korhonen
0bcae6117d Fix compilation errors by using defines in mysql.h 2018-01-23 12:18:52 +02:00
Markus Mäkelä
c85f83fa2b Fix strcpy overlap in binlogrouter
The source and destination buffers could overlap which is why an
intermediate buffer is required.
2018-01-23 09:26:22 +02:00
Dapeng Huang
73e5fd52fa misc fix and remove all tail spaces 2018-01-22 22:02:22 +08:00