2739 Commits

Author SHA1 Message Date
Esa Korhonen
b357717149 MXS-2304 Use get_bool() instead of config_get_bool() 2019-02-01 17:18:49 +02:00
Markus Mäkelä
6038f1f386
Merge branch '2.3' into develop 2019-02-01 13:55:54 +02:00
Esa Korhonen
f2d2202ea3 MXS-2304 Use get_enum() instead of config_get_enum() 2019-02-01 10:29:24 +02:00
Esa Korhonen
c8a84cebd0 MXS-2304 Use get_integer() instead of config_get_integer() 2019-01-31 18:12:25 +02:00
Esa Korhonen
03411e825d MXS-2271 Move journal_max_age inside settings container 2019-01-31 17:05:35 +02:00
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Markus Mäkelä
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
Johan Wikman
8e59f4efbd MXS-2273 A master is a master even if it is not connectible
When looking for a master, if it does exist it should be found
even if it is not connectible. The fact that it is not connectible
should be dealt with when a connection is created.
2019-01-30 12:16:57 +02:00
Johan Wikman
117f89a409 MXS-2273 Deal with master being drained at RWS connect
If a master is found but it is being drained, the connection attempt
is rejected if the master failure mode is fail_instantly.

In that case the logged message makes it plain that it is the draining
that is the reason for the connection attempt to fail.
2019-01-30 12:16:57 +02:00
Johan Wikman
c2d3bdf7ef MXS-2273 Make schemarouter honour BEING_DRAINED bit
The schema router now deals with the being drained bit the same way
it deals with the maintenance bit, that is, a server being drained will
simply be ignored.

TODO: This behaviour needs to be document.
TODO: It seems the schema router simply ignores the maintenance bit
      once a connection has been establisdhed.
2019-01-30 12:16:57 +02:00
Johan Wikman
b564089afe MXS-2273 Take BEING_DRAINED bit into account in RCR
Also check when looking for the root master that not only the server ref
but also the referred to server is active.
2019-01-30 12:16:57 +02:00
Markus Mäkelä
6d88afbf55
MXS-2038: Fix debug assertion
A query that is classified as a write but has a hint that tells to route
it to a slave is not unexpected ever since the 2.1 version of MaxScale.
2019-01-28 18:36:52 +02:00
Esa Korhonen
6326172325 MXS-2271 Rename basic Monitor fields
Adds the m_-prefix.
2019-01-28 15:41:00 +02:00
Markus Mäkelä
b078eb2cca
Add server state to routing hint log message
If a server was not chosen as the target of a routing hint, the server
status would not be logged. By logging the server state in the message, it
is easier to figure out why a server wasn't chosen as the routing target.
2019-01-28 09:27:13 +02:00
Markus Mäkelä
2c95119a3b
Replace STRTARGET macro
The macro was extremely unwieldly to update and made the addition of debug
assertions harder. Rewriting it as an inline function makes this possible.
2019-01-28 09:27:13 +02:00
Esa Korhonen
9ac8bf93bb MXS-2271 Rename monitor-related classes
MXS_MONITOR->Monitor
MonitorInstance->MonitorWorker
MonitorInstanceSimple->MonitorWorkerSimple
2019-01-22 15:59:17 +02:00
Esa Korhonen
7fb80c530b Merge branch '2.3' into develop 2019-01-21 14:05:16 +02:00
Esa Korhonen
7f978f275f MXS-2223 Log a message when a slave is discriminated due to replication lag
Both the replication lag and the message printing state are saved in SERVER,
although the values are mostly used by readwritesplit. A log message is printed
both when a server goes over the limit and when it comes back below.
Because of concurrency issues, a message may be printed multiple times before
different threads detect the new message state.

