Ignore errors sent by servers in shutdown
When a server is stopping, it'll send an error to the client before terminating the TCP connection. The code in readwritesplit would detect this error and create a hangup event on the DCB. This would cause it to appear as if the TCP connection was broken and the router would immediately try to reconnect to the same server. By ignoring the error and allowing the connection to die on its own, we avoid immediately reconnecting and retrying any transactions on the stopping server. This increases the chances that the monitor will see it first and assign the server states correctly before the transaction replay is attempted.
This commit is contained in:
@ -586,9 +586,8 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
}
|
||||
else if (backend->get_reply_state() == REPLY_STATE_START && server_is_shutting_down(writebuf))
|
||||
{
|
||||
// The server is shutting down, act as if the network connection failed. This allows
|
||||
// the query to be retried on another server without the client noticing it.
|
||||
poll_fake_hangup_event(backend_dcb);
|
||||
// The server is shutting down, ignore this error and wait for the TCP connection to die.
|
||||
// This allows the query to be retried on another server without the client noticing it.
|
||||
gwbuf_free(writebuf);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user