10308 Commits

Author SHA1 Message Date
Markus Mäkelä
092532745d
MXS-1507: Add transaction size limit
Added the `transaction_replay_max_size` parameter that controls the
maximum size of a transaction that can be replayed. If the limit is
exceeded, the stored statements are released thus preventing the
transaction from being replayed.

This limitation prevents accidental misuse of the transaction replaying
system when autocommit is disabled. It also allows the user to control the
amount of memory that MaxScale will use.
2018-04-26 13:44:26 +03:00
Markus Mäkelä
cffed86962
MXS-1507: Add basic functional test
Added functional tests that cover the basic cases.
2018-04-26 13:44:26 +03:00
Markus Mäkelä
cb5917b346
MXS-1507: Clarify transaction replay limitations
Only transactions that return identical results can be replayed.
2018-04-26 13:44:26 +03:00
Markus Mäkelä
7de7e7b2fe
MXS-1507: Replay read-only transaction
Read-only transactions are now replayed if the node in question fails.
2018-04-26 13:44:25 +03:00
Markus Mäkelä
2848f96945
MXS-1507: Make transaction replay configurable
The transaction retrying behavior is now configurable and documented. The
`transaction_replay` parameter implicitly enables the required
functionality in the router that it needs.
2018-04-26 13:44:25 +03:00
Markus Mäkelä
c1c942a058
MXS-1507: Retry interrupted queries in transactions
As the current query was added to the transaction log before it finished,
the m_current_query contained a duplicate of the latest transaction log
entry. To correctly log only successful transactions, the statement should
be added only after it has successfully completed. This change also
removed the unnecessary cloning that took place when the statement was
added to the log before it finished.

With the fixed transaction logging, the value of m_current_query can be
stashed for later retrying while the replay process is happening. If the
replay completes successfully and the checksums match, the interrupted
query is retried.

Also added a clarifying comment to can_retry_query to explain why a query
inside a transaction cannot be retried.
2018-04-26 13:44:25 +03:00
Markus Mäkelä
01bf5cc8b0
MXS-1507: Add initial implementation of transaction replay
Added the initial implementation of transaction replay. Transactions are
only replayed if the master fails when no statement is being executed.

The validity of the replayed transaction is done by verifying that the
checksums of the returned results are equal.

Added a close function into the Trx class to make resetting its state
easier. Also changed the return type of the pop_stmt to GWBUF* as the
places where it is used expect a raw GWBUF pointer.
2018-04-26 13:44:25 +03:00
Markus Mäkelä
daecb6980b
MXS-1507: Use same mechanism for all delayed routing
Passing the delay to the retry_query function allows the same function to
be used in all cases. This removes duplicate code.
2018-04-26 13:44:25 +03:00
Markus Mäkelä
92e0b944a9
MXS-1810: Create reset method for Checksum
Resetting checksum calculations avoids some unnecessary calculations when
the result is not needed.
2018-04-26 13:44:24 +03:00
Markus Mäkelä
050af8fb52
MXS-1810: Create Trx class
The class encapsulates the relevant information of a transaction.
2018-04-26 13:44:24 +03:00
Markus Mäkelä
94038933d8
MXS-1810: Store transaction contents
The queries that make up the transaction are now stored in the router
session while the transaction is in progress. For the time being, the
queries are only used to log extra information about the transaction
contents.
2018-04-26 13:44:24 +03:00
Markus Mäkelä
53a5685dc2
MXS-1810: Add transaction checksums
Readwritesplit now calculates checksums for all successful and failed
transactions. This checksum is not of any practical use until the
transaction replaying is implemented.
2018-04-26 13:44:23 +03:00
Markus Mäkelä
bb96c368c2
MXS-1810: Create generic Checksum class
The Checksum class defines an interface which the SHA1Checksum and
CRC32Checksum implement.