Documentation updated to explain the change.
2019-01-21 13:02:18 +02:00
Esa Korhonen
3b55893a20 Combine maxscale/buffer.h with maxscale/buffer.hh 2019-01-17 12:37:40 +02:00
Markus Mäkelä
a3fa2f8111
Merge branch '2.3' into develop 2019-01-16 16:31:14 +02:00
Markus Mäkelä
ba40916d4a
MXS-2266: Close prepared statements with internal ID
The ID used to store the prepared statements uses the internal ID and
using the external ID caused unwanted memory use and a false warning.
2019-01-16 12:22:06 +02:00
Markus Mäkelä
57fe5ff56a
Fix error packet stringification function
The code read past the stack buffer.
2019-01-16 09:43:49 +02:00
Markus Mäkelä
021d48f94c
Log low-level reason and idle time on master failure
If the connection to the master is lost, knowing what type of an error
caused the call to handleError helps deduce what was the real reason for
it. Logging the idle time of the connection helps detect when the
wait_timeout of a connection is exceeded.
2019-01-16 09:43:49 +02:00
Esa Korhonen
d4674faa7d Convert maxscale/query_classifier.h to .hh
The header was not merged with queryclassifier.hh since the latter
does not include the former.
2019-01-15 18:18:39 +02:00
Esa Korhonen
6a23015b64 Convert avro headers to .hh
Required for converting maxscale/buffer.h.
2019-01-15 16:38:10 +02:00
Esa Korhonen
87913f8cb8 MXS-2220 Miscellaneous cleanup
Removes some duplicate includes.
2019-01-11 11:00:24 +02:00
Niclas Antti
9823fe2651 MXS-2247 Add support for random number generation to maxutils
Classes for xorshift and std random. Add a random number generator to Worker.
2019-01-10 16:51:32 +02:00
Johan Wikman
7cac2c009d Merge branch '2.3' into develop 2019-01-10 12:43:46 +02:00
Esa Korhonen
9cac927542 MXS-2220 Move server response calculation functions inside class 2019-01-10 10:26:53 +02:00
Esa Korhonen
df17619722 MXS-2220 Move server_update_address inside class
Should be moved to internal class once blr is cleaned up.
2019-01-10 10:26:53 +02:00
Markus Mäkelä
46eddc8102
Rename ReadConn to RCR
RCR is more compact and looks neat.
2019-01-10 07:16:42 +02:00
Markus Mäkelä
5613f31bc7
Clean up readconnroute
Moved method documentation into the headers and removed the local
variables storing pointers to this.
2019-01-10 07:16:42 +02:00
Markus Mäkelä
d6df5a7d6a
Use router template in readconnroute 2019-01-10 07:15:45 +02:00
Markus Mäkelä
54589424f9
Use more C++ code in readconnroute
Allocations are now done with new and casts are done using
static_cast. Removed revision history and cleaned up some assertions.
2019-01-10 07:12:31 +02:00
Markus Mäkelä
b30b743455
Rename readconnroute structures
Renamed them with the C++ coding style in mind.
2019-01-10 07:12:30 +02:00
Markus Mäkelä
5da833187c
Rename readconnroute header
The name now reflects the module and source code name.
2019-01-10 07:12:30 +02:00
Markus Mäkelä
147f0bb656
Extend master failure error message
The error now describes the failure mode in more detail. This should make
post mortem analysis of failed connections a lot easier.
2019-01-09 20:05:38 +02:00
Johan Wikman
6ba2cb61df MXS-2218 Implement housekeeper in terms of MainWorker 2019-01-08 16:01:36 +02:00
Esa Korhonen
1c647f3753 MXS-2220 Move most remaining functions inside class
Most of the ones still remaining outside are special cases.
Also, removed locking from status manipulation functions as it
has not been required for quite some time.
2019-01-08 15:15:34 +02:00
Esa Korhonen
d5c78eb31f MXS-2220 Move more server functions inside class 2019-01-08 15:12:47 +02:00
Esa Korhonen
8b53e30678 MXS-2220 Move server status functions inside class 2019-01-08 15:12:47 +02:00
Esa Korhonen
49c1afcb1b Merge branch '2.3' into develop 2019-01-08 13:17:27 +02:00
Esa Korhonen
63358fb4c1 Add correct operator to comparison
The clause had a bitwise AND. The end result is likely the same.
2019-01-08 10:18:15 +02:00
Esa Korhonen
b16ee3a94e MXS-2220 Move server_is_active inside the class 2019-01-07 16:10:15 +02:00
Markus Mäkelä
5f83b07fc2
MXS-2241: Detect invalid readwritesplit configuration
master_reconnection and disable_sescmd_history are, in practice, mutually
exclusive settings.
2019-01-07 11:06:24 +02:00
Markus Mäkelä
f0f9c21d1c
Merge branch '2.3' into develop 2019-01-07 10:54:42 +02:00
Esa Korhonen
ca9c52944b MXS-2220 Use std::string for protocol and authenticator fields 2019-01-03 12:13:15 +02:00