10898 Commits

Author SHA1 Message Date
Markus Mäkelä
0911c664b1
MXS-1549: Add basic test case
Added a basic test case that checks that the functionality works as
expected.
2018-07-02 13:29:19 +03:00
Markus Mäkelä
56f274d74a
Add Connection helper class
This is intended to make querying a "server" easier by wrapping common
functionality into one class.
2018-07-02 13:29:19 +03:00
Markus Mäkelä
12398bfc26
MXS-1549: Implement optimistic transaction execution
When the `optimistic_trx` mode is enabled, all transactions are started on
a slave server. If the client executes a query inside the transaction that
is not of a read-only nature, the transaction is rolled back and replayed
on the master.
2018-07-02 13:29:19 +03:00
Markus Mäkelä
391618d53b
MXS-1549: Add documentation for optimistic_trx
Added parameter documentation and explained the limitations it has.
2018-07-02 13:29:18 +03:00
Markus Mäkelä
af45006567
MXS-1549: Add optimistic_trx parameter
The optimistic_trx parameter will control whether transactions are assumed
to be read-only and will be optimistically executed on slave
servers. Currently, the parameter does nothing.
2018-07-02 13:29:18 +03:00
Markus Mäkelä
d6a964304b
MXS-1549: Always store previous target
Unconditionally update the previous target on each routed query. This
allows routing to the previous server in case it is needed. One example of
this is a new type of hint that allows routing to the same server where
the previous query was sent.

Also added a minor clarifying comment to the resetting of the
current_query.
2018-07-02 13:29:18 +03:00
Markus Mäkelä
a417567a18
Format readwritesplit with Astyle
Formatted readwritesplit with Astyle. Changed the initialization of
Backend::m_modutil_state to use curly braces to cope with Astyle's lack of
support for curly braces inside parentheses.
2018-07-02 13:29:18 +03:00
Markus Mäkelä
e610b285b9
MXS-1549: Count RO and RW transactions in readwritesplit
Readwritesplit now keeps track of how many read-only and read-write
transactions have been executed. This allows a coarse estimation of how
widely read-only transactions are done even without explicit read-only
transactions being used (i.e. START TRANSACTION READ ONLY).
2018-07-02 13:29:17 +03:00
Markus Mäkelä
b59f607471
MXS-1549: Track transaction type in the query classifier
The characteristics of a transaction can now be tracked by the query
classifier. This allows read-only and read-write transaction statistics to
be calculated.
2018-07-02 13:29:17 +03:00
Markus Mäkelä
ccdbfa8997
Fix test compilation failures
The tests failed to compile due to invalid use of try_query. For some
reason this wasn't detected by newer compilers.

Also fixed the compilation failure of mxs1713_lots_of_database on CentOS
7.
2018-07-02 12:45:57 +03:00
Markus Mäkelä
fa83901d03
Silence routing failure warnings when retrying queries
If a routing failure happens while a query can still be retried, it should
not be logged.
2018-06-30 19:26:24 +03:00
Markus Mäkelä
ee98ce1ee8
Expand mxs1507_trx_replay
Handle the problematic transaction with session command as well as empty
transactions. Also changed test to use wait_for_monitor as well as pass
the value to check as a parameter to the `check` function.
2018-06-30 19:26:23 +03:00
Markus Mäkelä
93fdada534
Fix crash on trx replay with session command
Readwritesplit would crash with the following transaction:

    BEGIN;
    SET @a = 1; -- This is where it would crash
    COMMIT;

When a session command was a part of the transaction, empty queries
(i.e. NULL GWBUFs) would be added to the transaction. If the transaction
were to be replayed, MaxScale would crash when these NULL queries were
executed.

Once the empty responses were fixed, the replaying of the transaction
would fail with a checksum mismatch. This was caused by the wrong order of
processing in RWSplitSession::clientReply. The response processing for
session commands was done after the response processing for replayed
transactions. This would trigger a checksum comparison too early for the
transaction in question.
2018-06-30 19:26:23 +03:00
Markus Mäkelä
9737962add
Add printf attribute to all variadic functions
The test methods that take printf style input now have the printf
attribute. This enables format checks making oversights less likely.

