Commit Graph

9893 Commits

Author SHA1 Message Date
2ec19e2358 MXS-1475 Add test case for @maxscale.cache.[use|populate]
Also extend logging.
2018-03-16 14:34:04 +02:00
82b55ff362 MXS-1475 Add @maxscale.cache.[populate|use]
The earlier @maxscale.cache.enabled has now been replaced with
@maxscale.cache.populate and @maxscale.cache.use that provide
for more flexibility.

With the former it is possible to control in what circumstances
the cache is populated and with the latter one when it is used.
Together they can be used for having a completely client driven
caching.
2018-03-16 14:34:04 +02:00
34dd8a52bb MXS-1475 Allow the setting on N vars with one stmt
With this change, the following will be possible.

SET @maxscale.cache.populate=false, @maxscale.cache.use=true;
2018-03-16 14:34:04 +02:00
805e3578a2 MXS-1475 Address review issues
- Clean up session header.
- Add test case
2018-03-16 14:34:04 +02:00
23b8939e20 MXS-1475 Update cache documentation 2018-03-16 14:34:04 +02:00
2d20a19f12 MXS-1475 Act accordingly if cache disabled
If caching is dynamically disabled, then CACHE_USE_AND_POPULATE is
turned into CACHE_POPULATE leading to the cache being refreshed but
not used.
2018-03-16 14:34:04 +02:00
090892db4c MXS-1475 Add 'enabled' parameter to Cache filter
With 'enabled' it can be specified whether the cache should initially
be enabled or disabled. Useful as it is now possible to enable/disable
the cache dynamically.
2018-03-16 14:34:04 +02:00
71c8a327b2 MXS-1475 Introduce variable @maxscale.cache.enabled
With the variable @maxscale.cache.enabled the caching can be
enabled/disabled at runtime.

In a subsequent commit, the variable will actually be used.
2018-03-16 14:34:04 +02:00
2434482dc6 MXS-1475 Attempt to set unknown MXS user variable causes error
By causing an error if an unknown MaxScale user variable is set,
the user will become aware of typos etc.
2018-03-16 14:34:04 +02:00
872a51a376 MXS-1475 Enable MaxScale specific user variables
With the changes in this commit it is possible to add and remove
MaxScale specific user variables. A MaxScale specific user variable
is a user variable that is interpreted by MaxScale and that
potentially changes the behaviour of MaxScale.

MaxScale specific user variables are of the format "@maxscale.x.y"
where "@maxscale" is a mandatory prefix, x a scope identifying the
component that handles the variable and y the component specific
variable. So, a variable might be called e.g. "@maxscale.cache.enabled".
The scope "core" is reserved (although not enforced yet) to MaxScale
itself.

The idea is that although MaxScale catches these, they are passed
through to the server. The benefit of this is that we do not need to
detect e.g. "SELECT @maxscale.cache.enabled", but can let the result
be returned from the server.

The interpretation of a provided value is handled by the component that
adds the variable. In a subsequent commit, it will be possible for a
component to reject a value, which will then cause an error to be
returned to the client.

There are 3 new functions:

- session_add_variable() using which a variable is added,
- session_remove_variable() using which a variable is removed, and
- session_set_variable_value().

The two former ones are to be called by components, the last one by
the protocol that catches the "set @maxscale..." statements.
2018-03-16 14:34:04 +02:00
5dfa0c1226 MXS-1475 Take SetParser and SqlModeParser into use
These changes are the first in the route toward supporting
MaxScale specific variables such as

    set @MAXSCALE.CACHE.ENABLED=TRUE
2018-03-16 14:34:04 +02:00
676594b8dd MXS-1475 Update test to use new classes
Test now implemented in terms of SetParser and SqlModeParser.
2018-03-16 14:34:04 +02:00
23d1dd42de MXS-1475 Add sql_mode parser
Given the value in a statement like "SET SQL_MODE=..." this parser
is capable of deducing whether SQL_MODE is set to DEFAULT or ORACLE
or something else.
2018-03-16 14:34:04 +02:00
f11d60420d MXS-1475 Add SetParser custom parser
SetParser is capable of returning the exact variable and value
of a "SET X=Y" statement, in the cases where X is of a specific
set of variables; currently "SQL_MODE" and "@MAXSCALE...".

The actual value of the SET statement also needs to be parsed in
the case of SQL_MODE, but it becomes unnecessary convoluted if that
information somehow should conditionally be expressable in a return
value.

So, the value will be parsed separately.
2018-03-16 14:34:04 +02:00
2be576da31 MXS-1703 Fix refactoring error in get_replication_tree()
Refactoring and removing explicit class pointer caused a local variable
to mix with a class field. This fix renames the local variable.
2018-03-16 14:31:40 +02:00
3af469a074 Merge branch '2.2' into develop 2018-03-16 12:54:09 +02:00
6afd57122d Merge branch '2.2' into develop 2018-03-16 12:39:55 +02:00
391ec78a0b MXS-1721 Destroy a filter instance only once
If two services referred to the same filter instance, it would
cause the filter to deleted twice at MaxScale shutdown with a
crash as the result.

