3928 Commits

Author SHA1 Message Date
Esa Korhonen
7ed9172496 MXS-1533: Rejoin also when the old master cannot be connected
Previously, the rejoin would only be ran on servers with a connected slave io
thread. This patch runs the rejoin also on slaves which cannot connect to a
downed old master while the master hostname or port differs from the current
cluster master server.
2017-12-18 13:04:47 +02:00
Johan Wikman
b6e983c0b5 Change default value of detect_standalone_master
The default value was changed from false to true.
2017-12-13 13:18:44 +02:00
Markus Mäkelä
79afaa447e Merge branch '2.1' into 2.2 2017-12-12 13:23:02 +02:00
Markus Mäkelä
4b9bb9e65f Assign service pointer in BLR DCBs
The DCBs that were manually allocated by the binlogrouter were not
assigned the service pointers.
2017-12-12 08:47:02 +02:00
Markus Mäkelä
66be882ae0 Don't reload users for dummy sessions
The service for a dummy session will be NULL. If authentication fails for
a dummy session, then no service level actions should be taken.

Only the binlogrouter can trigger authentication failure with a dummy
session as it creates connections before the service itself has started.
2017-12-11 12:31:40 +02:00
Esa Korhonen
b29a8eb4f8 MXS-1513: Flush logs before tables during switchover_demote_master
In this order, the new binary log file will have 1 event instead of 0.
In total, only 1 event is added.
2017-12-08 12:28:50 +02:00
Markus Mäkelä
8ed1ff67c2 Fix avro regression
The fact whether a query explicitly defined a query was ignored by the
statement parsing function and it always assumed the database was
explicitly defined. This caused the TABLE keyword in a CREATE TABLE
statement to be falsely identified as the current database.
2017-12-07 13:19:06 +02:00
Esa Korhonen
c6daf8c26b MXS-1513: More accurate error messages
The failed query is now printed.
2017-12-07 10:54:30 +02:00
Esa Korhonen
b2bc087508 MXS-1491: Print failcount
Failcount is now printed in "show monitors". Also, when master goes down
but failover does not yet happen because failcount > 1, a message is
logged.
2017-12-07 10:05:45 +02:00
Markus Mäkelä
eda700e785 Don't use sqlite3_errstr
The function is not defined in older versions.
2017-12-05 13:49:00 +02:00
Markus Mäkelä
97d41e6ca0 MXS-1555: Never explicitly assign the readqueue
The readqueue should never be explicitly assigned and should only ever be
appended to. This guarantees that the packets are read and processed in
the correct order.

Also removed an unused function that deals with the readqueue
manipulation.
2017-12-05 12:09:52 +02:00
Markus Mäkelä
6f185ff5db MXS-1555: Fix persistent pool qualification
When packets were routed individually, the qualification for the
persistent pool was done before the current command was updated. In
addition to this, the previous commit doesn't seem like it can even build.
2017-12-05 12:09:52 +02:00
Markus Mäkelä
c03ce7ac7f Use correct database name for SQLite
The :memory: database was misspelled as :memory without the trailing
colon. This caused an actual on-disk database to be created instead of an
in-memory one.
2017-12-05 09:43:06 +02:00
Markus Mäkelä
4194c1c558 MXS-1539: Preliminary implementation of thread-local user cache
The thread-local user cache removes most of the cross-thread communication
from the user authentication at the cost of increased memory use and extra
network usage when users are loaded.
2017-12-05 09:43:05 +02:00
Markus Mäkelä
513220805b MXS-1539: Remove useless handles
The client handle was never used.
2017-12-05 09:43:05 +02:00
Markus Mäkelä
c8b6838bce MXS-1555: Fix statement tracking for readwritesplit
The statement tracking was given the same buffer multiple times when a
large packet was spread across multiple buffers when a router with
RCAP_TYPE_STMT_INPUT was present.

