2725 Commits

Author SHA1 Message Date
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
Esa Korhonen
6326172325 MXS-2271 Rename basic Monitor fields
Adds the m_-prefix.
2019-01-28 15:41:00 +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
Esa Korhonen
40485d746c MXS-2220 Change server name to constant string 2019-01-03 12:13:15 +02:00
Esa Korhonen
5fc2c1f49c MXS-2220 Store server ports as integers and modify them in methods 2019-01-03 12:13:15 +02:00
Esa Korhonen
09aa54720d MXS-2220 Read server version using public methods
Version related fields have been removed from the public class.
2019-01-03 11:23:14 +02:00
Markus Mäkelä
9adbd2f8f0
Cache the local server statistics object
By storing the server statistics object in side the session, the lookup
involved in getting a worker-local value is avoided. Since the lookup is
done multiple times for a single query, it is beneficial to store it in
the session.

As the worker-local value is never deleted, it is safe to store a
reference to it in the session. It is also never updated concurrently so
no atomic operations are necessary.
2019-01-03 09:37:59 +02:00
Markus Mäkelä
1fa3b133c7
Make keepalive ping checks more efficient
The code now only checks the need for a keepalive ping once every
keepalive interval. Reduced the number of mxs_clock calls to one so that
all servers use the same value.
2019-01-03 09:37:59 +02:00
Markus Mäkelä
54ae7119cf
Fix binlogrouter master reconnection
The reconnection attempt to the master won't work if users aren't loaded
before it.
2018-12-31 10:39:57 +02:00
Markus Mäkelä
4ab25bcd1c
Fix schemarouter duplicate database detection
The detection wouldn't work if the database had no tables.
2018-12-28 11:33:43 +02:00
Markus Mäkelä
3b150ad4b2
Fix binlogrouter use of DCBs
The dcb_connect function requires that the client DCB has a remote
address.
2018-12-28 10:13:24 +02:00
Markus Mäkelä
4d0a40ef9f
Add missing pointer initialization
The change from SRWBackend to RWBackend* had some side effects, namely the
missing automatic initialization into zero values.
2018-12-28 08:19:23 +02:00
Markus Mäkelä
5a9e84d39a
Merge branch '2.3' into develop 2018-12-18 00:00:00 +02:00
Markus Mäkelä
35d31801bb
Merge branch '2.2' into 2.3 2018-12-17 23:52:56 +02:00
Esa Korhonen
6209d737e9 MXS-2220 server_alloc returns internal type
Also adds default initializers to SERVER fields.
2018-12-14 10:31:57 +02:00
Esa Korhonen
3f81a37e70 MXS-2220 Move rest of dcb printing functions to private class 2018-12-14 10:18:14 +02:00
Markus Mäkelä
7cf73e0f13
MXS-2196: Fix use of DCBs in binlogrouter
The binlogrouter now handles the DCB creation a bit more correctly but it
still breaks a few of the rules.
2018-12-13 13:27:45 +02:00