Now when the services are deleted we just collect the unique
filter instances and then delete them after all services have
been deleted.
2018-03-16 12:00:18 +02:00
2178667245 MXS-1679 Check for existence of master before continuing failover checks
Seems to fix the issue with MaxScale detecting an old master down event.
2018-03-16 11:26:58 +02:00
dad8e5da59 Sync slaves after creating tables in rwsplit_readonly
The test should synchronize the replication to avoid replication lag from
breaking the tests.
2018-03-15 23:24:08 +02:00
07cca088c9 MXS-1717: Fix test regressions
Due to the changes done for MXS-1717, the bug673 test had to be adjusted
and a newline has to be printed after users_diagnostic is called.
2018-03-15 23:23:15 +02:00
d32db326e4 MXS-1703 Manual switchover, failover, rejoin to class methods
This allows privatising several public methods. Also, cleaned up
monitor start and stop a bit.
2018-03-15 13:45:14 +02:00
51188123c8 MXS-1703 Move cluster dicovery code to a separate file
Attempting to break the large main file to smaller chuncks.
2018-03-14 17:52:15 +02:00
693854bd15 MXS-1703 Move most fields/methods to private 2018-03-14 15:08:53 +02:00
5aeac621f9 MXS-1703 Most functions now moved to class methods
Cluster discovery functions still remain.
2018-03-14 15:08:53 +02:00
fb55ea6015 MXS-1703 Move monitor main loop + other entrypoint contents to class methods 2018-03-14 15:08:53 +02:00
3999bed3e2 MXS-359: Reset temporary table tracking on master change
When the master changes mid-session, the temporary tables are inevitably
lost. This could be avoided by routing temporary table creation to all
servers.
2018-03-14 14:34:49 +02:00
33e448fc78 MXS-359: Document interaction of master_failure_mode and allow_master_change
Added a paragraph that describes the expected behavior of the router when
both `master_failure_mode` and `allow_master_change` are enabled.
2018-03-14 14:34:49 +02:00
6a49f6ff0d MXS-359: Add test with master_failure_mode=error_on_write
Testing of routing behavior with master_failure_mode=error_on_write and
allow_master_changes=true. By sending an error instead of closing the
connection when the master fails, the connection can resume execution if a
new master becomes available.
2018-03-14 14:34:48 +02:00
62d4fa822d MXS-359: Test read-only mode and master replacement
Added test cases that verify that the functionality works as
expected. Also made Mariadb_nodes::change_master less verbose when one of
the nodes is down.
2018-03-14 14:34:48 +02:00
57b18cc0ce MXS-359: Reconnect with disable_sescmd_history if possible
If a session has not yet executed any session commands, it should be
possible to replace failed slave servers.
2018-03-14 14:34:48 +02:00
16f201beed MXS-359: Close failed backend if in read-only transaction
If the connection to the backend where a read-only transaction is being
performed fails, the Backend object should be closed for it. This fixes a
debug assertion in readwritesplit.cc:check_and_log_backend_state which
asserts that the failed connection must not be in use after the error
handling is done.

Also reordered the failing assertion and the accompanying error message so
that the error is logged first.
2018-03-14 14:34:48 +02:00
35b7ef35b7 MXS-359: Stop monitor before switching master
Stopping the monitor before changing the master is the closest thing to an
instant master switch.
2018-03-14 14:34:48 +02:00
dc48b8af4e Fix change_master function
The change_master function did not stop slaves on all servers before
reconfiguring them.
2018-03-14 14:34:48 +02:00
548c51c50d MXS-359: Fix mxs359_master_switch configuration
The test used the wrong parameter name.
2018-03-14 14:34:47 +02:00
8d7bff932b Add missing readwritesplit initialization
The wait_gtid_state variable was not initialized. In addition to that, the
routing would continue with a NULL buffer in some cases.
2018-03-14 14:32:03 +02:00
9f5d2244ea Merge branch '2.2' into develop 2018-03-14 14:30:50 +02:00
d7c1d76065 Merge branch '2.1' into 2.2 2018-03-14 14:29:56 +02:00
f5e2870c83 Rearrange tutorial sections
The sections are now ordered so that a later section always refers to an
earlier section and not the other way around.
2018-03-14 13:02:50 +02:00
bbe57a58cb Move server creation into a mini-tutorial
Combined the redundant documentation into a single document.
2018-03-14 13:02:50 +02:00
36c960a141 Add helper functions and default parameters
Added some helper functions into the MaxScale class and default parameters
into the connection creation functions. Also made the ip() function const
correct.
2018-03-14 13:02:50 +02:00
464d52453b Add disconnect as an alias for close_connections
This way both MaxScale and backend connections have the same function
names.
2018-03-14 13:02:49 +02:00
60ad1bccc5 Remove old tutorials
Removed obsolete tutorials.
2018-03-14 13:02:49 +02:00
ae49eb0cba Update links in Documentation-Contents.md
Updated links to point to the new tutorials.
2018-03-14 13:02:49 +02:00
91e13d2c9a Update MaxScale-Tutorial.md
Made the document more concise and added links to the download page. Made
the user grants easier to copy-paste and explained that they are used in
the following tutorials. Updated the links to the new tutorials.
2018-03-14 13:02:49 +02:00
fe2dfe03f4 Create combined read-write splitting routing tutorial
The read-write splitting routing tutorial is a combination of the two
different read-write splitting routing tutorials. As with the connection
routing tutorial, this should reduce the maintenance burden.
2018-03-14 13:02:49 +02:00
b4ac1b4d07 Create combined connection routing tutorial
The connection routing tutorial is a combination of the two different
connection routing tutorials. This should reduce the maintenance burden by
a significant amount.
2018-03-14 13:02:48 +02:00
2f95532efd Combine MaxAdmin tutorials
Combined all maxadmin related tutorials into one document. This removes
the duplication of documentation found in all tutorials.
2018-03-14 13:02:48 +02:00
b7d19a6670 Clean up connection routing tutorials
Wrapped lines to 80 characters, fixed minor differences and reworded
sections so that they are identical.
2018-03-14 13:02:47 +02:00
944d47167f Create mini-tutorials for monitor and server configuration
The tutorials combine the Galera and MariaDB monitor configuration as well
as the server configuration sections that were duplicated for all
tutorials. This should make the documentation easier to maintain.
2018-03-14 13:02:47 +02:00