Commit b2c904ec authored by unknown's avatar unknown

Fixing that 3.23 API / clients do not disconnect if a large

packet is issued.



BitKeeper/deleted/.del-net.c~ef21d6402bb882f9:
  Delete: libmysql/net.c
sql/sql_select.cc:
  reversing a fix, but we shall yet see about this one ...
parent 4c239771
......@@ -456,14 +456,23 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
length ? length : (ulong) strlen(arg)))
{
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
end_server(mysql);
if (mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg)))
if (net->last_errno == ER_NET_PACKET_TOO_LARGE)
{
net->last_errno=CR_SERVER_GONE_ERROR;
net->last_errno=CR_NET_PACKET_TOO_LARGE;
strmov(net->last_error,ER(net->last_errno));
goto end;
return(packet_error);
}
else
{
end_server(mysql);
if (mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg,
length ? length : (ulong) strlen(arg)))
{
net->last_errno=CR_SERVER_GONE_ERROR;
strmov(net->last_error,ER(net->last_errno));
goto end;
}
}
}
result=0;
......
This diff is collapsed.
......@@ -34,13 +34,18 @@
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#ifdef MYSQL_SERVER
#include <violite.h>
#endif
#define MAX_PACKET_LENGTH (256L*256L*256L-1)
#ifdef MYSQL_SERVER
ulong max_allowed_packet=65536;
extern ulong net_read_timeout,net_write_timeout;
extern uint test_flags;
#else
ulong max_allowed_packet=16*1024*1024L-1;
ulong max_allowed_packet=MAX_PACKET_LENGTH;
ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
#endif
......@@ -226,6 +231,12 @@ int
my_net_write(NET *net,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE];
if (len >= MAX_PACKET_LENGTH)
{
net->error=1;
net->last_errno=ER_NET_PACKET_TOO_LARGE;
return 1;
}
int3store(buff,len);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
......@@ -238,7 +249,12 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE+1];
uint length=len+1; /* 1 extra byte for command */
if (length >= MAX_PACKET_LENGTH)
{
net->error=1;
net->last_errno=ER_NET_PACKET_TOO_LARGE;
return 1;
}
int3store(buff,length);
buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
buff[4]=command;
......@@ -276,7 +292,7 @@ net_real_write(NET *net,const char *packet,ulong len)
int length;
char *pos,*end;
thr_alarm_t alarmed;
#if !defined(__WIN__)
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
ALARM alarm_buff;
#endif
uint retry_count=0;
......
......@@ -2328,8 +2328,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if ((tab->keys & ~ tab->const_keys && i > 0) ||
tab->const_keys && i == join->const_tables &&
join->thd->select_limit < join->best_positions[i].records_read &&
join->tables > 1)
join->thd->select_limit < join->best_positions[i].records_read)
{
/* Join with outer join condition */
COND *orig_cond=sel->cond;
......
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