7362 Commits

Author SHA1 Message Date
Niclas Antti
92832c1ec4 MXS-1777 Remove selection of servers with historically lower number of connections.
Removed the almost equal comparison and subsequent selection based on historical number of connections.
The effect of it was this: Select the server that has historically, weights or not, been slower. Tested this with 2.2
with maxscale on one server and mariadb:s on two servers with different network lags. The tests with historical
selects were clearly slower.
2018-09-26 12:05:48 +03:00
Niclas Antti
7d231e5328 MXS-1777 Changing server weights to match 2.2 behavior.
Match 2.2, changed the weights back to non-inverse because 0-weight
is a special case. Renamed to server_weight for greppability.
2018-09-26 12:05:48 +03:00
Markus Mäkelä
ddd6feff69
Move transaction management into a subfunction
The readwritesplit transaction management was a large part of the
clientReply function. Moving it into a separate function clarifies the
clientReply function by hiding the comments and details of the transaction
management.
2018-09-26 09:43:26 +03:00
Markus Mäkelä
548d121699
MXS-2068: Use RWBackend in schemarouter
The schemarouter now uses the RWBackend to track the response states. This
fixes the debug assertions that happened with the mxs1113_schemarouter_ps
test.
2018-09-26 09:43:26 +03:00
Markus Mäkelä
24b438c9b6
MXS-2068: Split reply_is_complete into two functions
By splitting the processing and state querying into two separate
functions, the result can be inspected multiple times without triggering
the result processing.
2018-09-26 09:43:25 +03:00
Markus Mäkelä
60cb8127a0
MXS-2068: Remove unused code 2018-09-26 09:43:25 +03:00
Markus Mäkelä
a32361e894
MXS-2068: Move common functionality into RWBackend
The RWBackend now updates the internal state when a new write is done in
addition to acknowledging it when the reply is complete.
2018-09-26 09:43:25 +03:00
Markus Mäkelä
09a64753f1
MXS-2068: Move RWBackend into mysqlcommon
This cleanly allows multiple modules to use it.
2018-09-26 09:43:25 +03:00
Markus Mäkelä
a9155e9f0e
MXS-701: Use the default database with query events
If a query event uses an implicit database, the filtering is now correctly
done also for those tables.
2018-09-26 09:43:24 +03:00
Markus Mäkelä
82b3ffdf60
MXS-701: Clean up binlogfilter
Removed unused code, ordered function definitions that declarations aren't
needed, changed functions to pass pointers to the event body instead of
the start of the protocol packet.
2018-09-26 09:43:24 +03:00
Markus Mäkelä
d7fab9e43a
MXS-701: Make info messages more useful
The messages now tell whether an event was skipped.
2018-09-26 09:43:23 +03:00
Markus Mäkelä
047242a721
MXS-701: Improve binlogfilter
Added `match` and `exclude` functionality. This allows versatile filtering
without a large investment of development time by leveraging the benefits
of PCRE2 regular expressions.

Also cleaned up the filter and removed the single table matching and
active parameter that were obsoleted by the regular expression parameters.
2018-09-26 09:43:01 +03:00
Johan Wikman
25038432bb MXS-2047 Rename MARIADB_GTID_INFO::file -> binlog_name
That's how the concept is named elsewhere.
2018-09-25 10:08:30 +03:00
Johan Wikman
654d3f2bbe MXS-2047 Rename BLFILE::binlogname to BLFILE::binlog_name
That's how the concept is named everywhere else.
2018-09-25 10:07:11 +03:00
Johan Wikman
cc5e3eb0ac MXS-2047 Align variable names
MARIADB_GTID_ELEMS is called gtid_elms everywhere else.
2018-09-25 10:07:11 +03:00
Johan Wikman
be4df2508f MXS-2047 Use same name for same concept
If a member variable in ROUTER_INSTANCE and ROUTER_SLAVE refer
to the same concept, the name used in both should be the same.
2018-09-25 10:07:11 +03:00
Johan Wikman
16e2740762 MXS-2047 Add column binlog_rdir to BLR gtid_maps table
This column will be used to store the relative path of the file
where a particular event can be found.

Unless the path is stored, BLR will not be able to find an event based
on the gtid if BRL is connected to a node in a Galera cluster and updates
are made to nodes other than that node as in that case, the GTID domain id
and server id, will not identify the correct directory.

The full path is not stored in the column binlog_file as the path
would in that case (without other modifications) be visible to the
client.
2018-09-25 10:07:11 +03:00
Markus Mäkelä
f17dfdbc2b
Fix filter destruction
The filter instances weren't cleared before the dynamically loaded
libraries were unloaded which caused a crash.
2018-09-24 12:08:04 +03:00
Markus Mäkelä
f9e876db06
Fix Session destruction
The Session class was deleted via the opaque pointer instead of the actual
class pointer.
2018-09-24 12:07:49 +03:00
Esa Korhonen
dfc10b109d MXS-1937 Add failover/switchover with server events test
The test adds a scheduled server event, the does failover, rejoin and
switchover and checks that event is manipulated correctly. Also includes
a change to the monitor to fix an invalid ALTER EVENT query when the event
definer has wildcard host.
2018-09-24 10:43:17 +03:00
Markus Mäkelä
e5a0b4e9bb
Merge branch '2.2' into develop 2018-09-21 14:18:15 +03:00
Markus Mäkelä
d55c07dc2e
MXS-2066: Reset resultset collection by default
The collection of resultsets needs to be disabled by default when a
response is received to cover the cases where an error is returned.

