MXS-3273: Ignore unexpected responses
Unlike readwritesplit, schemarouter will process all responses from backends as if they are expected. There are cases where errors are generated that aren't sent as a response to a query. These queries must be ignored and not routed to the client. Copying the code as-is from readwritesplit isn't the cleanest solution but it avoids refactoring code in a patch release. The custom error number (2003) used by the backend protocol code was not an actual error number that the server would send. The error code in question was for an error that only the C connector returns: CR_CONN_HOST_ERROR. Using ER_CONNECTION_KILLED as the error number better conveys the fact that the connection was killed due to a reason not related to any ongoing query. By using a known error number that is correctly handled, we also avoid writing errors to the client in the middle of a resultset or as the initial response to a result. This explains why the problem described in MXS-3267 happened in the first place: an unrelated connection was lost in the middle of a resultset and the error was interpreted as the end of a resultset. As a result of there being more data to be read, the unexpected result state messages were logged.
This commit is contained in:
@ -207,7 +207,7 @@ GWBUF* mysql_create_custom_error(int packet_number,
|
||||
mysql_state = "HY000";
|
||||
|
||||
field_count = 0xff;
|
||||
gw_mysql_set_byte2(mysql_err, /* mysql_errno */ 2003);
|
||||
gw_mysql_set_byte2(mysql_err, ER_CONNECTION_KILLED);
|
||||
mysql_statemsg[0] = '#';
|
||||
memcpy(mysql_statemsg + 1, mysql_state, 5);
|
||||
|
||||
|
Reference in New Issue
Block a user