Commit Graph

7667 Commits

Author SHA1 Message Date
4dda31ffe3 Merge branch '2.2' into 2.3 2019-03-16 09:30:56 +02:00
fd21bed5aa Fix queued query handling
If a routing of a queued query caused it to be put back on the query
queue, the order in which the queue was reorganized was wrong. The first
query would get appended as the last query which caused the order to be
reversed.
2019-03-15 20:35:17 +02:00
29b8d12be3 Always ignore EPIPE errors
There's no reason to not ignore EPIPE errors in debug builds.
2019-03-14 20:08:13 +02:00
09dc92973e Discard connections as the last step
Th discarding of connections in maintenance mode must be done after any
results have been written to them. This prevents closing of the connection
before the actual result is returned.
2019-03-14 12:15:30 +02:00
e5edb5c78f Fix reads into bad memory in readwritesplit
The candidate selection code used default values that would cause reads
past buffers. The code could also dereference the end iterator which
causes undefined behavior.
2019-03-14 12:15:30 +02:00
b537176248 Fix parsing of non-query packets
Packets that do not contain SQL should not be parsed.
2019-03-13 15:44:02 +02:00
040562f718 MXS-2342 Run MariaDBMonitor diagnostics concurrent with the monitor loop
This fixes some situations where MaxAdmin/MaxCtrl would block and wait
until a monitor operation or tick is complete. This also fixes a deadlock
caused by calling monitor diagnostics inside a monitor script.

Concurrency is enabled by adding one mutex per server object to protect
array-like fields from concurrent reading/writing.
2019-03-12 10:50:16 +02:00
c8078c99e5 MXS-2325 Fix Debian 8 compilation 2019-03-11 14:39:02 +02:00
50f588db3e MXS-2370 Clarify query timeout warning message
The message now more clearly states if the failure was due to timeout or
a different Connector-C error.
2019-03-11 13:20:50 +02:00
710e5df27b MXS-2365: Fix classification of queued queries
Queries in the query queue need to be explicitly parsed since they are
stored in a single buffer and thus share the query classification
information. In the next major version this should be changed into an
array of individual buffers instead of a shared buffer.
2019-03-08 14:45:18 +02:00
5c5c6630bf Fix retain_last_statements
If multiple statements were stored in a single buffer only one of them
would get registered.
2019-03-08 14:45:18 +02:00
7f27db02a8 Fix global retain_last_statements
The default value was wrong.
2019-03-08 14:45:18 +02:00
247e558ffa Fix tls-model exposure to other modules
The flag was propagated to other modules that depend on it.
2019-03-08 12:10:31 +02:00
5005facfb1 Always dump the full configuration
Always storing runtime configuration changes prevents problems when the
change causes another parameter to change. One example of this is
transaction_replay that implicitly enables other parameters.
2019-03-08 12:10:31 +02:00
7db87784ac Deliver hangups only to valid DCBs
If a DCB was closed and a hangup event was sent to it via
dcb_hangup_foreach shortly after it was closed, the DCB would still
receive it even if it was closed. To prevent this, events must only be
delivered to DCBs if they haven't been closed.
2019-03-08 12:10:30 +02:00
71a3cde441 MXS-2373: Fix filter serialization
The module of a filter was ignored as it wasn't in the list of expected
module parameters.
2019-03-08 12:10:30 +02:00
267ec9cccc Fix filter serialization
Filters were serialized with commas as separators instead of pipes.
2019-03-07 16:02:49 +02:00
5b43940559 Track session state only when required
The protocol should not track the session state as the parsing is quite
expensive with the current code. This change is a workaround that enables
the parsing only when required. A proper way to handle this would be to do
all the response processing in one place thus avoiding the duplication of
work.
2019-03-07 15:59:26 +02:00
b97976c4ee MXS-2323: Close stale connections
Cleaning up and closing stale connections to servers in maintenance mode
helps administrators see when a server is no longer in use.
2019-03-07 15:59:26 +02:00
a7be3c527c Remove unnecessary memory allocations
Given the fact that there exist only three possible categories, the map
can be replaced with a static array that needs no memory
allocations. Making this array thread-local allows it to be reused which
places an upper limit on the number of memory allocations.
2019-03-07 15:59:26 +02:00
4208dff2e6 MXS-2337 Schemarouter responds correctly to SHOW TABLES
The router now handles the query similarly to a "SHOW TABLES FROM X"
with the current db assigned to X.
2019-03-07 13:07:20 +02:00
6332f0876b Merge remote-tracking branch 'origin/2.3' into 2.3 2019-03-05 04:59:26 +02:00
77ef3dd613 Merge branch '2.2' into 2.3 2019-03-05 04:54:40 +02:00
8a0b6005a4 MXS-2335: Fix lower_case_table_names
The database check always used the case-sensitive SQL to check that the
database exists.
2019-03-05 00:07:13 +02:00
4fd4b726a1 MXS-2325 Only enable events that were enabled on the master
The monitor now continuously updates a list of enabled server events. When
promoting a new master in failover/switchover, only events that were enabled
on the previous master are enabled on the new. This avoids enabling events
that may have been disabled on the master yet stayed in the SLAVESIDE_DISABLED-
state on the slave.

