From d4aeca0d2439f39a916c34d27d9686924f3aa92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 20 Dec 2017 23:50:07 +0200 Subject: [PATCH] Change strict_multi_stmt default value The default value for strict_multi_stmt prevents compound statements and atomic multi-statement commands from being executed without completely disabling load balancing. As the new default value will have no practical effect on all correct uses of readwritesplit, this is a relatively safe thing to change. --- .../MaxScale-2.2.1-Release-Notes.md | 15 ++++++++++++ Documentation/Routers/ReadWriteSplit.md | 24 ++++++++++--------- .../routing/readwritesplit/readwritesplit.cc | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Documentation/Release-Notes/MaxScale-2.2.1-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.2.1-Release-Notes.md index c55024692..176b9ec86 100644 --- a/Documentation/Release-Notes/MaxScale-2.2.1-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.2.1-Release-Notes.md @@ -50,6 +50,21 @@ root@host:~# maxscale --user=root ... The default value of the configuration parameter `detect_standalone_master` has been changed from `false` to `true`. +### ReadWritesplit + +The default value of `strict_multi_stmt` was changed to `false` to make +usage of atomic compound statements and multi-statement queries less +restrictive and to align it with the default value of `strict_sp_calls`. + +Most cases where the functionality of `strict_multi_stmt` was triggered +were cases where the added safety of locking a session to the master did +more harm than it did good. + +The only case where `strict_multi_stmt` should be enabled is when a +multi-statement or a compound statement modifies the state of the +session. This is not a good practice and a change in the client side +behavior is advised. + ## Dropped Features ## New Features diff --git a/Documentation/Routers/ReadWriteSplit.md b/Documentation/Routers/ReadWriteSplit.md index 7b07e3558..543501391 100644 --- a/Documentation/Routers/ReadWriteSplit.md +++ b/Documentation/Routers/ReadWriteSplit.md @@ -220,21 +220,23 @@ router_options=master_accept_reads=true ### `strict_multi_stmt` -When a client executes a multi-statement query, all queries after that will be -routed to the master to guarantee a consistent session state. This behavior can -be controlled with the **`strict_multi_stmt`** router option. This option is -enabled by default. +This option is disabled by default since MaxScale 2.2.1. In older versions, this +option was enabled by default. -If set to false, queries are routed normally after a multi-statement query. +When a client executes a multi-statement query, it will be treated as if it were +a DML statement and routed to the master. If the option is enabled, all queries +after a multi-statement query will be routed to the master to guarantee a +consistent session state. -**Warning:** this can cause false data to be read from the slaves if the -multi-statement query modifies the session state. Only disable the strict mode -if you know that no changes to the session state will be made inside the -multi-statement queries. +If the feature is disabled, queries are routed normally after a multi-statement +query. + +**Warning:** Enable the strict mode only if you know that the clients will send + statements that cause inconsistencies in the session state. ``` -# Disable strict multi-statement mode -router_options=strict_multi_stmt=false +# Enable strict multi-statement mode +router_options=strict_multi_stmt=true ``` ### `strict_sp_calls` diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 50cc8a8e4..74dedc688 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -1432,7 +1432,7 @@ MXS_MODULE *MXS_CREATE_MODULE() {"retry_failed_reads", MXS_MODULE_PARAM_BOOL, "true"}, {"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "true"}, {"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"}, - {"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "true"}, + {"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "false"}, {"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false"}, {"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false"}, {"connection_keepalive", MXS_MODULE_PARAM_COUNT, "0"},