MXS-1367: Add timeouts for retried queries

The total timeout for the retrying of interrupted queries can now be
configured with the `query_retry_timeout` parameter. It controls the total
timeout in seconds that the query can take.

The actual connection, read and write timeouts of the connector aren't a
good configuration value to use for abstracted queries as the time that it
takes to execute a query can be composed of both connections, reads and
writes. This is caused by the usage of MYSQL_OPT_RECONNECT that hides the
fact that the connector reconnects to the server when a query is
attempted.
This commit is contained in:
Markus Mäkelä
2017-10-03 11:12:45 +03:00
parent 67ef7bd058
commit 9280f1a5d7
6 changed files with 38 additions and 7 deletions

View File

@ -178,8 +178,17 @@ The number of times an interrupted query will be retried. This feature was added
in MaxScale 2.1.10 and is disabled by default.
An interrupted query is any query that is interrupted by a network
error. Connection timeouts will not trigger a reconnection as it is advisable to
increase the timeouts rather than to try timed out queries again.
error. Connection timeouts are included in network errors and thus is it
advisable to make sure that the value of `query_retry_timeout` is set to an
adequate value.
#### `query_retry_timeout`
The total timeout in seconds for any retried queries. The default value is 5
seconds.
An interrupted query is retried for either the configured amount of attempts or
until the configured timeout is reached.
#### `ms_timestamp`

View File

@ -30,6 +30,8 @@ The internal SQL queries that MaxScale executes to load database users as well
as monitor the database itself can now be automatically retried if they are
interrupted. The new global parameter, `query_retries` controls the number of
retry attempts each query will receive if it fails due to a network problem.
The `query_retry_timeout` global parameter controls the total timeout for the
retries.
To enable this functionality, add `query_retries=<number-of-retries>` under the
`[maxscale]` section where _<number-of-retries>_ is a positive integer.