2850 Commits

Author SHA1 Message Date
Markus Mäkelä
50b5fe76ef
Pass parameters as const ref to server_alloc 2019-05-10 09:21:52 +03:00
Markus Mäkelä
3813c728b1
Move listener parameter handling into Listener::create
The Listener::create method now takes a set of configuration parameters
from which it constructs a listener. This removes the duplicated code and
makes the behavior of listener creation similar to other objects in
MaxScale. It also allows the configuration parameters to be stored in the
listener object itself.
2019-05-10 09:21:52 +03:00
Johan Wikman
23a09a6294 MXS-2455 Use mxb::Buffer::iterator
Simplifies the code and as extra allocations etc. are only
made when info is enabled, and can thus be ignored.
2019-05-09 15:04:03 +03:00
Johan Wikman
381940ce8c Merge branch '2.3' into develop 2019-05-09 14:35:44 +03:00
Markus Mäkelä
59f2145c00
Allocate blr heartbeat buffer on correct worker
The buffer was allocated on one worker and written on another.
2019-05-09 12:30:29 +03:00
Markus Mäkelä
788dc429f8
Do client callback on owning worker
The callback should've been done on the worker that owns the DCB instead
of the main worker.
2019-05-09 12:30:26 +03:00
Markus Mäkelä
bad96e411a
Merge branch '2.3' into develop 2019-05-08 10:30:58 +03:00
Johan Wikman
c818b1208a MXS-2455 Recognize transaction rollbacks
All transaction rollback errors have an sql_state like "40XXX".
So, when an error reply is received we check for that and act
accordingly.
2019-05-08 10:00:50 +03:00
Markus Mäkelä
0638ea736e
Write slave heartbeat in correct thread
The writing should be done on the worker that owns the DCB.
2019-05-08 09:44:55 +03:00
Markus Mäkelä
20a7170024
Fix unit tests that use durations
The tests that used objects that expected a default value for a duration
failed due to missing parameters.
2019-05-06 15:38:43 +03:00
Markus Mäkelä
3dd9298b18
MXS-2456: Test transaction replay cap
Added a test that makes sure the transaction replay cap is respected. Also
improved the logging to show how many transaction replay attemps have been
done and to log if a replay is not done due to too many attempts.
2019-05-02 16:59:36 +03:00
Markus Mäkelä
26b2897280
MXS-2456: Cap transaction replay attempts
In most cases it is reasonable to stop attempting transaction replays
after a certain number of failed attempts. This prevents transactions from
being repeatedly replayed on the same server over and over again if, for
example, it keeps crashing.
2019-05-02 16:59:36 +03:00
Esa Korhonen
82b4338eca Remove MonitorManager calls from Monitor functions
Also adds admin thread checks to MonitorManager functions and combines
anonymous namespaces.
2019-04-30 13:45:48 +03:00
Johan Wikman
2115322737 MXS-2329 Change warning into info
Currently it's too laborious to use duration suffixes when saving
generated configs and also to handle suffixes when changes are made
dynamically using maxctrl.

It will be trivial to do that when the new configuration mechanism
has been taken into use everywhere. That will not happen before
MaxScale 2.5.

So, in MaxScale 2.4 duration suffixes will be accepted in manually
created configuration files, but no warning will be logged if a
suffix is not used.
2019-04-30 13:02:53 +03:00
Johan Wikman
aa3057695b MXS-2329 Use durations in schema router 2019-04-30 13:02:53 +03:00
Johan Wikman
ea243fd8ba MXS-2329 Use durations in readwritesplit 2019-04-30 13:02:53 +03:00
Johan Wikman
0f5972e010 MXS-2329 Use durations with BLR:[heartbeat|connect_retry] 2019-04-30 13:02:53 +03:00
Esa Korhonen
643514bbe4 Merge branch '2.3' into develop 2019-04-30 12:46:07 +03:00
Esa Korhonen
dd188962cd MXS-2427 Check all hints when routing
Now considers other routing hints if first one fails. The order is inverted compared
to e.g. namedserver filter settings because of how routing hints are stored. If all hints
are unsuccessful, route to any slave.
2019-04-29 16:49:32 +03:00
Markus Mäkelä
ea14331d18
Move DCB owner selection into Listener
The code that selects which worker to assign the DCB to is now completely
in the Listener class. This removes the need to change the ownership of a
DCB after it has been allocated.
2019-04-26 13:18:37 +03:00
Johan Wikman
01b1d469a8 MXS-2435 Handle recoverable Clustrix errors
If
- transaction replay is enabled,
- an error is returned and
- the error is one of the recoverable Clustrix errors
we will retry the transaction.

