Commit Graph

5038 Commits

Author SHA1 Message Date
ab4f870927 MXS-2067: Replace most SPINLOCKs
Replaced SPINLOCK with std::mutex where possible, leaving out the more
complex cases. The big offenders remaining are the binlogrouter and the
gateway.cc OpenSSL locks.
2018-09-28 12:18:23 +03:00
50451166bb MXS-2067: Remove spinlock.hh
Replaced the C++ versions with standard library mutexes.
2018-09-28 12:18:23 +03:00
fe81b399b2 Use maxbase time and clock classes instead of std::chrono 2018-09-27 17:04:59 +03:00
05d18e81ae Use string instead of stringstream
Most of the monitor was already using string for formatted printing.
2018-09-27 16:46:59 +03:00
66227301aa Merge branch '2.2' into develop 2018-09-27 11:47:32 +03:00
dd9ff27743 MXS-1845 Rewrite server promotion code
In progress, does not yet overwrite existing code.

The new promotion mechanism automatically retries queries which timed out. It also
handles multimaster situations correctly.
2018-09-26 13:20:29 +03:00
c58041d4fb Format MariaDBMonitor source
Some parts were manually edited for better results. No functional changes.
2018-09-26 12:49:14 +03:00
bfb1c3f1b3 MXS-1944 Store switchover parameters in an object 2018-09-26 12:42:26 +03:00
c20a17238b MXS-1944 Store failover parameters in an object
Several of the parameters are passed on from function to function. Having them all
in an object cleans things up and makes adding more data easier.
2018-09-26 12:26:35 +03:00
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
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
7d2a5b2c13 Fix readwritesplit debug assertion
The debug assertion is wrong as the code was changed to prioritize hints
over the router target selection. Also removed the superficial check for
master, slave and relay master states as they are implied by the fact that
the connection is in use.
2018-09-26 11:08:23 +03:00
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
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
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
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
09a64753f1 MXS-2068: Move RWBackend into mysqlcommon
This cleanly allows multiple modules to use it.
2018-09-26 09:43:25 +03:00
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
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
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
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
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
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
cc5e3eb0ac MXS-2047 Align variable names
MARIADB_GTID_ELEMS is called gtid_elms everywhere else.
2018-09-25 10:07:11 +03:00
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
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
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
e5a0b4e9bb Merge branch '2.2' into develop 2018-09-21 14:18:15 +03:00
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
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
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
71ffef5708 Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
d8d0b1a29c Merge branch '2.2' into develop 2018-09-20 12:21:53 +03:00
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
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
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
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
37f693fc0a MXS-1632: Filter out inactive servers
The statistics are only returned for active servers.
2018-09-18 15:21:53 +03:00
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
675182e9eb Remove unremoved comment
The comment stated that it should be removed before being merged.
2018-09-18 15:21:53 +03:00
3b78996c4c Merge branch '2.2' into develop 2018-09-17 13:02:53 +03:00
d6ce6e4289 MXS-2035: Fix available_when_donor
The parameter got broken by the previous change.
2018-09-15 01:22:39 +03:00
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
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
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
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
4e41978069 Merge branch '2.2' into develop 2018-09-14 10:41:43 +03:00
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
bee7cc2002 MXS-2046: Fix additional memory leaks
A set of memory leaks were revealed by Valgrind.
2018-09-13 14:27:21 +03:00
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