The command tracking packet processing is redundant for routers that
require RCAP_TYPE_STMT as the same processing is done later when the
buffer is split into packets and routed. By using the split packets, the
protocol module can simplify the command tracking by a great deal for most
routers.
2017-12-04 14:49:13 +02:00
Esa Korhonen
046ed5c93d MXS-1513: mysql_mon.cc formatting changes
Ran astyle, cut some long lines.
2017-12-04 13:53:16 +02:00
Esa Korhonen
c0ab80e459 MXS-1513: Cleanup some messages, change function names
No real functionality changes.
2017-12-04 12:53:09 +02:00
Esa Korhonen
45834a89b5 MXS-1533: Rename "auto_join" to "auto_rejoin" 2017-12-04 09:59:29 +02:00
Markus Mäkelä
8084491d53 Fix build failure with GCC7
The format checks in GCC7 reported truncation in a snprintf call.
2017-12-04 09:56:50 +02:00
Esa Korhonen
508ce3a703 MXS-1491: Failover can be executed manually
Also, renamed config setting "failover" to "auto_failover". Removed
setting "switchover" as it is now always enabled.
2017-12-04 09:41:00 +02:00
Esa Korhonen
90f6d78a58 MXS-1533: Add automatic join feature
When enabled, the monitor will redirect servers to replicate from the
current master. Standalone servers and servers replicating from a slave
are redirected.
2017-12-04 09:37:16 +02:00
Johan Wikman
cf627203cb Fix issues revealed on CentOS6 2017-12-02 13:42:15 +02:00
MassimilianoPinto
574af7762d MXS-1545: handling of slave file EOF refactoring
MXS-1545: handling of slave file EOF refactoring.

Some slave/router state are now checked before any WARN/ERROR messages
about slave file EOF.

The missing “next_file” is always logged with warn.
2017-12-01 14:02:02 +01:00
Markus Mäkelä
5664cb8bf6 Fix protocol command tracking
The command byte was always read at an offset of 4 instead of the current
offset plus 4.
2017-12-01 11:30:13 +02:00
Markus Mäkelä
0506669738 Only refresh users on failed authentication
When backend authentication failed due to errors other than wrong
credentials, the users were unconditionally reloaded. This caused a spike
of activity whenever authentication failed for other reasons.

Also fixed the test that checks for this to look for the correct error
message.
2017-12-01 06:01:18 +02:00
MassimilianoPinto
d4c0d74ab4 MXS-1530: check ANNOTATE_ROWS flag in connecting slave
MXS-1530: check ANNOTATE_ROWS flag in connecting slave.

In MariaDB 10.2.4 replicate_annotate_row_events and
binlog_annotate_row_events have default to ON: this change checks
whether the connecting slave is not has ANNOTATE_ROWS in
blr_slave_binlog_dump(), those ANNOTATE_ROWS events can be sent or not
to the slave.
2017-11-30 16:34:24 +01:00
Markus Mäkelä
f2a0cc8b31 Don't send hangup error on connection close
If the client has sent a COM_QUIT, the hangup error message should not be
written.
2017-11-30 17:25:06 +02:00
Esa Korhonen
4cb50f48ad MXS-1533: Fix relay master identification and root master detection
Relay master servers must now have a running slave. Also, fix cluster master
detection in get_replication_tree().
2017-11-30 16:16:19 +02:00
Markus Mäkelä
d5d41349ae MXS-1509: Add ignore_external_masters parameter
The new parameter allows ignoring of master servers that are external to
the monitor configuration. This allows sub-trees of the actual replication
tree to be used as fully fledged replication trees.
2017-11-30 12:39:00 +02:00
Markus Mäkelä
7c2a173a17 MXS-1536: Always recreate TABLE_MAP objects
When a table map event is read after an alter table, the old TABLE_MAP
object contains old information. Due to this, as well as the added benefit
of making the code easier to read, the recycling of TABLE_MAP objects was
removed. In practice, there were no benefits to re-mapping the tables to a
different ID.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
a32789d4ac MXS-1536: Fix ALTER TABLE parsing
The ALTER TABLE parsing didn't properly handle escaped values and it used
the current database unconditionally.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
764863cb3f MXS-1536: Add Annotate_rows event processing
The Annotate_rows events were not processed which caused the following
table map event to be ignored.

