10324 Commits

Author SHA1 Message Date
Esa Korhonen
5d010ff712 Cleanup SERVER struct
Removed one unused field. Rearranged others, clarified comments.
2018-04-27 10:48:56 +03:00
Esa Korhonen
ba4700a983 MXS-1745 Remove unused fields
The binlog file and position are no longer used. Gtid_IO_Pos can fulfill
the same purpose if needed.
2018-04-27 10:48:56 +03:00
Esa Korhonen
de1e299f3f MXS-1745 Save all rows from SHOW ALL SLAVES STATUS
The master down verification through slaves won't work with this commit. It needs to be
redesigned to handle multiple slave connections or removed. Also, only the first row of
slave status data is used by the monitor, so multiple slave connections are still
incorrectly handled.
2018-04-27 10:48:45 +03:00
Johan Wikman
5f7257f432 MXS-1401 Add test cases
Test that an array of rules is parsed and used properly.
2018-04-27 09:22:17 +03:00
Johan Wikman
a3a8b5523e MXS-1401 Support multiple cache rules
The possibility to have multiple cache rules in a cache
configuration file is now handled throughout the cache
filter.

The major difference is that while you earlier directly
queried the Cache whether data should be stored to the
cache and whether data in the cache should be used, you
now query the Cache whether data should be stored to the
cache and, if so, get a CacheRules object from which you
subsequently query whether data from the cache should
be used.
2018-04-27 09:22:17 +03:00
Johan Wikman
605f771518 MXS-1401 Extend rule parsing to handle array of rule objects
It's now possible to have a rules file with an array of rule
objects, e.g.

  [
    {
      store: [ ... ],
      use: [ ... ]
    },
    {
      store: [ ... ],
      use: [ ... ]
    }
  ]

This commit only contains the low-level modifications for
supporting that; the upper-level modifications are made in
another commit.
2018-04-27 09:22:17 +03:00
Markus Mäkelä
880e0fb74e
Merge branch '2.2' into develop 2018-04-26 16:39:00 +03:00
Markus Mäkelä
6f80e11f1d
Fix sequence test
The test did not set SQL_MODE to ORACLE before using the Oracle syntax.
2018-04-26 16:02:09 +03:00
Markus Mäkelä
c97d2c94eb
MXS-1825: Fix PS output parameter tracking for MySQL variants
The resultset processing for MySQL requires some extra work as it lacks
the proper SERVER_MORE_RESULTS_EXIST flag in the last EOF packet. Instead,
the first EOF packet has the SERVER_PS_OUT_PARAMS flag which needs to be
interpreted as a SERVER_MORE_RESULTS_EXIST flag for the second EOF packet.

Also corrected the EOF packet handling to do the flag checks in the code
that deals with the EOF packets.

As the modutil_state parameter is now used for more than large packet
tracking, the correct solution is to store this state object in the
readwritesplit session instead of interpreting it to a boolean value.
2018-04-26 16:02:09 +03:00
Markus Mäkelä
260fcf85ec
Remove false debug assertion
A prepared statement ID of 0 is allowed.
2018-04-26 16:02:09 +03:00
Markus Mäkelä
a155d1085c
MXS-1824: Add test case
Added a test case that reproduces the problem and verifies that it is
fixed.
2018-04-26 16:02:09 +03:00
Markus Mäkelä
0df326d581
MXS-1824: Track only the opening of cursors
Whether a cursor is open or not does not matter as long as the attempt to
open a cursor is detected.
2018-04-26 16:02:09 +03:00
Johan Wikman
5c534acf6b MXS-1830 Remove erroneous free
The libdir is set elsewhere as well, which causes the set
buffer to be freed. Consequently it cannot be freed.
2018-04-26 15:46:51 +03:00
Johan Wikman
08230ef24c MXS-1830 Remove erroneous free
The libdir is set elsewhere as well, which causes the set
buffer to be freed. Consequently it cannot be freed.
2018-04-26 15:21:16 +03:00
Markus Mäkelä
5572f0efcd
Fix test_utils failure
The Checksum class interface was changed in a way that caused the tests to
fail.
2018-04-26 13:44:27 +03:00
Markus Mäkelä
d8d2fbe4c5
MXS-1507: Test transaction limits
The test cases check that the size limit works and that following
transactions work.
2018-04-26 13:44:27 +03:00
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