9560 Commits

Author SHA1 Message Date
Markus Mäkelä
14a4008c84
MXS-1653: Remove false error message
Removed false error message about failed session commands. An error in
response to a session command is a perfectly valid result.

Also added the explicit commands that the master and slave return to the
warning that is logged when the results differ.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
2181c9d240
Include MariaDB Connector-C headers first
The MariaDB Connector-C headers that are built by MaxScale must be
included before any system headers.

Fixed code that explicitly included the <mysql.h> header to use the
<maxscale/protocol/mysql.h> wrapper instead.
2018-02-07 16:07:17 +02:00
Markus Mäkelä
6dbec397dc
Fix false debug assertion and clarify error message
The debug assertion wasn't well placed as it is perfectly possible that a
master connnection exists but it is not in use. This can be further
checked by asserting that the master is indeed closed and not in use.

Moved the original debug assertion into a separate branch that should
catch any errors in the routing logic.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8558ace801
Clean up ignore_external_masters code
Removed redundant checks and cleared only bits that aren't already
cleared.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
6a1aba70e7
Add test case for ignore_external_masters + failover
The test checks that failover works even when the master of the monitored
cluster is a slave to an external masters. The test also verifies that the
servers do not get unexpected status labels.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
8bf756ca56
Update root_master when using a standalone master
When detect_standalone_master is enabled, the root_master variable was not
updated after the master was changed by the standalone server detection
mechanism. This caused debug assertions to fire in addition to possibly
causing some of the ignore_external_masters logic to break.
2018-02-07 16:07:16 +02:00
Markus Mäkelä
4420730f31
Start all tests with read_only disabled
Explicitly checking and setting read_only allows all tests to have a
consistent backend state.
2018-02-07 16:07:16 +02:00
Esa Korhonen
1cf3de4a74 Add config parameter for excluding servers from failover
"servers_no_promotion" is a comma-separated list of servers
which cannot be chosen when selecting a new master during failover
(auto or manual), or when automatically selecting a new master
for switchover (currently disabled).

The servers in the list are redirected normally and can be promoted
by switchover when manually selecting a new master.
2018-02-07 14:07:10 +02:00
Markus Mäkelä
6f6c11e6a3
Ignore events for closed DCBs
If a closed DCB receives an event, it is ignored.
2018-02-06 16:36:04 +02:00
Markus Mäkelä
4089b6b6fd
MXS-1647: Detect API version mismatch
If the API versions do not match, MaxScale will treat this as an
error. The API versioning would allow backwards compatible changes but the
functionality to handle that is not implemented in MaxScale.

Updated API versions based on changes done to module APIs in 2.2.
2018-02-06 14:51:07 +02:00
Markus Mäkelä
6132ebd24f
MXS-1643: Add test case
Added test case that checks that the correct state changes are made and no
extra events are triggered.

Also cleaned up the log checking function.
2018-02-06 14:51:07 +02:00
Johan Wikman
90fdbf8860 MXS-1652 Add possibility to log SQL statements
With the flag --debug=enable-statement-logging it is now possible
to instruct MaxScale to log all SQL statements it sends to the
servers.

The format of the logged string looks like:

    notice : SQL(127.0.0.1): 0, "SELECT ..."

First the fixed string "SQL", followed by the server address in
parenthesis followed by the actual return value of mysql_query(),
followed by the statement itself.

The "SQL" string makes the lines easy to grep for and having the
return value before the statement makes it easier to spot since
the length of the return value string does not wary much, but the
length of the statements do wary a lot.
2018-02-06 14:30:29 +02:00
Esa Korhonen
4a478d31f3 Print Gtid IO position during monitor diagnostics 2018-02-05 17:21:20 +02:00
Markus Mäkelä
f6afb0c6d1
MXS-1643: Make Master and Slave status mutually exclusive
The Master status now prevents Slave status from being assigned to a
server. In practice this simply means that the master will not have both
the Master and Slave status bits.
2018-02-05 16:53:43 +02:00
Markus Mäkelä
9f7189a9a4
Sync slaves and writer thread in binlog_change_master
The test uses a separate writer thread to insert data into the
master. This thread must be halted before the blocking of the master
happens as the slaves must catch up. Once slaves have caught up and the
master is blocked, the writer thread can continue doing inserts.

At the end of the test slaves must also be synchronized before the
inserted data is validated. This prevents test failures due to slave lag.
2018-02-05 10:24:51 +02:00
Markus Mäkelä
aac8c41800
Merge branch '2.1' into 2.2 2018-02-05 10:17:31 +02:00
Markus Mäkelä
e670596486
Fix local_address
It included the list instead of the vector header.
2018-02-05 09:33:40 +02:00
Johan Wikman
e1f1d8e58a Merge branch '2.1' into 2.2 2018-02-02 16:05:14 +02:00
Johan Wikman
facb8d60f7 MXS-1635 Test program for local_address
Tests that local_address is taken into account. However, at the time
of writing the maxscale VM does not have two usable IP addresses, so
we only test that explicitly specifying an IP-address does not break
things.

Locally it has been confirmed that this indeed works the way it is
supposed to.
2018-02-02 15:17:22 +02:00
Johan Wikman
7ae931ce9c MXS-1635 Allow using specific address when connecting
In some cases you might want to use a specific address/interface
when connecting to a server instead of the default one. With the
global parameter 'local_address' it can now be specified which
address to use.
2018-02-02 15:17:22 +02:00
Markus Mäkelä
d7d2d3349d Reset server configuration in check_backend
By resetting the configuration in the check_backend test, the backend
servers are guaranteed to use the correct configuration when started.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
84845a5732 Use basic configuration for mxs812_2
The test repeatedly blocks and unblocks a master which goes unnoticed by
the monitor due to the 10 second read timeouts in the monitor
configuration in the longblob template. The replication template uses the
default timeouts which makes the test actually exercise the functionality
that it is intended to test.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
0d037b2c24 Add configuration reset command
Resetting the settings makes it possible to start a test from a known good
configuration.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
8c8aaeae8e Prevent double closing of client DCB
If the client is closing the connection but routing the COM_QUIT fails,
the DCB would be closed twice.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
9f0a691233 Always stop the session by closing the client DCB
By always starting the session shutdown process by stopping the client
DCB, the manipulation of the session state can be removed from the backend
protocol modules and replaced with a fake hangup event.

Delivering this event via the core allows the actual dcb_close call on the
client DCB to be done only when the client DCB is being handled by a
worker.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
ebf0d6fc5f Close client DCB with a hangup in the backend protocol
Directly closing the client DCB in the backend protocol modules is not
correct anymore as the state of the session doesn't change when the client
DCB is closed. By propagating the shutdown of the session with a fake
hangup to the client DCB, the closing of the DCB is done only once.

Added debug assertions that make sure all DCBs are closed only
once. Removed redundant code in the backend protocol error handling code.
2018-02-02 12:28:07 +02:00
Markus Mäkelä
7093a5bdf8 Fix CREATE TABLE tokenization
The token skipping function did not check for a period or an opening
parenthesis when parsing the test. Also fixed a debug assertion when only
NULL values were inserted.
2018-02-02 12:24:26 +02:00
Markus Mäkelä
943c82b33b Extend cdc_datatypes test
The test now also creates TIME type values and checks that they are
converted correctly. Also added NULL value tests for all values and made
required adjustments to the code.
2018-02-02 12:24:25 +02:00
Esa Korhonen
a83b36ca45 Use 64 bits for storing server id
In debug mode, when scanning the server id from a string, check that resulting
number is 32bit. Also, when querying the server id, query the global version.
Now, if a super user modifies the server id the monitor will notice it.

