1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-12 01:53:02 +03:00

Added support for max_allowed_packet in option files read by mysql_option()

Extended max_allowed_packet for clients to 1G
Fixed bug in sending compressed rows >= 16M
Fix bug in skiping too long packets from clients.
Added checking of wrong command number sent by client.


include/mysql.h:
  Added max_allowed_packet as option parameter.
include/mysql_com.h:
  Added COM_END to be able to check for wrong commands.
libmysql/libmysql.c:
  Extended max_allowed_packet for clients to 1G
  Added support for max_allowed_packet in option files read by mysql_option()
mysys/my_compress.c:
  Debugging output
sql/net_pkg.cc:
  Fixed wrong handling of blobs >= 16M
sql/net_serv.cc:
  Changed MAX_THREE_BYTES -> MAX_PACKET_LENGTH
  More DEBUG output and more comments
  Fixed bug in sending compressed rows >= 16M
  Optimized sending of big packets (fewer memcpy and compress data in bigger blocks)
  Fix bug in skiping too long packets from clients.
  (old code didn't always work for big packets)
sql/sql_class.h:
  Changed type of variable
sql/sql_parse.cc:
  Added checking of wrong command number sent by client.
  Changed handling of too big packets to make code safer
tests/big_record.pl:
  E
This commit is contained in:
unknown
2003-01-04 15:17:16 +02:00
parent 62b38d20dd
commit 2d89861033
11 changed files with 301 additions and 149 deletions

View File

@ -60,7 +60,7 @@ static my_bool mysql_client_init=0;
uint mysql_port=0;
my_string mysql_unix_port=0;
ulong net_buffer_length=8192;
ulong max_allowed_packet=16*1024*1024L;
ulong max_allowed_packet= 1024L*1024L*1024L;
ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
@ -713,8 +713,8 @@ static const char *default_options[]=
"character-sets-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-cipher",
NullS
"ssl-cipher", "max-allowed-packet",
NullS
};
static TYPELIB option_types={array_elements(default_options)-1,
@ -868,6 +868,9 @@ static void mysql_read_default_options(struct st_mysql_options *options,
case 25: /* repl-parse-query */
options->rpl_parse= 1;
break;
case 27:
options->max_allowed_packet= atoi(opt_arg);
break;
default:
DBUG_PRINT("warning",("unknown option: %s",option[0]));
}
@ -1908,6 +1911,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
mysql->server_version,mysql->server_capabilities,
mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */
int3store(buff+2,max_allowed_packet);
if (user && user[0])
strmake(buff+5,user,32); /* Max user name */
@ -1935,6 +1939,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
goto error;
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
net->compress=1;
if (mysql->options.max_allowed_packet)
net->max_packet_size= mysql->options.max_allowed_packet;
if (db && mysql_select_db(mysql,db))
goto error;
if (mysql->options.init_command)
@ -2302,7 +2308,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{
DBUG_ENTER("mysql_real_query");
DBUG_PRINT("enter",("handle: %lx",mysql));
DBUG_PRINT("query",("Query = \"%s\"",query));
DBUG_PRINT("query",("Query = '%-.4096s'",query));
if (mysql_send_query(mysql,query,length))
DBUG_RETURN(-1);