MXS-1503: Fix read-only mode regression

The master_failure_mode=error_on_write mode was broken due to a faulty
assumption that all successfully routed queries would produce a
target. This is not the case when a write in error_on_write mode is
received.
This commit is contained in:
Markus Mäkelä
2018-03-30 08:35:48 +03:00
parent a15d36b2f0
commit 7d4f37d25b

View File

@ -212,9 +212,14 @@ bool route_single_stmt(RWSplit *inst, RWSplitSession *rses, GWBUF *querybuf, con
}
}
if (succp && target && prepare_target(rses, target, route_target))
if (succp && target)
{
if (target->session_command_count())
if (!prepare_target(rses, target, route_target))
{
// The connection to target was down and we failed to reconnect
succp = false;
}
else if (target->session_command_count())
{
// We need to wait until the session commands are executed
rses->expected_responses++;
@ -237,10 +242,6 @@ bool route_single_stmt(RWSplit *inst, RWSplitSession *rses, GWBUF *querybuf, con
}
}
}
else
{
succp = false;
}
}
if (succp && inst->config().connection_keepalive &&