Added test unit test cases to verify that the checksums work and perform
as expected.
2018-04-26 13:44:23 +03:00
Markus Mäkelä
602f977be6
MXS-1810: Add mxs::Checksum class
The class is a wrapper to the SHA1 function. This should make checksum
calculations over buffers easier.
2018-04-26 13:44:23 +03:00
Markus Mäkelä
755d080161
MXS-1810: Add C++ hex conversion functions
Added mxs::to_hex for uint8_t types and uint8_t containers.
2018-04-26 13:44:23 +03:00
Markus Mäkelä
640501c03a
MXS-1810: Format utils.hh
Formatted utils.hh with Astyle.
2018-04-26 13:44:23 +03:00
Johan Wikman
fd9e5af849 Merge branch '2.2' into develop 2018-04-26 13:23:32 +03:00
Johan Wikman
9cf44b3092 MXS-1829 Recognise PREVIOUS in addition to NEXT
Earlier only "SELECT NEXT VALUE FOR SEQ" was parsed
properly, while "SELECT PREVIOUS VALUE FOR SEQ" was not.
Now the latter statement is also parsed properly.
2018-04-26 13:14:23 +03:00
Johan Wikman
b2cc9e5107 MXS-1829 Add test that reveals problem 2018-04-26 12:44:30 +03:00
Esa Korhonen
7c933df56f MXS-1703 Remove support for MariaDB/MySQL versions less than 5.5
5.1 to 5.3 are officially not supported anymore, so support can be removed from
the monitor. This allows removing the config parameter "mysql51_replication".
2018-04-26 10:47:57 +03:00
Esa Korhonen
8e3bec5d09 MXS-1703 Rename fields in SlaveStatus
Althought the fields are still public, having the 'm_' is clearer.
2018-04-26 10:47:57 +03:00
Esa Korhonen
a28aac8de0 MXS-1703 Cleanup do_show_slave_status()
Slave_IO_Running is now properly parsed. Renamed class to SlaveStatus.
2018-04-26 10:47:57 +03:00
Johan Wikman
510ce38680 Update 2.2 version number in minor branch 2018-04-25 11:07:55 +03:00
Johan Wikman
d229980ea8 Merge branch '2.2' into develop 2018-04-25 10:59:33 +03:00
Johan Wikman
fb5a856cea MXS-1725 Use normal routing route when mocking
As results provided directly by filters are now delivered
properly, the functionality of the session must be used
also when mocking.
2018-04-25 10:58:45 +03:00
Johan Wikman
dee40a58f4 Update release date 2018-04-25 10:57:49 +03:00
Markus Mäkelä
2587227f10
Merge branch '2.2' into develop 2018-04-25 10:21:16 +03:00
Markus Mäkelä
d9e69413b4
Update MaxScale version
Updated version to 2.2.5.
2018-04-24 23:18:19 +03:00
Esa Korhonen
cb0ac44e1f MXS-1758 Support anonymous user with proxy grant for PAM
This allows using user group mapping with PAM authenticator.
2018-04-24 15:22:01 +03:00
Johan Wikman
68a89f0a25 Merge branch '2.2' into develop 2018-04-24 14:50:14 +03:00
Esa Korhonen
084c963081 MXS-1639 Update 2.2.5 release notes 2018-04-24 14:36:54 +03:00
Johan Wikman
4d4aaec52d Merge branch '2.2' into develop 2018-04-24 14:31:50 +03:00
Johan Wikman
c221e71582 Merge branch '2.1' into 2.2 2018-04-24 14:31:22 +03:00
Esa Korhonen
caa964fa57 Merge branch '2.2' into develop 2018-04-24 13:57:50 +03:00
Johan Wikman
b401f83e10 Update 2.2.5 release notes 2018-04-24 13:52:26 +03:00
Esa Korhonen
2a38902aa6 MXS-1639 Discard results when executing sql text files
This removes the limitation of not returning resultsets.
2018-04-24 13:21:44 +03:00
Esa Korhonen
fa7cd9450a MXS-1639 Do not run demote_sql_file if the server already has a slave connection
In this case, the server was already a slave and is not being demoted. Also, the file may
contain queries which cannot be ran while a slave connection is running.
2018-04-24 13:21:44 +03:00
Esa Korhonen
2aeed3ffab MXS-1639 Add documentation on promotion/demotion sql files 2018-04-24 13:21:44 +03:00
Johan Wikman
5dbdb8af8a Update 2.1.17 release notes. 2018-04-24 13:05:20 +03:00
Johan Wikman
5cf56c7c0f Merge branch '2.1' into 2.2 2018-04-24 12:39:22 +03:00
Johan Wikman
bafe8f5eeb MXS-1618 Use right type for the return value of getopt_long
getopt_long returns an 'int'. If 'char' is used on a big-endian
platform you'll end up with an infinite loop.
2018-04-24 12:31:08 +03:00
Markus Mäkelä
ce98831908
Start housekeeper before services
The housekeeper needs to be initialized before services are started.
2018-04-24 11:48:42 +03:00
Johan Wikman
a7df6b55d5 Merge branch '2.2' into develop 2018-04-24 11:02:02 +03:00
Johan Wikman
e81dd4ab24 Update 2.2.5 release notes 2018-04-24 10:33:19 +03:00
Johan Wikman
e0544c5d9c Update 2.2.5 release notes and change log 2018-04-24 10:18:19 +03:00
Johan Wikman
54b7dee0b0 Add release notes for 2.1.17
Update Changelog as well.
2018-04-24 10:18:19 +03:00
Johan Wikman
57cfb709b8 MXS-1819 Also log info messages to syslog
If info messages are enabled, they will be logged to syslog
just like any other messages.
2018-04-24 10:18:19 +03:00
Johan Wikman
70f3f61ac4 Update version number in 2.1 2018-04-24 10:18:19 +03:00
Johan Wikman
7a81f77649 Add release notes for 2.1.17
Update Changelog as well.
2018-04-24 10:12:29 +03:00
Johan Wikman
65260c365d MXS-1819 Also log info messages to syslog
If info messages are enabled, they will be logged to syslog
just like any other messages.
2018-04-24 10:02:47 +03:00