If it succeeds, then the client will not notice anything but
for a short delay.

Note that the error message is looked for irrespective of whether
the backend is Clustrix or not. However, as errors are not common
the price for doing that can probably be ignored.

However, a bigger problem is that explicit knowledge of different
backends should *not* be coded into routers.
2019-04-26 10:54:57 +03:00
Johan Wikman
d8a9405998 MXS-2435 Refactor error message extracting
Access to the error message is needed in different contexts.
Now the extraction code itself can be shared.
2019-04-26 10:54:57 +03:00
Markus Mäkelä
07ea6bd9ba
MXS-2450: Don't discard history if it's disabled
If the session command history is not enabled, it shouldn't be discarded
when a COM_CHANGE_USER is executed.
2019-04-25 11:49:01 +03:00
Markus Mäkelä
6aedcc085f
Remove references to NDB server state 2019-04-24 14:15:56 +03:00
Markus Mäkelä
691dc4d1b6
Remove telnetd and debugcli
The modules were deprecated.
2019-04-24 14:01:31 +03:00
Markus Mäkelä
4186f39616
Merge branch '2.3' into develop 2019-04-23 12:11:09 +03:00
Markus Mäkelä
24fc82e160
Move large query processing inside RWBackend
The knowledge of which function to call can be internal to RWBackend. This
make the use of the class easier as one can simply write to the backend.
2019-04-18 13:58:34 +03:00
Markus Mäkelä
3e04922565
MXS-2415: Fix client callbacks in arvorouter
The DCB callbacks shouldn't be used to send more events as they cause the
callback to be called recursively. The recursive calls caused rows to be
sent before the schemas for the rows were sent. Queuing the events via the
worker mechanism prevents this.
2019-04-17 16:07:05 +03:00
Markus Mäkelä
733dc491d9
Integrate Replicator into avrorouter
Took the Replicator into use in avrorouter as an alternative to the
binlogrouter based setup. This also allows the avrorouter to automatically
handle master failovers and to start replication from GTID coordinates.
2019-04-17 14:13:44 +03:00
Markus Mäkelä
7723e7c933
Add modified Replicator for avrorouter
Repurposed the Replicator from the CDC integration project as a
replication event processing service. It is similar to the CDC version of
the Replicator and is still in the same namespace but it lacks all of the
cross-thread communication that was a part of the integration project.
2019-04-17 14:13:44 +03:00
Markus Mäkelä
363bb5aa56
Update Connector-C to 3.1
Updated the connector to 3.1 as it adds support for the replication
protocol.
2019-04-17 14:13:44 +03:00
Markus Mäkelä
c643f9bc8d
Merge branch '2.3' into develop 2019-04-12 13:23:49 +03:00
Markus Mäkelä
ec890b33cd
Prevent checksum mismatch on second trx replay
If a transaction replay has to be executed twice due to a failure of the
original candidate master, the query queue could contain replayed
queries. The replayed queries would be placed into the queue if a new
connection needs to be created before the transaction replay can start.
2019-04-05 13:33:16 +03:00
Markus Mäkelä
6421af1bb4
Backport query queue changes to 2.3
Backported the changes that convert the query queue in readwritesplit into
a proper queue. This changes combines both
5e3198f8313b7bb33df386eb35986bfae1db94a3 and
6042a53cb31046b1100743723567906c5d8208e2 into one commit.
2019-04-05 13:33:16 +03:00
Markus Mäkelä
daf5f52c64
Pass raw password to users_auth
By passing the raw password deeper into the authentication code, it can be
used to verify the user can access some systems. Right now, this is not
required by the simple salted password comparison done in MaxScale.
2019-04-05 00:42:00 +03:00
Markus Mäkelä
2aa3515fc8
Merge commit '09cb4a885f88d30b5108d215dcdaa5163229a230' into develop 2019-04-04 14:34:17 +03:00
Markus Mäkelä
a217dde1f0
MXS-2419: Queue queries executed during trx replay
By storing the queries in the query queue and routing it once the
transaction replay is done, we prevent two problems:

