summaryrefslogtreecommitdiffstats
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:33:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:33:02 +0000
commit4fa488fb0159c629483b7994aa84e73926b132b9 (patch)
tree182a19db69cdcb92be54cc6a5b0b9bfab28f80fd /sql/net_serv.cc
parentAdding debian version 1:10.11.6-2. (diff)
downloadmariadb-4fa488fb0159c629483b7994aa84e73926b132b9.tar.xz
mariadb-4fa488fb0159c629483b7994aa84e73926b132b9.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc33
1 files changed, 24 insertions, 9 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 70e71d9a..3dff8442 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -156,6 +156,7 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags)
net->where_b = net->remain_in_buf=0;
net->net_skip_rest_factor= 0;
net->last_errno=0;
+ net->pkt_nr_can_be_reset= 0;
net->thread_specific_malloc= MY_TEST(my_flags & MY_THREAD_SPECIFIC);
net->thd= 0;
#ifdef MYSQL_SERVER
@@ -1057,8 +1058,10 @@ retry:
{ /* Probably in MIT threads */
if (retry_count++ < net->retry_count)
continue;
- EXTRA_DEBUG_fprintf(stderr, "%s: read looped with error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
+ EXTRA_DEBUG_fprintf(stderr, "%s: read looped with error %d on "
+ "file %lld, aborting thread\n",
+ my_progname, vio_errno(net->vio),
+ (longlong) vio_fd(net->vio));
}
#ifndef MYSQL_SERVER
if (length != 0 && vio_errno(net->vio) == SOCKET_EINTR)
@@ -1094,19 +1097,31 @@ retry:
#endif
if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr)
{
-#ifndef MYSQL_SERVER
- if (net->buff[net->where_b + 3] == (uchar) (net->pkt_nr -1))
+ if (net->pkt_nr_can_be_reset)
{
/*
- If the server was killed then the server may have missed the
- last sent client packet and the packet numbering may be one off.
+ We are using a protocol like semi-sync where master and slave
+ sends packets in parallel.
+ Copy current one as it can be useful for debugging.
*/
- DBUG_PRINT("warning", ("Found possible out of order packets"));
- expect_error_packet= 1;
+ net->pkt_nr= net->buff[net->where_b + 3];
}
else
+ {
+#ifndef MYSQL_SERVER
+ if (net->buff[net->where_b + 3] == (uchar) (net->pkt_nr -1))
+ {
+ /*
+ If the server was killed then the server may have missed the
+ last sent client packet and the packet numbering may be one off.
+ */
+ DBUG_PRINT("warning", ("Found possible out of order packets"));
+ expect_error_packet= 1;
+ }
+ else
#endif
- goto packets_out_of_order;
+ goto packets_out_of_order;
+ }
}
net->compress_pkt_nr= ++net->pkt_nr;
#ifdef HAVE_COMPRESS