Commit Graph

8921 Commits

Author SHA1 Message Date
e909632e9e MXS-2802: Route COM_RESET_CONNECTION to all servers
The purpose of a COM_RESET_CONNECTION is to reset the connection
states. This means it should be routed to all servers, the same as all
session state modifying commands.
2019-12-13 10:49:36 +02:00
934b865b25 Add missing commands to STRPACKETTYPE
The MariaDB specific commands were missing.
2019-12-13 10:49:36 +02:00
2b56737868 Fix debug assertion
The GWBUF_IS_CONTIGUOUS macro changed in 2.4 and it no longer allows null
arguments.
2019-12-13 10:49:36 +02:00
90f7c69f9d Fix database renaming with no default database
If no default database was given, it was possible that the code would end
up in an endless loop.
2019-12-13 10:49:35 +02:00
d44aff6c3d Merge branch '2.3' into 2.4 2019-12-10 11:12:41 +02:00
7be6ee1616 MXS-2789: Make stale journal messages notifications
These events are of no actual consequence and can be safely ignored. It is
simply informational.
2019-12-10 11:11:05 +02:00
cb4e43b05a MXS-2794: Log changes in loaded users
By checking whether the users have changed whenever they are reloaded, we
improve the visibility of the user reloading process. Using a checksum
allows us to easily compress the information with acceptable loss of
accuracy. Using a CAS loop prevents duplicate messages without losing any
updates even if multiple user reloads result in different outcomes.
2019-12-10 09:41:42 +02:00
e36c7efa25 MXS-2785: Report PCRE2 errors
The substitution string could cause errors.
2019-12-09 17:53:59 +02:00
689a284892 MXS-2785: Make rewrite_src a regular expression
The use of a regular expression allows multiple rewrite rules to be
combined into one. This allows more versatile conversions but, given the
simple nature of regular expressions, also makes accidental changes more
likely.

Addd mxs::pcre2_substitute that is a more C++-friendly version of
mxs_pcre2_substitute to make. This makes string replacement a lot easier
to do when the source and destination are not C strings.
2019-12-09 17:53:59 +02:00
d23f0366a8 MXS-2785: Prevent broken replication setups
When rewrite_src and rewrite_dest have different lengths, the slave must
use GTID based replication. This removes the need for one-to-one matching
between the slave's relay log and the master's binlog which gets broken
when event lengths are modified due to event rewriting.
2019-12-09 17:53:59 +02:00
3de5e4edcd MXS-2785: Allow event size changes due to rewrites
The replication events use a redundant format that has both the length of
the event and the position of the next event. The length can be modified
so that the next event position of the previous event and the length of
the curren event can be different. This includes overlap of the events
where the next event position of an event is "inside" the current event.

The next event position must retain its original value as that allows
replication slaves to reconnect with the correct position when file and
position based replication is used. For GTID replication, the slave asks
for the coordinates from the master and uses those.

When a slave receives a heartbeat event from a master, it checks that the
binlog name matches and that the next event position in the event is not
behind the slave's relay log position. These events must be modified to
contain a fake next event position that will never be reached by the
slave. This makes sure that the simple sanity checks never fail even if
we've caused the slave's relay log to be ahead of the master's binlog.
2019-12-09 17:53:59 +02:00
babce13ec6 Add GWBUF pretty-printing
The gwbuf_hexdump_pretty displays the hex contents of the buffer alongside
the human-readable version of it. The text version helps identify parts of
the buffer that contain text which makes protocol data decoding easier.
2019-12-09 17:53:58 +02:00
e829cae8b1 MXS-2785: Add rewrite_src and rewrite_dest parameters
The parameters allow rudimentary database rewriting in the replication
stream. This is still very limited as the replacement must have the same
length as the original. In theory it could be shorter without causing
problems but making it longer is not easy.
2019-12-09 17:53:58 +02:00
c480a44852 Merge branch '2.3' into 2.4 2019-12-05 16:54:44 +02:00
e673c3eab0 MXS-2788 Use case-insensitive string comparisons
When names are matched in rules and in resultsets, case insensitive
matching must be used.
2019-12-05 13:44:18 +02:00
52eafb7926 Fix binlogfilter capabilities
The binlogfilter needs to read results one packet at a time but it needs
resultsets to be collected into a single buffer. This behavior is
guaranteed implicitly when the binlogrouter is used but is not present
when it is used without it. To support the use of the binlogfilter with
readconnroute, the filter must properly declare the capabilities.
2019-12-03 11:06:52 +02:00
5351d43065 Merge branch '2.3' into 2.4 2019-12-03 10:40:57 +02:00
9e9abbe8be MXS-2786: Require certificates when verifying peers
When peer verification is enabled, clients must present a certificate.
2019-12-03 10:34:00 +02:00
b1961042a7 MXS-2776: Fix unwanted regex checks on COMMIT
The default database check would be done even on transaction management
commands which would cause them to always be skipped when a match was
defined.
2019-12-02 09:08:00 +02:00
7a5e50f980 Merge branch '2.3' into 2.4 2019-11-29 16:41:07 +02:00
521c75505b Properly detect SSL initialization failures
The return value was not checked in the function that created it.
2019-11-29 16:31:07 +02:00
ab8393939b MXS-2773: Make host blocking an optional feature
In cases where servers are known to be down on startup, this feature does
more harm than good. Disabling it in these cases would be preferable but
due to how the parameter is used, it is not possible.
2019-11-29 16:31:07 +02:00
cd9b82ba09 Print OpenSSL errors on CA cert errors
This helps figure out why the certificate is not OK.
2019-11-29 16:16:35 +02:00
fb23f3eb3e OpenSSL 1.1 supports TLSv1.1 and TLSv1.2
TLSv1.0 is the only version that newer OpenSSL versions do not support.
2019-11-29 16:16:35 +02:00
374d5b28d1 MXS-2759: Optimize user loading query
The SQL for the second recursive CTE table can be optimized by adding a
where condition on the recursive part that rules out users that are not
roles. The functionality remains the same as only roles can be granted to
users.
2019-11-29 16:16:34 +02:00
d45ea8d489 Merge branch '2.3' into 2.4 2019-11-29 13:59:16 +02:00
d41975dde8 MXS-2782 Return nullptr if non-existing worker is asked for
Earlier assert in debug mode and garbage in release mode.
2019-11-28 14:33:00 +02:00
c5ce940b12 Merge branch '2.3' into 2.4 2019-11-28 08:05:44 +02:00
774e9bc3f0 MXS-2762: Add ssl_version=TLSv13
Added new ssl_version value for TLSv1.3. This allows the list of accepted
protocol versions to be limited to all supported protocols. Previously
TLSv1.3 was only available with ssl_version=MAX.