Also removed a false debug assertion. The byte count can be zero and the
pointer is not guaranteed to point to anything valid.
2017-11-30 12:38:43 +02:00
Markus Mäkelä
0ca04cb5d5 MXS-1536: Fix crash in CREATE TABLE
If a CREATE TABLE statement had a quoted keyword as the name of a field,
the calculated column count and actual column counts would differ.

In addition to this, oneline comments before the end of the statement
would truncate the SQL due to the fact that the whitespace was squashed
before the comment removal was done.
2017-11-30 12:38:43 +02:00
MassimilianoPinto
36129466e5 MXS-1545: fix file pointer reuse in blr_open_binlog
When binlog storage is TREE the check for existing BLFILE should use
gtid info in addition to strcmp
2017-11-30 09:47:02 +01:00
MassimilianoPinto
aa35b202ec Merge 2.1 into 2.2
Merge 2.1 into 2.2
2017-11-30 09:15:42 +01:00
MassimilianoPinto
2217091019 MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7
MXS-1546: revert commit e16eee0cc3c6307f732c2e43d995d3c86cdd67a7

This code is not necessary in MaxScale 2.1
2017-11-29 18:22:05 +01:00
Johan Wikman
481892b452 MXS-1512 Add test case for cache options
Here's now tested that the cache properly deals with the configuration
setting "cache_in_transactions" and the current transaction state.
2017-11-29 12:41:34 +02:00
Johan Wikman
b225eeff2c MXS-1512 Allow autocommit and trx state to be set for a session
When mocking you want to be able to set explicitly how a filter
session should see the current context.
2017-11-29 12:41:34 +02:00
Johan Wikman
02cf284b61 MXS-1512 Add mock Backend class that can generate resultsets 2017-11-29 12:41:34 +02:00
Johan Wikman
6d66ffe9f7 Use FilterModule::ConfigParameters in test_dbfwfilter 2017-11-29 12:41:34 +02:00
Johan Wikman
9aa4a2d1ff MXS-1512 Create parameters object from default parameters 2017-11-29 12:41:34 +02:00
Johan Wikman
7ae2acecf7 MXS-1512 Take module object type as template argument
Makes it possible to move the module object pointer into the
SpecificModule template.
2017-11-29 12:41:34 +02:00
MassimilianoPinto
8a10b72e4d Merge 2.1 in 2.2
Merge 2.1 in 2.2
2017-11-29 11:30:33 +01:00
Johan Wikman
a6e83f41f6 Add missing "%s" format 2017-11-28 14:31:57 +02:00
MassimilianoPinto
e16eee0cc3 MXS-1546: Don't check binlog read position when last event is HEARTBEAT_EVENT
Don't check binlog read position when last event is HEARTBEAT_EVENT
2017-11-28 13:24:35 +01:00
MassimilianoPinto
c44dd4a26c MXS-1530: stop replication unsupported binlog events
Stop replicating from master if unsupported binlog events are seen.

Also report error message for unsupported events
(blr_read_events_all_events) at maxscale start-up and with
maxbinlogcheck utility
2017-11-27 18:42:38 +01:00
MassimilianoPinto
ba22e3b1db MXS-154: make gtid and file MARIADB_GTID_INFO fields static
gtid and file MARIADB_GTID_INFO fields are now a fixed size
2017-11-27 18:05:13 +01:00
Esa Korhonen
23cd294dad MXS-1533: Better handling of multi-domain gtids
If the gtid_domain_pos of the master is ever modified,
gtid-variables will have multiple domains. Generally, we are
only interested in the most recent domain. This is tracked in
gtid_domain_id:s and the value of the master is used for
filtering the correct domain from all gtid-values.

Also, use gtid_current_pos instead of gtid_slave_pos. The
advantage of current_pos is that the same variable works also
for master servers. The gtid-handling is now more thorough and
detects some weird situations.
2017-11-27 16:31:13 +02:00
Esa Korhonen
15e330e127 MXS-1533: Save gtid_domain_id and server version to MySqlServerInfo
Cleaned the surrounding code, as it was querying server
version twice.
2017-11-27 16:30:43 +02:00