The collection of results should also not be set for queries that do not
generate any responses.
2018-09-21 11:14:45 +03:00
Markus Mäkelä
60915f847f
MXS-2064: Log workaround for grant problems with MariaDB 10.2.10
When the 10.2 users query is executed with a MariaDB server older than
10.2.11, the query will fail due to inadequate grants on the 'users' table
generated as a part of the CTE. To work around the issue, a SELECT grant
on the whole mysql database is required. Logging the server where the
query fails also helps resolve the problem by pointing out where the grant
needs to be added.
2018-09-21 11:14:45 +03:00
Esa Korhonen
a3adcea524 MXS-1712 Cleanup reset-replication
Now logs messages explaining what has been done. Scheduled events are
disabled/enabled during the operation. Redirection of slaves is done at
the end similar to failover/switchover.
2018-09-21 10:54:36 +03:00
Markus Mäkelä
71ffef5708
Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
Markus Mäkelä
d8d0b1a29c
Merge branch '2.2' into develop 2018-09-20 12:21:53 +03:00
Markus Mäkelä
8c2f6aafcc
MXS-2060: Load users from only valid servers
Users should only be loaded from a server if it is running and not in
maintenance.
2018-09-19 20:32:39 +03:00
Markus Mäkelä
40c4614ed1
Update mocha
Updated mocha to latest version for maxctrl and REST API test suites.
2018-09-19 20:32:39 +03:00
Esa Korhonen
02ac394e38 Cleanup slave status handling
Further reduce direct indexing slave status array to improve compatibility with
multimaster replication.
2018-09-19 13:37:24 +03:00
Markus Mäkelä
97a4cdcd49
MXS-2052: Log error on failed routing of session command
If no server receives the session command, an error is now logged.
2018-09-18 21:07:18 +03:00
Markus Mäkelä
2e069fa892
MXS-1632: Take mxb::atomic::add into use
The function now mostly replaces the use of atomic_add_ functions declared
in atomic.h.
2018-09-18 15:21:54 +03:00
Markus Mäkelä
37f693fc0a
MXS-1632: Filter out inactive servers
The statistics are only returned for active servers.
2018-09-18 15:21:53 +03:00
Markus Mäkelä
805840dcdc
MXS-1632: Add per-server read-write statistics
The read-write distribution in readwritesplit is now stored in a map
partitioned by the servers that the router has used. Currently, the
statistics for removed servers aren't dropped so some filtering still
needs to be added.
2018-09-18 15:21:53 +03:00
Markus Mäkelä
62788f39e1
Make response time statistics worker-local
Given that the response times across threads are extremely likely to be
nearly identical, the data can be partitioned by worker thread.
2018-09-18 15:21:53 +03:00
Markus Mäkelä
675182e9eb
Remove unremoved comment
The comment stated that it should be removed before being merged.
2018-09-18 15:21:53 +03:00
Markus Mäkelä
f066d154c6
MXS-1632: Use statistics.hh functions in routingworker.cc
The custom code for accessing member methods can be removed.
2018-09-18 15:21:53 +03:00
Johan Wikman
3b78996c4c Merge branch '2.2' into develop 2018-09-17 13:02:53 +03:00
Markus Mäkelä
d6ce6e4289
MXS-2035: Fix available_when_donor
The parameter got broken by the previous change.
2018-09-15 01:22:39 +03:00
Esa Korhonen
eeb61216de Add MariaDBMonitor Gtid unit test
Tests the class with different inputs. Also fixes a bug found by the test.
2018-09-14 17:31:00 +03:00
Esa Korhonen
56c84541df MXS-1712 Add reset replication to MariaDB Monitor
The 'reset_replication' module command deletes all slave connections and binlogs,
sets gtid to sequence 0 and restarts replication from the given master. Should be
only used if gtid:s are incompatible but the actual data is known to be in sync.
2018-09-14 17:15:05 +03:00
Esa Korhonen
cb54880b99 MXS-1937 Cleanup event handling
Event handling is now enabled by default. If the monitor cannot query the EVENTS-
table (most likely because of missing credentials), print an error suggesting to
turn the feature off.

When disabling events on a rejoining standalone server (likely a former master),
disable binlog event recording for the session. This prevents the ALTER EVENT
queries from generating binlog events.

Also added documentation and combined similar parts in the code.
2018-09-14 16:54:24 +03:00
Esa Korhonen
4ba0112668 Deactive some uncrustify settings
This only deactivates some of the more heavy-handed features. All files have
been formatted with the new settings, which seems to have only affected lines
which were not formatted before.
2018-09-14 16:20:13 +03:00
Markus Mäkelä
4e41978069
Merge branch '2.2' into develop 2018-09-14 10:41:43 +03:00
Markus Mäkelä
c600b8ab92
MXS-2046: Fix double freeing of GWBUF
The response buffer from the master was freed twice.
2018-09-13 20:38:55 +03:00
Markus Mäkelä
bee7cc2002
MXS-2046: Fix additional memory leaks
A set of memory leaks were revealed by Valgrind.
2018-09-13 14:27:21 +03:00
Markus Mäkelä
fa96923983
MXS-2035: Add mariabackup support to Galeramon
The mariabackup is now treated the same way as xtrabackup.
2018-09-13 13:02:32 +03:00
Markus Mäkelä
a952255c19
MXS-2046: Fix binlogrouter memory leak
The client queries were never freed.
2018-09-13 13:02:31 +03:00
Markus Mäkelä
7ec2f77708
Merge branch '2.2' into develop 2018-09-12 23:18:08 +03:00
Markus Mäkelä
96a78685bc
Fix possible buffer overrun in readwritesplit
If the GWBUF length was larger than the stack buffer length, the code
would write past the buffer.
2018-09-12 22:09:38 +03:00
Johan Wikman
12092d1a90 test_cycle_find.cc: Initialize the log 2018-09-12 14:23:09 +03:00