Fix readwritesplit handling of unexpected responses

The backend server can send a response even if the client hasn't sent a
request. One case where this occurs is when the server is shutting
down. The internal logic of readwritesplit can't handle unexpected states
gracefully so the safest thing to do is to just ignore them and send the
responses to the client.
This commit is contained in:
Markus Mäkelä
2017-07-31 23:29:48 +03:00
parent 542f3b69db
commit 782b8db2aa
3 changed files with 67 additions and 16 deletions

View File

@ -454,9 +454,22 @@ mxs_auth_state_t gw_send_backend_auth(DCB *dcb);
/** Write an OK packet to a DCB */
int mxs_mysql_send_ok(DCB *dcb, int sequence, uint8_t affected_rows, const char* message);
/** Check for OK packet */
/**
* @brief Check if the buffer contains an OK packet
*
* @param buffer Buffer containing a complete MySQL packet
* @return True if the buffer contains an OK packet
*/
bool mxs_mysql_is_ok_packet(GWBUF *buffer);
/**
* @brief Check if the buffer contains an ERR packet
*
* @param buffer Buffer containing a complete MySQL packet
* @return True if the buffer contains an ERR packet
*/
bool mxs_mysql_is_err_packet(GWBUF *buffer);
/**
* @brief Check if a buffer contains a result set
*