MXS-1503: Enable master reconnection

The `master_reconnection` parameter now controls both the reconnection of
the master server as well as the migration of the master server to another
server. Although these two cases appear to be different, the end result
from readwritesplit's point of view is the same and are thus controlled
with the same parameter.

The RWBackend class now resets its internal state when it is closed. This
allows readwritesplit to handle the case when a result was expected from
the master but the master died before the result was returned. The same
code should also handle slave connection failures mid-result, allowing
Backend reuse.

Added a test case that verifies the new functionality when combined with
`master_failure_mode=error_on_write`.
This commit is contained in:
Markus Mäkelä
2018-03-28 11:04:49 +03:00
parent 481db8acbc
commit 876187b340
9 changed files with 184 additions and 18 deletions

View File

@ -351,12 +351,9 @@ bool select_connect_backend_servers(RWSplit *inst, MXS_SESSION *session,
{
if (backend->can_connect() && backend->connect(session, sescmd_list))
{
if (sescmd_list && sescmd_list->size())
if (sescmd_list && sescmd_list->size() && expected_responses)
{
if (expected_responses)
{
(*expected_responses)++;
}
(*expected_responses)++;
}
slaves_connected++;