Also fixed any existing errors in the code. Only the one in
test_binlog_fnc.cpp would've had an actual effect.
2018-06-30 19:26:23 +03:00
Esa Korhonen
a59c0c61ce Remove depth field from SERVER
It was not really used anymore.
2018-06-29 10:54:34 +03:00
Esa Korhonen
960d08a36a Code cleanup
Removed unused code.
2018-06-29 10:54:34 +03:00
Johan Wikman
0afcd4b468 Fix test-program failures
Due to recent changes, mxs::MessageQueue::init() must be called
explicitly, if a monitor is created.
2018-06-29 10:43:49 +03:00
Esa Korhonen
9525d3507b Run manual commands without stopping the monitor
The command is saved in a function object which is read by the monitor
thread. This way, manual and automatic cluster modification commands are
ran in the same step of a monitor cycle.

This update required several modifications in related code.
2018-06-28 16:56:41 +03:00
Esa Korhonen
6bf10904d7 MXS-1845 Only rebuild topology when required
The monitor now detects when a server has changed such that a replication
graph rebuild is needed and only then rebuilds the graph and detects
cycles and master.

Also, some old code is no longer called in the monitor cycle. It will be
removed in later commits. Refactored some of the related functions.
2018-06-28 16:56:41 +03:00
Johan Wikman
dc4a555c70 Merge branch '2.2' into develop 2018-06-28 10:34:41 +03:00
Johan Wikman
c33837c906 Update release date of 2.2.10 2018-06-28 10:25:54 +03:00
Markus Mäkelä
a6182d48bf
MXS-1643: Only test existence of extra events mxs1643_extra_events
Don't test failover functionality when it is not needed. The bug is only
about the extra events that appear when a master is demoted and a slave is
promoted.
2018-06-27 10:49:32 +03:00
Johan Wikman
b5fdcf66ab Make test_event.cc more resilient
- Work on both Debian and RedHat systems.
- Ignore test if authentication log cannot be found or cannot be read.
2018-06-27 09:30:31 +03:00
Markus Mäkelä
b7fdaf0340
Use wait_for_monitor in mxs1643_extra_events
Replace hard-coded sleeps in mxs1643_extra_events with
Maxscales::wait_for_monitor.
2018-06-27 08:49:55 +03:00
Markus Mäkelä
f49c31625d
Use derived version of write for session commands
Prepared statements via readwritesplit need to have their IDs mapped from
the internal representation to the backend specific one. The RWBackend
class does this in its write method but the fix in commit
e561c3995c7396cf3749ccdf6a3357d7dd32c856 caused this to be bypassed and
the base version was always used.
2018-06-27 08:49:54 +03:00
Markus Mäkelä
f97f422379
Don't use closed backends
Only use backends that are still in use. The COM_STMT_EXECUTE and
COM_STMT_FETCH relationship caused unused backends to be used.
2018-06-27 08:49:21 +03:00
Markus Mäkelä
d5bdc3febd
Fix formatting for dump_last_statements
A backtick was missing.
2018-06-27 08:49:20 +03:00
Johan Wikman
4d7121593e MXS-421 Update change log and release notes 2018-06-26 11:54:00 +03:00
Johan Wikman
1eddb29d91 MXS-1915 Move Monitors on top of mxs::Worker
Monitors are now workers, so the path for making all interaction
between MaxScale proper and the monitors message based is now
open.
2018-06-26 09:19:46 +03:00
Johan Wikman
8ea7d8898a MXS-1915 Remove id from mxs::Worker
The id has now been moved from mxs::Worker to mxs::RoutingWorker
and the implications are felt in many places.

The primary need for the id was to be able to access worker specfic
data, maintained outside of a routing worker, when given a worker
(the id is used to index into an array). Slightly related to that
was the need to be able to iterate over all workers. That obviously
implies some kind of collection.

That causes all sorts of issues if there is a need for being able
to create and destroy a worker at runtime. With the id removed from
mxs::Worker all those issues are gone, and its perfectly ok to create
and destory mxs::Workers as needed.

