Commit Graph

2850 Commits

Author SHA1 Message Date
42b5c39f43 Merge branch '2.3' into develop 2019-02-07 10:50:27 +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
78d9ef2910 MXS-2304 Remove remaining uses of config_get_string() from module code
The function returns a pointer to an internal string and should not be
used.
2019-02-06 12:36:23 +02:00
5ab7734e9d MXS-2304 Add contains() to test if a parameter exists
Replaces uses of config_get_param() in modules either with contains()
or get_string(). The config_get_param() is moved to internal headers,
as it allows seeing inside a config setting.
2019-02-06 12:36:23 +02:00
b8be905b08 Merge branch '2.3' into develop 2019-02-06 12:24:09 +02:00
5a409f313a MXS-2304 Config string handling cleanup
Using correct functions in most cases.
2019-02-05 10:52:46 +02:00
4132c9bbbc MXS-2304 Use get_c_str_copy instead of config_copy_string()
Also uses get_string() in core-code when appropriate.
2019-02-05 10:28:37 +02:00
51884c4599 Ignore malformed .avsc files
If the file name is wrong, ignore it.
2019-02-04 11:15:39 +02:00
3eb7d89c80 MXS-2304 Use get_service() and get_server() 2019-02-01 17:31:41 +02:00
882d360355 MXS-2304 Use get_size() instead of config_get_size() 2019-02-01 17:23:14 +02:00
b357717149 MXS-2304 Use get_bool() instead of config_get_bool() 2019-02-01 17:18:49 +02:00
6038f1f386 Merge branch '2.3' into develop 2019-02-01 13:55:54 +02:00
f2d2202ea3 MXS-2304 Use get_enum() instead of config_get_enum() 2019-02-01 10:29:24 +02:00
c8a84cebd0 MXS-2304 Use get_integer() instead of config_get_integer() 2019-01-31 18:12:25 +02:00
03411e825d MXS-2271 Move journal_max_age inside settings container 2019-01-31 17:05:35 +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
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
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
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
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
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
6326172325 MXS-2271 Rename basic Monitor fields
Adds the m_-prefix.
2019-01-28 15:41:00 +02:00
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
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
9ac8bf93bb MXS-2271 Rename monitor-related classes
MXS_MONITOR->Monitor
MonitorInstance->MonitorWorker
MonitorInstanceSimple->MonitorWorkerSimple
2019-01-22 15:59:17 +02:00
7fb80c530b Merge branch '2.3' into develop 2019-01-21 14:05:16 +02:00
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
3b55893a20 Combine maxscale/buffer.h with maxscale/buffer.hh 2019-01-17 12:37:40 +02:00
a3fa2f8111 Merge branch '2.3' into develop 2019-01-16 16:31:14 +02:00
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
57fe5ff56a Fix error packet stringification function
The code read past the stack buffer.
2019-01-16 09:43:49 +02:00
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
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
6a23015b64 Convert avro headers to .hh
Required for converting maxscale/buffer.h.
2019-01-15 16:38:10 +02:00
87913f8cb8 MXS-2220 Miscellaneous cleanup
Removes some duplicate includes.
2019-01-11 11:00:24 +02:00
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
7cac2c009d Merge branch '2.3' into develop 2019-01-10 12:43:46 +02:00
9cac927542 MXS-2220 Move server response calculation functions inside class 2019-01-10 10:26:53 +02:00
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
46eddc8102 Rename ReadConn to RCR
RCR is more compact and looks neat.
2019-01-10 07:16:42 +02:00
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
d6df5a7d6a Use router template in readconnroute 2019-01-10 07:15:45 +02:00
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
b30b743455 Rename readconnroute structures
Renamed them with the C++ coding style in mind.
2019-01-10 07:12:30 +02:00
5da833187c Rename readconnroute header
The name now reflects the module and source code name.
2019-01-10 07:12:30 +02:00
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