Commit Graph

5556 Commits

Author SHA1 Message Date
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
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
18a30f05c2 Connect to master on read if master_accept_reads is on
The master should be considered as a valid target when master_accept_reads
is enabled but a connection to it has not yet been created.
2019-03-08 08:20:44 +02:00
bfc874dea1 MXS-2350: Connect on session command with lazy_connect
If a session command is executed when lazy_connect is enabled and no
connections have been created, a connection must be made. This makes sure
that the session isn't closed and that the client receives a response.
2019-03-08 08:20:44 +02:00
24ea222ed6 MXS-2350: Allow lazy connection creation
The lazy connection creation reduces the burden that short sessions place
on the backend servers. This also prevents the problems caused by early
disconnections that happen when only one server is used but multiple
connections are created. This does not solve the problem (MXS-619) but it
does mitigate it to acceptable levels.

This commit also adds a change to the weighting algorithm that prefers
existing connections over unopened ones. This helps avoid the
flip-flopping that happens when the absolute scores are very similar. The
hard-coded value might need to be tuned once testing is done.
2019-03-08 08:20:44 +02:00
95317725ce Merge branch '2.3' into develop 2019-03-07 16:21:03 +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
9572ff84ea Merge branch '2.3' into develop 2019-03-05 10:37:56 +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
83fc3b1bc2 Merge branch '2.3' into develop 2019-03-04 17:43:53 +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
c2459c420d MXS-2304 Rename fields of CONFIG_CONTEXT
Added m_-prefix.
2019-03-04 12:27:36 +02:00
900cbb4cff MXS-2304 Move last config_get_x() functions inside class 2019-03-04 12:27:36 +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
6c05fa7d54 MXS-2302: Use unique_ptr for hint storage
This removes the need to explicitly free them.
2019-03-04 08:48:32 +02:00
d52f685ee2 MXS-2302: Rename hintfilter objects
Renamed the objects to camelcase variants.
2019-03-04 08:48:32 +02:00
e5299e1eab MXS-2302: Move hint parser into its own class
Keeping the parser state internal to a subclass makes the code more
readable and allows the removal of most parameters. It also removes the
need to return iterator ranges from the tokenization function thus making
the Token class obsolete.

Unit testing benefits from this as well as it more closely resembles usage
in the wild as more of the code can be run without a live system.
2019-03-04 08:48:32 +02:00
3fef15e892 MXS-2302: Remove templates from parsing code
The templates were only used to make testing easier and upon review the
gain in testing convenience wasn't large enough to warrant its use.
2019-03-04 08:48:32 +02:00
684ddfd12d MXS-2302: Use filter template in hintfilter 2019-03-04 08:48:32 +02:00
1d49e45036 MXS-2302: Do hint processing in a member function
Also fixed a unit test failure.
2019-03-04 08:48:32 +02:00
f106864659 MXS-2302: Use STL containers for hint storage
The named hints and the hint stack are now stored in STL containers.
2019-03-04 08:48:32 +02:00
2045ac656b MXS-2302: Remove unused hintfilter code
Also moved the token types into the correct file.
2019-03-04 08:48:32 +02:00
ec234124b1 MXS-2302: Remove unused parsing code
Removed all code that is no longer used. The hint stack mechanism is still
in use but can, and should, be replaced with std::vector.
2019-03-04 08:48:32 +02:00
c5a8b693c3 MXS-2302: Take new hint parsing code into use 2019-03-04 08:48:32 +02:00
ca9224bf88 MXS-2302: Rewrite hint tokenization and parsing
The tokenization is somewhat crude but given the small amount of token
types it is acceptably efficient while still maintaining readability. The
parsing is quite simple to implement as a sort of a recursive descent
parser and is a lot more readable that the old state machine
implementation.

Extended the unit test to check that all supported hint types are parsed
correctly. The stack mechanism isn't fully covered by the unit test and it
needs to be added once the stack mechanism uses STL containers.
2019-03-04 08:48:32 +02:00
897fee715d MXS-2302: Use const char* in hintfilter functions 2019-03-04 08:48:32 +02:00
11be8ed0f0 MXS-2302: Add comment extraction code
The code extracts comments from a query. All three comment types are
supported and the double dash comments properly handle invalid input
(fixes MXS-2289).

The code uses iterators to access to the query and returns a list of
iterator pairs as start and end markers to comments. This makes testing
easier as the input and output can be passed as an std::string.
2019-03-04 08:48:32 +02:00
2a63fb0776 MXS-2304 Store config parameter container as value in monitor and service 2019-02-22 16:53:17 +02:00
3fa4a85a1e MXS-2304 Use values instead of pointers in CONFIG_CONTEXT
Simplifies ctor/dtor.
2019-02-22 16:39:45 +02:00
5828c93112 MXS-2304 Convert static config parameter methods to non-static
Parameter handling changed in several places.
2019-02-22 15:17:55 +02:00
afe41c38ed Merge branch '2.3' into develop 2019-02-20 10:33:14 +02:00
9fbaafea91 MXS-2304 Remove additional module parameter classes
Equivalent functionality is now in the basic config parameter class.
2019-02-19 13:52:44 +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
bd3d5bb010 MXS-2329 Use durations in throttle filter 2019-02-19 10:11:57 +02:00
f3acf77a9f MXS-2329 Use durations in ccrfilter
The time window of the ccrfilter is now specified as a duration.
Internally, the time window is still always handled as seconds.
2019-02-19 10:11:57 +02:00
90e5b80b71 MXS-2050 Use global counter to detect log rotation request
Modules need to check the number regularly to detect a new log rotation.
2019-02-15 11:08:14 +02:00
98a081f65b MXS-2050 Separate session log and shared log handling
Shared log file is accessed under a lock.
2019-02-15 11:08:14 +02:00
21d9ec34cf MXS-2330 Use simpler queries
Since the current node id can be obtained using the function gtmnid()
the queries for finding out whether a node is in the quorum and whether
it is softfailed can be made simpler.
2019-02-15 08:09:03 +02:00
5c34550b40 MXS-2330 Do not use softfailed node as hub
When a softfailed node is finally revoked, it will appear as the
single node in a functioning Clustrix cluster. To ensure that the
Clustrix monitor will not stick to that node, if the node that is
used as hub is softfailed, it is immediately replaced with another
node.
2019-02-15 08:09:03 +02:00
1fed465fdb MXS-2246 Remove duplicate info in SERVICE and Service
Both of them contained fields for the service and router names.
Now the names are in SERVICE and they must be accessed via member
function.
2019-02-14 15:24:10 +02:00
2528c5fa4d MXS-2253 Make Cache use the new duration config type
Internally the Cache used seconds, so some changes were needed.
2019-02-14 10:57:55 +02:00
311704cdd9 MXS-2050 Clean up session log checking
Also moved constants around.
2019-02-13 10:36:36 +02:00