diff --git a/Documentation/Routers/ReadWriteSplit.md b/Documentation/Routers/ReadWriteSplit.md index 8b82aaecd..cc86c310d 100644 --- a/Documentation/Routers/ReadWriteSplit.md +++ b/Documentation/Routers/ReadWriteSplit.md @@ -76,9 +76,28 @@ taken into use by new sessions. ### `max_slave_connections` **`max_slave_connections`** sets the maximum number of slaves a router session -uses at any moment. The default is to use all available slaves. +uses at any moment. The default is to use at most 255 slave connections per +client connection. In older versions the default was to use all available slaves +with no limit. - max_slave_connections= +``` +max_slave_connections= +``` + +For example, if you have configured MaxScale with one master and three slaves +and set `max_slave_connections=2`, for each client connection a connection to +the master and two slave connections would be opened. The read query load +balancing is then done between these two slaves and writes are sent to the +master. + +By tuning this parameter, you can control how dynamic the load balancing is at +the cost of extra created connections. With a lower value of +`max_slave_connections`, less connections per session are created and the set of +possible slave servers is smaller. With a higher value in +`max_slave_connections`, more connections are created which requires more +resources but load balancing will almost always give the best single query +response time and performance. Longer sessions are less affected by a high +`max_slave_connections` as the relative cost of opening a connection is lower. ### `max_slave_replication_lag` diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index 9aa0e8594..e8e73dfc3 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -829,6 +829,7 @@ static uint32_t resolve_query_type(parsing_info_t* pi, THD* thd) } else if (lex->option_type == OPT_SESSION) { + bool do_return = true; /** * SHOW syntax http://dev.mysql.com/doc/refman/5.6/en/show.html */ @@ -872,10 +873,16 @@ static uint32_t resolve_query_type(parsing_info_t* pi, THD* thd) } else { - type |= QUERY_TYPE_READ; + // This will cause the type of a statement like + // "SET STATEMENT ... FOR XYZ" to be the type + // of XYZ. + do_return = false; } - goto return_qtype; + if (do_return) + { + goto return_qtype; + } } /** diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index d18717b5f..bb9cdf905 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -112,3 +112,6 @@ SET STATEMENT max_statement_time=30 FOR SELECT seq FROM seq_0_to_100000; # MXS-1935 PREPARE a FROM @sql; + +# MXS-2207 +SET STATEMENT max_statement_time=30 FOR UPDATE tbl SET a = 42;