Also fixed the enum value serialization to use a lowercase v. This causes
them to have the same value as the one used in the enum.
2019-11-28 07:48:01 +02:00
f7f865d4c3 MXS-2763: Log correct error for unsupported TLS versions
Previously when ssl_version was used with a value that is not supported on
the system, an unknown parameter error was returned. This could be
confusing and logging a proper error message should make it clear.
2019-11-28 07:48:01 +02:00
231f68b6dc MXS-2727 Load storage from build-time location
Otherwise it might not be found.
2019-11-13 15:10:56 +02:00
0ec505b301 MXS-2727 Fix test-program 2019-11-13 13:06:07 +02:00
80ce599cf8 Remove cache_stress from the build 2019-11-13 08:37:17 +02:00
f6731a898d Update change date 2019-11-13 08:37:17 +02:00
1c28eefbd0 MXS-2727 Add fix
If an existing cache-entry should be updated, but the new value
is larger that the maximum size of the cache, then the cache can
not be updated, but the old value must be removed.

Whether or not we succeed in removing the entry, an error result
must be returned. Earlier OK was returned, but no node was
allocated, which then caused a crash.
2019-11-12 15:27:31 +02:00
6a319dc655 MXS-2727 Add test that reveals problem 2019-11-12 15:20:32 +02:00
521960e6f9 MXS-2727 Add program for causing cache stress 2019-11-12 15:18:36 +02:00
3f05059afa Merge branch '2.3' into 2.4 2019-11-11 09:09:10 +02:00
638d1bf354 MXS-2760: Fix ssl_version conversion
The value is now correctly converted to the enum values.
2019-11-11 09:05:46 +02:00
d67442356e Merge branch '2.3' into 2.4 2019-11-08 14:13:06 +02:00
5c4ac03c07 Log a message in readconnroute's handleError
This way there's trace that something unexpected happened and that the
session closed unexpectedly.
2019-11-08 13:44:21 +02:00
fdfbf3e133 Update 2.4.3 change date 2019-11-05 12:21:00 +02:00
03e8e85a22 Enable SO_KEEPALIVE
This hopefully prevents unnecessary TCP timeouts.
2019-11-05 11:02:32 +02:00
a1e8287265 Add global to ccrfilter
The `global` parameter causes the time window defined by the `time`
parameter to be applied at the instance level instead of the session
level. This means that a write from one connection will cause all other
connections to use the master for a certain period of time.

Using a configurable time window for consistency is not good as it is not
absolute and cannot adjust to how servers behave.

One example that demonstrates this is when a slave is normally lagging
behind by less than a second but some event causes the lag to spike up to
several seconds. In this case the configured time window would no longer
guarantee consistency.

Another reason to avoid a "static" time window is the fact taht it
prevents load balancing in the cases where slaves catch up to the master
within time window. This happens when time is configured to a higher value
to avoid inconsistencies at all costs.

Added a test case that verified the feature works.
2019-11-04 08:32:17 +02:00
861e27eb00 Merge branch '2.3' into 2.4 2019-10-29 14:04:31 +02:00
df6c56e7ca Update 2.3.13 Change Date 2019-10-29 12:51:31 +02:00
4d51342561 Merge remote-tracking branch 'origin/2.3' into 2.4 2019-10-29 12:29:32 +02:00
639b0af6aa MXS-2734: Check preferred server on table conflict
If the schemarouter detects a table conflict in a query and one of the
servers is the preferred one, don't log an error.
2019-10-29 11:34:09 +02:00
e82be12be9 Cache password hash results
Since the user authentication stores a SHA2-512 hash of the password on
disk, caching the hash results in memory speeds up the authentication
process significantly. Storing the password on disk in plain-text form
would also speed it up but this would be quite insecure.
2019-10-29 11:34:09 +02:00
ac5b5d527a MXS-2610: Prevent watchdog timeouts in avrorouter
The file processing can take a very long time and as it is done on a
routing worker, the workaround needs to be used.
2019-10-29 11:33:10 +02:00