Further, while there is a need to broadcast a particular message to
all _routing_ workers, it hardly makes sense to broadcast a particular
message too _all_ workers. Consequently, only routing workers are kept
in a collection and all static member functions dealing with all
workers (e.g. broadcast) have now been moved to mxs::RoutingWorker.

Now, instead of passing the id around we instead deal directly
with the worker pointer. Later the data in all those external arrays
will be moved into mxs::[Worker|RoutingWorker] so that worker related
data is maintained in exactly one place.
2018-06-26 09:19:46 +03:00
Johan Wikman
86b5238aaf MXS-1915 Replace worker id with worker pointer
To get rid of the need that a Worker must have an id, we store
in the MXS_POLL_DATA structure a pointer to the owning worker
instead of the id of the owning worker. This also allows some
further cleanup as the need for switching back and forth between
the id and the worker disappears.

The id will be moved from Worker to RoutingWorker as there
currently is a fair amount of code that assumes that the id of
routing workers start from 0.
2018-06-26 09:19:46 +03:00
Johan Wikman
241c9b645d MXS-1915 Remove unused functions 2018-06-26 09:19:46 +03:00
Johan Wikman
5cf6a9ed22 MXS-1915 Allow Worker to be used stand-alone
It's no longer necessary to inherit from Worker in order to use
it, but it can now be used in a stand-alone fashion. This fits
the MonitorInstance use-case better.
2018-06-26 09:19:46 +03:00
Johan Wikman
063e9b9a36 MXS-1939 Remove leak in cache test program 2018-06-25 12:12:20 +03:00
Johan Wikman
f7ca8d1494 MXS-1939 Ensure no leaks when there is an array of rules
In case an array of cache rules is provided, we will only store
references to the objects in the array. Consequently, the counts of
the borrewed references to the objects must be increased, and the
reference count of the array itself decreased.
2018-06-25 12:08:44 +03:00
Johan Wikman
b7451c13bf MXS-1939 Fix leaks in mock-class
The mock-class used in the cache testing leaked memory.
2018-06-25 11:27:53 +03:00
Johan Wikman
fd202c9339 Look for more ASAN llibrary versions
On Ubuntu libasan.so.1 and libasan.so.2 are present.
2018-06-25 11:01:08 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
b8e0c31872
Merge branch '2.2' into develop 2018-06-25 09:37:18 +03:00
Johan Wikman
82af399fb1 Add 2.2.10 release notes
And update the change log.
2018-06-25 09:19:30 +03:00
Markus Mäkelä
6183fab79b
MXS-1938: Log query for inconsistent replies
If a session command produces a different result on the slave than it did
on the master, a warning is logged. This warning now also logs the query
that was being executed to make investigation of the problem easier.
2018-06-25 08:44:13 +03:00
Marko
f308dd281a MXS-1849 Combine table and database mapping
Previously schemarouter only mapped databases to the servers
they were resided on. Now all the tables are also mapped to allow the
router to route queries to the right server based on the tables used in
that query.
2018-06-24 22:26:36 +03:00
Marko
b38cac4939 MXS-1849 Add functions for mapping tables to servers 2018-06-24 22:26:36 +03:00
Markus Mäkelä
249e66756f
Fix run_session_hang.sh
The script it called used the wrong variable name.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
2c5dacf9ae
Clean up mxs314
Removed excessive output, used stack allocated objects, simplified
assertions.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
3d8f946e19
Take dump_stacktrace into use
MaxScale and tests now both use the same code to dump stacktraces.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
c32e6a7c3f
Add stacktrace generation to maxbase
The stacktrace generation is now a part of the maxbase library. The code
is the same code that was previously defined in gateway.cc as a part of
MaxScale.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
be853a448c
Link tests against maxutils
The tests now link against the maxutils libraries. Currently, the maxutils
libraries consist of only the maxbase library.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
7254a7c525
Make maxutils a standalone library
The only way to cleanly separate the maxutils library from the MaxScale
CMake project is to make it a standalone CMake project. With the help of
ExternalProject, it should be relatively easy to use.
2018-06-22 13:59:57 +03:00
Markus Mäkelä
b96228f95c
Merge branch '2.2' into develop 2018-06-22 10:44:39 +03:00