Server id:s in gtid:s are handled similarly.
2018-02-02 11:34:32 +02:00
Timofey Turenko
2c04adafd1 fix kerberos test and mxs1516 test 2018-01-31 18:17:50 +02:00
Markus Mäkelä
8ebac86406 Simplify mxs431
The test unnecessarily restarted MaxScale for no obvious reason. Cleaned
up SQL queries to use new functionality.
2018-01-31 13:38:45 +02:00
Markus Mäkelä
12f5cabc50 Discard fake events for closed DCBs
If a fake event is sent to a DCB that has been closed, it should be
discarded.
2018-01-31 13:38:45 +02:00
Markus Mäkelä
1febafabf3 Crash after double close on debug builds
When a double close is detected in a debug build, a debug assertion is
triggered. This will generate a core dump which should help investigate
the double close.
2018-01-31 13:38:45 +02:00
Markus Mäkelä
26d3de7a3b Skip parsing when in read-only transaction
As chages to the transaction state are detected by the protocol level
mini-parser, there's no need to fully classify queries inside read-only
transactions. This should be a good performance boost for loads that
heavily use read-only transactions.
2018-01-31 13:38:45 +02:00
Markus Mäkelä
d506f01de9 Add basic MaxCtrl test
The test does a very minimal check for MaxCtrl functionality.
2018-01-31 13:38:28 +02:00
Markus Mäkelä
4b7c334c1b Add a timeout to mxs1585
The test will hang if one of the threads doesn't exit. To detect failures
faster, a timeout is needed.
2018-01-31 13:38:28 +02:00
Markus Mäkelä
f53e112bf4 Don't write errors to dummy sessions
If a DCB is closed before a response to the handshake packet is received,
the DCB's session will point to the dummy session. In this case no error
should be written to the DCB.
2018-01-31 13:38:28 +02:00
Esa Korhonen
255250652d Refactor pre-switchover, add similar checks as in failover
Now detects some erroneous situations before starting switchover.
Switchover can be activated without specifying current master.
In this case, the cluster master server is selected.
2018-01-31 10:40:09 +02:00
Markus Mäkelä
ea58b16a7a Add missing include for vector
The vector header was not included in dbfwfilter.hh.
2018-01-30 19:14:28 +02:00
Esa Korhonen
c7474e439e Print new parameters during diagnostics
Also, copy using strdup instead since config_copy_string()
returns null for empty strings.
2018-01-30 18:40:33 +02:00
Markus Mäkelä
3dfb972d87 Merge branch '2.1' into 2.2 2018-01-30 16:28:11 +02:00
Markus Mäkelä
6dcc71d862 MXS-1621: Fix minor bugs caused by previous changes
Used the correct value in table_create_alloc and remove unused
parameter. Use the pre-calculated end pointer when looking for events.
Always use the column count of the TABLE_MAP event as all mismatches are
detected earlier.
2018-01-30 15:59:06 +02:00
Markus Mäkelä
66ec4792cd MXS-1575: Fix DATETIME handling
DATETIME values in old formats should always be 8 bytes long. This is how
MariaDB 10.2 stores them and only DATETIME2 values are stored with a
fractional part.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
93923acafb MXS-1621: Skip unneeded ALTER TABLE operations
Some ALTER TABLE operations (e.g. ADD INDEX) are not useful to the
avrorouter. These need to be detected and skipped.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
e14710ab2b Fix ALTER TABLE detection regex
The regular expression expected that the COLUMN keyword was always
present.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
df86ee3579 Fix buffer overflow assertions
The buffer overflow assertions were off by one: The data pointer can be
equal to the end pointer when the last column of the row is processed.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
9146a215f7 Fix DDL table identifier parsing
The parsing was inadequate and did not support all forms of quoted
identifiers.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
b7e475f316 MXS-1621: Detect TABLE_MAP ↔ TABLE_CREATE column count mismatch
If the TABLE_MAP and TABLE_CREATE have different column counts, an error
is logged and the row events are skipped.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
c000b3186c MXS-1575: Fix optional COLUMN keywork handling
The COLUMN keyword is optional and cannot be assumed to exist.
2018-01-30 15:59:05 +02:00
Markus Mäkelä
8dfb1d0113 MXS-1621: Add ALTER TABLE ... [FIRST | AFTER col ] parsing
The parser checks whether the FIRST or AFTER keywords are used and, if
AFTER is used, extracts the relevant column name.

Added a test case that checks that the parsing works and detects the
correct column names.
2018-01-30 15:59:05 +02:00