In the case of reset-replication command, events on the new master are only
enabled if the monitor had a master when the command was launched. Otherwise
all events remain disabled.
2019-03-04 16:00:07 +02:00
6436d959e3 Fix avrorouter file rotation
The avro filenames weren't processed properly which caused them to not
work correctly.
2019-03-04 08:53:13 +02:00
7904cdaefb Fix assume_unique_hostnames
It was always set to true when the servers were created.
2019-03-04 08:53:12 +02:00
7fb2ae571b Improve blocked host error message
The error now explains how the problem can be mitigated by increasing
max_connect_errors on the backend server.
2019-03-04 08:53:12 +02:00
48a6ab503e MXS-2292 PAM authenticator detects anonymous users with defined hosts
This allows anonymous user mapping from well-defined hosts.
2019-02-19 10:40:23 +02:00
49c6244245 Update MaxCtrl and REST API dependencies 2019-02-13 13:54:56 +02:00
775fc043c8 MXS-2326: Clone routing hints on gwbuf_clone
When a buffer is cloned the hints for that buffer should also be cloned.
2019-02-13 13:34:48 +02:00
aea64aede2 Prune only when history size is exceeded
The documentation stated that at most `max_sescmd_history` commands were
kept but in reality the number of commands kept in the history was one
command smaller than what was documented.
2019-02-11 10:58:17 +02:00
b93d35ab03 Revert "MXS-2300: Fix off-by-one bug in history size"
This reverts commit 840b4b24bd048ed536621d4433abbb4e846dfcc5.
2019-02-11 10:58:17 +02:00
d04fc6c4b9 Merge branch '2.2' into 2.3 2019-02-08 16:14:58 +02:00
46484b4e11 MXS-2311: Write queued packet one at a time
If an ignorable packet was followed by more than one queued packets, they
would all get routed in the same batch. This would cause unexpected
replies from the server if multiple ignorable packets were queued up.
2019-02-08 14:18:41 +02:00
08a05d3ab9 Fix use of uninitialized variables
Building with optimization in debug mode revealed code that could in
theory result in undefined behavior.
2019-02-06 14:22:24 +02:00
cf4724d128 MXS-2265: Fix formatting of the zero timestamp
The UNIX timestamp 0 should be treated as a special value and must be
interpreted as 0-00-00 00:00:00 instead of 1970-01-01 00:00:00.
2019-02-06 12:11:06 +02:00
5e19d1d044 MXS-2315: Use BRE with std::regex
The default ECMAScript syntax appears to be broken on CentOS 7 which
effectively prevents its use in most cases. A more reliable alternative
would be to use the bundled PCRE2 library but the basic POSIX regular
expressions seem to work.
2019-02-06 12:11:06 +02:00
51884c4599 Ignore malformed .avsc files
If the file name is wrong, ignore it.
2019-02-04 11:15:39 +02:00
6295732bee MXS-2310: Document and install cdc_one_schema.py
Added documentation for the script and installed it as a part of the
default package.
2019-02-04 11:15:38 +02:00
87abd56f8b MXS-2310: Add offline schema generation script
The script generates the required .avsc files without requiring a direct
connection to the database. This makes it easier to generate schemas in
more secure installations where direct access and installing dependencies
might not be easy.
2019-02-04 11:15:38 +02:00
08dd55a26a Use -ftls-model=initial-exec with maxscale-common
Resolving the relocations right at startup reduces the cost of using
thread-local variables.
2019-02-01 13:20:44 +02:00
3f4c72d4f2 MXS-2303: Fix missing parameter error
The detection of missing parameters that define which module to load must
be done before the module is loaded.
2019-01-31 14:23:27 +02:00
840b4b24bd MXS-2300: Fix off-by-one bug in history size
The history was one command shorter than what was configured.
2019-01-31 14:23:27 +02:00
260ce9b8b8 MXS-2300: Add session command pruning
This commit adds a new parameter that, when enabled, prunes the session
command history to a known length. This makes it possible to keep a
client-side pooled connection open indefinitely at the cost of making
reconnections theoretically unsafe. In practice the maximum history length
can be set to a value that encompasses a single session using the pooled
connection with no risk to session state integrity. The default history
length of 50 commands is quite likely to be adequate for the majority of
use-cases.
2019-01-31 14:23:26 +02:00
bf4aa1ab2c MXS-2295: Keep the COM_CHANGE_USER command
If the whole session command history is cleared, the COM_CHANGE_USER is
lost and the connections can end up using different users.
2019-01-31 14:23:26 +02:00
2e809524d1 MXS-2295: Reset session commands on connection reset
When the connection state is reset by executing a COM_CHANGE_USER or
COM_RESET_CONNECTION, readwritesplit does not need to store the session
command history that was executed before it. With this, pooled connections
will effectively behave like normal connections if the pooling mechanism
is smart enough to reset the connection. This also prevents unwanted
visibility into the session states of other connections.
2019-01-31 14:23:26 +02:00
24c9b62a2f Add verbose logging for session command failures
If the routing of a session command fails due to problems with the backend
connections, a more verbose error message is logged. The added status
information in the Backend class makes tracking the original cause of the
problem a lot easier due to knowing where, when and why the connection was
closed.
2019-01-31 14:23:26 +02:00
df9335382d Fix qc cache memory usage message
A zero value would get printed as -nanYiB.
2019-01-31 14:23:16 +02:00
16fc920d33 MXS-2299: Hints always take precedence
Hints should override all statement level routing decisions that would
otherwise be done based on the query type.
2019-01-28 18:36:52 +02:00