* Multiple transaction replays would overwrite the m_interrupted_query
  buffer that was used to store any queries executed during the
  transaction replay.

* Incorrect ordering of queries when the query queue is not empty and a
  new query is executed during transaction replay.
2019-04-03 12:57:05 +03:00
Markus Mäkelä
2dfd7d35ac
MXS-2418: Crash on trx replay when log_info is enabled
If the session starts with no master but later one becomes available, when
a transaction is started the code would unconditionally use the master's
name in a log message.
2019-04-03 12:57:05 +03:00
Markus Mäkelä
5242cd5ebf
Readwritesplit: Graceful maintenance mode
By allowing transactions to the master to end even if the server is in
maintenance mode makes it possible to terminate connections at a known
point. This helps prevent interrupted transactions which can help reduce
errors that are visible to the clients.
2019-04-02 14:21:54 +03:00
Esa Korhonen
d89f0c062b MXS-2271 Change Monitor->m_name to std::string
Also, monitor address is no longer printed.
2019-04-02 13:08:38 +03:00
Esa Korhonen
841bdf4d0f Merge branch '2.3' into develop 2019-03-28 15:33:09 +02:00
Markus Mäkelä
116efb2409
MXS-2379: Fix maxinfo HTTP interface
Added the missing HTTP request handlers and a new JSON conversion
function.
2019-03-28 14:03:56 +02:00
Markus Mäkelä
6bc2c54081
Merge commit 'a78f0fbe2537542dc7f3f0dd8b19b93ac8d9d7f8' into develop 2019-03-28 13:53:40 +02:00
Markus Mäkelä
18cd890474
Fix binlogrouter slave heartbeat task addition
The task was added multiple times when only one task is needed.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
5ee9b74770
Fix readwritesplit server selection
If a server with zero weight was chosen as the only candidate, it was
possible that the starting minimum value was smaller than the server
score. This would mean that a candidate wouldn't be chosen if the score
was too high. To preven this, the values are capped to a value smaller
than the initial minimum score.
2019-03-28 13:21:23 +02:00
Esa Korhonen
c4b82b7d83 MXS-2359 Route statements with database but no table dependence
Queries such as SHOW TABLES FROM db1 are now routed to the backend with db1.
This gives the correct result as long as db1 is not sharded to multiple
backends.
2019-03-27 13:46:36 +02:00
Esa Korhonen
ee88180c54 MXS-2409 Check that prepared statement exists
If the PREPARE is malformed, the extracted statement is null.
2019-03-27 13:46:36 +02:00
Niclas Antti
d40e29d5f6 A little houskeeping.
Increasing counter sizes from int to long for averages.
Rename random functions to end with _co instead of _exclusive to
indicate range [close, open[, and to allow future suffixes oc, cc and oo.
2019-03-27 13:15:14 +02:00
Esa Korhonen
c6272594d6 MXS-2359 Remove special handling for SHOW TABLES
The code only handled the basic version of the command, returning incorrect
results if modifiers were used. The code is now removed, causing the command
to be routed to the backend of the current database. This will give correct
results as long as that backend contains all the tables of the database e.g.
no table sharding.
2019-03-27 10:30:29 +02:00
Markus Mäkelä
f8bc6b18fc
Only add tasks once in binlogrouter
Adding the same task twice isn't allowed. The API of the housekeeper tasks
might have to be changed in a way that makes it possible for the caller to
know whether a task has been added.
2019-03-26 13:44:04 +02:00