Commit a3267c11 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-21252 ER_HOST_IS_BLOCKED returns packet sequence 1 instead of 0

Fix regression introduced in MDEV-19893

Some errors must be sent with seqno = 0, e.g those that are detected
before server sends its first "welcome" packet (e.g too many connections)
This was not taken into account originally in MDEV-19893 fix.

We need to check sql_errno, before fixing sequence number, to see
if the error we send is really an out-of-bound, e.g a KILL.
parent a38b937b
......@@ -467,8 +467,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
coming from server to have seq_no > 0, due to missing awareness
of "out-of-band" operations. Make these clients happy.
*/
if (!net->pkt_nr)
if (!net->pkt_nr &&
(sql_errno == ER_CONNECTION_KILLED || sql_errno == ER_SERVER_SHUTDOWN ||
sql_errno == ER_QUERY_INTERRUPTED))
{
net->pkt_nr= 1;
}
ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment