Commit fb74fccf authored by unknown's avatar unknown

Merge with 4.0.8


BitKeeper/etc/logging_ok:
  auto-union
BUILD/SETUP.sh:
  Auto merged
acinclude.m4:
  Auto merged
include/mysql.h:
  Auto merged
myisam/mi_check.c:
  Auto merged
myisam/mi_test1.c:
  Auto merged
sql/ha_berkeley.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/mini_client.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/table.cc:
  Auto merged
tools/mysqlmanager.c:
  Auto merged
parents 14810ff1 e3c7f4d8
...@@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer" ...@@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer"
# this is one is for someone who thinks 1% speedup is worth not being # this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace # able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer " reckless_cflags="-O3 -fomit-frame-pointer "
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1" debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
......
...@@ -8,7 +8,7 @@ use Getopt::Long; ...@@ -8,7 +8,7 @@ use Getopt::Long;
$opt_distribution=$opt_user=$opt_config_env=""; $opt_distribution=$opt_user=$opt_config_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix=""; $opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix=""; $opt_tmp=$opt_version_suffix="";
$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=0; $opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=0;
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0; $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0;
GetOptions( GetOptions(
...@@ -30,7 +30,9 @@ GetOptions( ...@@ -30,7 +30,9 @@ GetOptions(
"no-crash-me", "no-crash-me",
"no-perl", "no-perl",
"no-strip", "no-strip",
"no-test|no-mysqltest", "no-test",
"no-mysqltest",
"no-benchmark",
"perl-files=s", "perl-files=s",
"perl-options=s", "perl-options=s",
"raid", "raid",
...@@ -148,6 +150,7 @@ select STDOUT; ...@@ -148,6 +150,7 @@ select STDOUT;
$|=1; $|=1;
info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n"); info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n");
log_timestamp();
if (-x "$host/bin/mysqladmin") if (-x "$host/bin/mysqladmin")
{ {
...@@ -161,6 +164,7 @@ kill_all("mysqlmanager"); ...@@ -161,6 +164,7 @@ kill_all("mysqlmanager");
if ($opt_stage == 0) if ($opt_stage == 0)
{ {
log_timestamp();
print "$host: Removing old distribution\n" if ($opt_debug); print "$host: Removing old distribution\n" if ($opt_debug);
if (!$opt_use_old_distribution) if (!$opt_use_old_distribution)
{ {
...@@ -209,6 +213,7 @@ safe_cd("$pwd/$host/$ver"); ...@@ -209,6 +213,7 @@ safe_cd("$pwd/$host/$ver");
if ($opt_stage <= 1) if ($opt_stage <= 1)
{ {
# Fix files if this is in another timezone than the build host # Fix files if this is in another timezone than the build host
log_timestamp();
unlink("config.cache"); unlink("config.cache");
unlink("bdb/build_unix/config.cache"); unlink("bdb/build_unix/config.cache");
unlink("innobase/config.cache"); unlink("innobase/config.cache");
...@@ -252,6 +257,7 @@ if ($opt_stage <= 1) ...@@ -252,6 +257,7 @@ if ($opt_stage <= 1)
if ($opt_stage <= 2) if ($opt_stage <= 2)
{ {
my ($command); my ($command);
log_timestamp();
unlink($opt_distribution) if ($opt_delete && !$opt_use_old_distribution); unlink($opt_distribution) if ($opt_delete && !$opt_use_old_distribution);
$command=$make; $command=$make;
$command.= " $opt_make_options" if (defined($opt_make_options) && $opt_make_options ne ""); $command.= " $opt_make_options" if (defined($opt_make_options) && $opt_make_options ne "");
...@@ -264,6 +270,7 @@ if ($opt_stage <= 2) ...@@ -264,6 +270,7 @@ if ($opt_stage <= 2)
if ($opt_stage <= 3) if ($opt_stage <= 3)
{ {
my $flags= ""; my $flags= "";
log_timestamp();
log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz"); log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz");
log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat"); log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat");
...@@ -292,6 +299,7 @@ if (!defined($tar_file)) ...@@ -292,6 +299,7 @@ if (!defined($tar_file))
# #
if ($opt_stage <= 4 && !$opt_no_test) if ($opt_stage <= 4 && !$opt_no_test)
{ {
log_timestamp();
rm_all(<$pwd/$host/test/*>); rm_all(<$pwd/$host/test/*>);
safe_cd("$pwd/$host/test"); safe_cd("$pwd/$host/test");
safe_system("gunzip < $tar_file | $tar xf -"); safe_system("gunzip < $tar_file | $tar xf -");
...@@ -305,8 +313,9 @@ $ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; ...@@ -305,8 +313,9 @@ $ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"};
# #
# Run the test suite # Run the test suite
# #
if ($opt_stage <= 5 && !$opt_no_test) if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{ {
log_timestamp();
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test"); safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
...@@ -315,7 +324,7 @@ if ($opt_stage <= 5 && !$opt_no_test) ...@@ -315,7 +324,7 @@ if ($opt_stage <= 5 && !$opt_no_test)
# #
# Start the server if we are going to run any of the benchmarks # Start the server if we are going to run any of the benchmarks
# #
if (!$opt_no_test) if (!$opt_no_test && !$opt_no_benchmark)
{ {
my $extra; my $extra;
safe_cd($test_dir); safe_cd($test_dir);
...@@ -339,8 +348,10 @@ if (!$opt_no_test) ...@@ -339,8 +348,10 @@ if (!$opt_no_test)
# #
# Compile and install the required Perl modules # Compile and install the required Perl modules
# #
if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test &&
!$opt_no_benchmark)
{ {
log_timestamp();
safe_cd($test_dir); safe_cd($test_dir);
rm_all("perl"); rm_all("perl");
safe_system("mkdir perl"); safe_system("mkdir perl");
...@@ -376,6 +387,7 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) ...@@ -376,6 +387,7 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
# #
if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
{ {
log_timestamp();
safe_cd("$test_dir/sql-bench"); safe_cd("$test_dir/sql-bench");
log_system("rm -f limits/mysql.cfg"); log_system("rm -f limits/mysql.cfg");
safe_system("perl ./crash-me --force --batch-mode $connect_option"); safe_system("perl ./crash-me --force --batch-mode $connect_option");
...@@ -384,8 +396,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) ...@@ -384,8 +396,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
# #
# Run sql-bench Benchmarks # Run sql-bench Benchmarks
# #
if ($opt_stage <= 9 && !$opt_no_test) if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark)
{ {
log_timestamp();
safe_cd("$test_dir/sql-bench"); safe_cd("$test_dir/sql-bench");
log_system("rm -f output/*"); log_system("rm -f output/*");
$tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : ""; $tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : "";
...@@ -469,7 +482,13 @@ Do not run the "crash-me" test ...@@ -469,7 +482,13 @@ Do not run the "crash-me" test
Do not strip the binaries included in the binary distribution Do not strip the binaries included in the binary distribution
--no-test --no-test
Do not run any tests Do not run any tests.
--no-benchmark
Do not run the benchmark test (written in perl)
--no-mysqltest
Do not run the the mysql-test-run test (Same as 'make test')
--perl-files=list of files --perl-files=list of files
Compile and install the given perl modules. Compile and install the given perl modules.
...@@ -532,6 +551,7 @@ sub abort ...@@ -532,6 +551,7 @@ sub abort
my($mail_header_file); my($mail_header_file);
print LOG "\n$message\n"; print LOG "\n$message\n";
print "$host: $message\n" if ($opt_debug); print "$host: $message\n" if ($opt_debug);
print LOG "Aborting\n";
close LOG; close LOG;
if ($opt_user) if ($opt_user)
...@@ -547,7 +567,6 @@ sub abort ...@@ -547,7 +567,6 @@ sub abort
unlink($mail_header_file); unlink($mail_header_file);
unlink("$log.mail"); unlink("$log.mail");
} }
print LOG "Aborting\n";
exit 1; exit 1;
} }
...@@ -689,9 +708,10 @@ sub rm_all ...@@ -689,9 +708,10 @@ sub rm_all
sub kill_all sub kill_all
{ {
my ($pattern) = @_; my ($pattern) = @_;
my ($USER,$BSD,$LINUX, $pscmd, $user, $pid); my ($USER,$BSD,$LINUX, $pscmd, $user, $os, $pid);
$user=$ENV{'USER'}; $user=$ENV{'USER'};
$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin'; $os=defined($ENV{'OS'}) ? $ENV{'OS'} : "unknown";
$BSD = -f '/vmunix' || $os eq "SunOS4" || $^O eq 'darwin';
$LINUX = $^O eq 'linux'; $LINUX = $^O eq 'linux';
$pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef"; $pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef";
...@@ -707,7 +727,7 @@ sub kill_all ...@@ -707,7 +727,7 @@ sub kill_all
{ {
chop($cand); chop($cand);
($pid_user, $pid) = split(' ', $cand); ($pid_user, $pid) = split(' ', $cand);
next if $pid == $$; next if $pid eq $$;
next process if (! ($cand =~ $pattern) || $pid_user ne $user); next process if (! ($cand =~ $pattern) || $pid_user ne $user);
print LOG "Killing $_\n"; print LOG "Killing $_\n";
&killpid($pid); &killpid($pid);
...@@ -730,3 +750,14 @@ sub killpid ...@@ -730,3 +750,14 @@ sub killpid
} }
print LOG "$pid will not die!\n"; print LOG "$pid will not die!\n";
} }
#
# return the current date as a string (YYYY-MM-DD HH:MM:SS)
#
sub log_timestamp
{
my @ta=localtime(time());
print LOG sprintf("%4d-%02d-%02d %02d:%02d:%02d\n",
$ta[5]+1900, $ta[4]+1, $ta[3], $ta[2], $ta[1], $ta[0]);
}
...@@ -623,7 +623,7 @@ main() ...@@ -623,7 +623,7 @@ main()
FILE *file=fopen("conftestval", "w"); FILE *file=fopen("conftestval", "w");
f = (float) ll; f = (float) ll;
fprintf(file,"%g\n",f); fprintf(file,"%g\n",f);
close(file); fclose(file);
exit (0); exit (0);
}], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
......
...@@ -882,6 +882,7 @@ int main() ...@@ -882,6 +882,7 @@ int main()
# #
MAX_C_OPTIMIZE="-O3" MAX_C_OPTIMIZE="-O3"
MAX_CXX_OPTIMIZE="-O3"
case $SYSTEM_TYPE in case $SYSTEM_TYPE in
*solaris2.7*) *solaris2.7*)
...@@ -949,6 +950,8 @@ case $SYSTEM_TYPE in ...@@ -949,6 +950,8 @@ case $SYSTEM_TYPE in
then then
CFLAGS="$CFLAGS +DD64 -DHAVE_BROKEN_INLINE" CFLAGS="$CFLAGS +DD64 -DHAVE_BROKEN_INLINE"
CXXFLAGS="$CXXFLAGS +DD64 +O2" CXXFLAGS="$CXXFLAGS +DD64 +O2"
MAX_C_OPTIMIZE=""
MAX_CXX_OPTIMIZE=""
fi fi
;; ;;
*rhapsody*) *rhapsody*)
...@@ -1407,7 +1410,7 @@ if test "$ac_cv_prog_cxx_g" = "yes" ...@@ -1407,7 +1410,7 @@ if test "$ac_cv_prog_cxx_g" = "yes"
then then
DEBUG_CXXFLAGS="-g" DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX="-O" DEBUG_OPTIMIZE_CXX="-O"
OPTIMIZE_CXXFLAGS="-O3" OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
else else
DEBUG_CXXFLAGS="-g" DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX="" DEBUG_OPTIMIZE_CXX=""
......
...@@ -127,6 +127,7 @@ struct st_mysql_options { ...@@ -127,6 +127,7 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */ char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */ char *ssl_cipher; /* cipher to use */
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */ my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe; my_bool compress,named_pipe;
/* /*
......
...@@ -42,7 +42,8 @@ enum enum_server_command ...@@ -42,7 +42,8 @@ enum enum_server_command
COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT,
COM_END /* Must be last */
}; };
......
...@@ -57,6 +57,7 @@ of the 32-bit x86 assembler in mutex operations. */ ...@@ -57,6 +57,7 @@ of the 32-bit x86 assembler in mutex operations. */
Microsoft Visual C++ */ Microsoft Visual C++ */
#if !defined(__GNUC__) && !defined(__WIN__) #if !defined(__GNUC__) && !defined(__WIN__)
#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
#define UNIV_MUST_NOT_INLINE #define UNIV_MUST_NOT_INLINE
#endif #endif
......
...@@ -2127,7 +2127,7 @@ os_aio_simulated_handle( ...@@ -2127,7 +2127,7 @@ os_aio_simulated_handle(
ulint offs; ulint offs;
ulint lowest_offset; ulint lowest_offset;
byte* combined_buf; byte* combined_buf;
byte* combined_buf2; byte* combined_buf2= 0; /* Remove warning */
ibool ret; ibool ret;
ulint n; ulint n;
ulint i; ulint i;
......
...@@ -472,9 +472,9 @@ trx_sys_update_mysql_binlog_offset( ...@@ -472,9 +472,9 @@ trx_sys_update_mysql_binlog_offset(
if (0 != ut_memcmp(sys_header + field + TRX_SYS_MYSQL_LOG_NAME, if (0 != ut_memcmp(sys_header + field + TRX_SYS_MYSQL_LOG_NAME,
file_name, 1 + ut_strlen(file_name))) { file_name, 1 + ut_strlen(file_name))) {
mlog_write_string(sys_header + field mlog_write_string((byte*) (sys_header + field
+ TRX_SYS_MYSQL_LOG_NAME, + TRX_SYS_MYSQL_LOG_NAME),
file_name, 1 + ut_strlen(file_name), mtr); (byte*) file_name, 1 + ut_strlen(file_name), mtr);
} }
if (mach_read_from_4(sys_header + field if (mach_read_from_4(sys_header + field
......
...@@ -99,7 +99,7 @@ trx_create( ...@@ -99,7 +99,7 @@ trx_create(
trx->mysql_log_file_name = NULL; trx->mysql_log_file_name = NULL;
trx->mysql_log_offset = 0; trx->mysql_log_offset = 0;
trx->mysql_master_log_file_name = ""; trx->mysql_master_log_file_name = (char*) "";
trx->mysql_master_log_pos = 0; trx->mysql_master_log_pos = 0;
trx->ignore_duplicates_in_insert = FALSE; trx->ignore_duplicates_in_insert = FALSE;
......
...@@ -197,7 +197,6 @@ ut_get_year_month_day( ...@@ -197,7 +197,6 @@ ut_get_year_month_day(
*month = (ulint)cal_tm.wMonth; *month = (ulint)cal_tm.wMonth;
*day = (ulint)cal_tm.wDay; *day = (ulint)cal_tm.wDay;
#else #else
struct tm cal_tm;
struct tm* cal_tm_ptr; struct tm* cal_tm_ptr;
time_t tm; time_t tm;
......
...@@ -61,7 +61,7 @@ static my_bool mysql_client_init=0; ...@@ -61,7 +61,7 @@ static my_bool mysql_client_init=0;
uint mysql_port=0; uint mysql_port=0;
my_string mysql_unix_port=0; my_string mysql_unix_port=0;
ulong net_buffer_length=8192; 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_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT;
...@@ -928,7 +928,8 @@ static const char *default_options[]= ...@@ -928,7 +928,8 @@ static const char *default_options[]=
"character-sets-dir", "default-character-set", "interactive-timeout", "character-sets-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile", "connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query", "replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-cipher","protocol", "shared_memory_base_name", "ssl-cipher", "max-allowed-packet",
"protocol", "shared-memory-base-name",
NullS NullS
}; };
...@@ -1099,14 +1100,17 @@ static void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1099,14 +1100,17 @@ static void mysql_read_default_options(struct st_mysql_options *options,
case 25: /* repl-parse-query */ case 25: /* repl-parse-query */
options->rpl_parse= 1; options->rpl_parse= 1;
break; break;
case 27:/* protocol */ case 27:
options->max_allowed_packet= atoi(opt_arg);
break;
case 28: /* protocol */
if ((options->protocol = find_type(opt_arg, &sql_protocol_typelib,0)) == ~(ulong) 0) if ((options->protocol = find_type(opt_arg, &sql_protocol_typelib,0)) == ~(ulong) 0)
{ {
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
exit(1); exit(1);
} }
break; break;
case 28: /*shared_memory_base_name*/ case 29: /* shared_memory_base_name */
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
if (options->shared_memory_base_name != def_shared_memory_base_name) if (options->shared_memory_base_name != def_shared_memory_base_name)
my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
...@@ -2242,6 +2246,7 @@ Try also with PIPE or TCP/IP ...@@ -2242,6 +2246,7 @@ Try also with PIPE or TCP/IP
DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d client_flag: %d", DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d client_flag: %d",
mysql->server_version,mysql->server_capabilities, mysql->server_version,mysql->server_capabilities,
mysql->server_status, client_flag)); mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */
int3store(buff+2,max_allowed_packet); int3store(buff+2,max_allowed_packet);
if (user && user[0]) if (user && user[0])
strmake(buff+5,user,32); /* Max user name */ strmake(buff+5,user,32); /* Max user name */
...@@ -2350,6 +2355,8 @@ Try also with PIPE or TCP/IP ...@@ -2350,6 +2355,8 @@ Try also with PIPE or TCP/IP
if (client_flag & CLIENT_COMPRESS) /* We will use compression */ if (client_flag & CLIENT_COMPRESS) /* We will use compression */
net->compress=1; 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)) if (db && mysql_select_db(mysql,db))
goto error; goto error;
...@@ -2853,7 +2860,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length) ...@@ -2853,7 +2860,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{ {
DBUG_ENTER("mysql_real_query"); DBUG_ENTER("mysql_real_query");
DBUG_PRINT("enter",("handle: %lx",mysql)); 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)) if (mysql_send_query(mysql,query,length))
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -3656,7 +3656,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, ...@@ -3656,7 +3656,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
} }
ha_checksum mi_byte_checksum(const byte *buf, uint length) static ha_checksum mi_byte_checksum(const byte *buf, uint length)
{ {
ha_checksum crc; ha_checksum crc;
const byte *end=buf+length; const byte *end=buf+length;
......
...@@ -57,7 +57,7 @@ int main(int argc,char *argv[]) ...@@ -57,7 +57,7 @@ int main(int argc,char *argv[])
} }
int run_test(const char *filename) static int run_test(const char *filename)
{ {
MI_INFO *file; MI_INFO *file;
int i,j,error,deleted,rec_length,uniques=0; int i,j,error,deleted,rec_length,uniques=0;
......
set global max_allowed_packet=100;
set max_allowed_packet=100;
set global net_buffer_length=100;
set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
select repeat('a',200);
repeat('a',200)
NULL
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 80
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
Got a packet bigger than 'max_allowed_packet'
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
select length(repeat('a',200));
length(repeat('a',200))
200
...@@ -71,7 +71,8 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; ...@@ -71,7 +71,8 @@ select decode(encode("abcdef","monty"),"monty")="abcdef";
select quote('\'\"\\test'); select quote('\'\"\\test');
select quote(concat('abc\'', '\\cba')); select quote(concat('abc\'', '\\cba'));
select quote(1/0), quote('\0\Z'); select quote(1/0), quote('\0\Z');
select length(quote(concat(char(0), "test"))); select length(quote(concat(char(0),"test")));
# #
# Wrong usage of functions # Wrong usage of functions
# #
......
#
# Check protocol handling
#
connect (con1,localhost,root,,);
connection con1;
set global max_allowed_packet=100;
set max_allowed_packet=100;
set global net_buffer_length=100;
set net_buffer_length=100;
# Have to be > 1024 as min value of net_buffer_length is 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 200 is bigger than max_allowed_packet
select repeat('a',200);
#
# Connection 2 should get error for too big packets
#
connect (con2,localhost,root,,);
connection con2;
select @@net_buffer_length, @@max_allowed_packet;
--error 1153
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',200));
...@@ -32,24 +32,28 @@ ...@@ -32,24 +32,28 @@
my_bool my_compress(byte *packet, ulong *len, ulong *complen) my_bool my_compress(byte *packet, ulong *len, ulong *complen)
{ {
DBUG_ENTER("my_compress");
if (*len < MIN_COMPRESS_LENGTH) if (*len < MIN_COMPRESS_LENGTH)
{
*complen=0; *complen=0;
DBUG_PRINT("note",("Packet too short: Not compressed"));
}
else else
{ {
byte *compbuf=my_compress_alloc(packet,len,complen); byte *compbuf=my_compress_alloc(packet,len,complen);
if (!compbuf) if (!compbuf)
return *complen ? 0 : 1; DBUG_RETURN(*complen ? 0 : 1);
memcpy(packet,compbuf,*len); memcpy(packet,compbuf,*len);
my_free(compbuf,MYF(MY_WME)); } my_free(compbuf,MYF(MY_WME)); }
return 0; DBUG_RETURN(0);
} }
byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
{ {
byte *compbuf; byte *compbuf;
*complen = *len * 120 / 100 + 12; *complen= *len * 120 / 100 + 12;
if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME)))) if (!(compbuf= (byte *) my_malloc(*complen,MYF(MY_WME))))
return 0; /* Not enough memory */ return 0; /* Not enough memory */
if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet, if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
(uLong) *len ) != Z_OK) (uLong) *len ) != Z_OK)
...@@ -59,31 +63,36 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) ...@@ -59,31 +63,36 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
} }
if (*complen >= *len) if (*complen >= *len)
{ {
*complen=0; *complen= 0;
my_free(compbuf,MYF(MY_WME)); my_free(compbuf, MYF(MY_WME));
DBUG_PRINT("note",("Packet got longer on compression; Not compressed"));
return 0; return 0;
} }
swap(ulong,*len,*complen); /* *len is now packet length */ swap(ulong, *len, *complen); /* *len is now packet length */
return compbuf; return compbuf;
} }
my_bool my_uncompress (byte *packet, ulong *len, ulong *complen) my_bool my_uncompress (byte *packet, ulong *len, ulong *complen)
{ {
DBUG_ENTER("my_uncompress");
if (*complen) /* If compressed */ if (*complen) /* If compressed */
{ {
byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME)); byte *compbuf= (byte *) my_malloc(*complen,MYF(MY_WME));
int error;
if (!compbuf) if (!compbuf)
return 1; /* Not enough memory */ DBUG_RETURN(1); /* Not enough memory */
if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK) if ((error=uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len))
!= Z_OK)
{ /* Probably wrong packet */ { /* Probably wrong packet */
my_free (compbuf,MYF(MY_WME)); DBUG_PRINT("error",("Can't uncompress packet, error: %d",error));
return 1; my_free(compbuf, MYF(MY_WME));
DBUG_RETURN(1);
} }
*len = *complen; *len= *complen;
memcpy(packet,compbuf,*len); memcpy(packet, compbuf, *len);
my_free(compbuf,MYF(MY_WME)); my_free(compbuf, MYF(MY_WME));
} }
return 0; DBUG_RETURN(0);
} }
#endif /* HAVE_COMPRESS */ #endif /* HAVE_COMPRESS */
...@@ -572,7 +572,7 @@ static longlong eval_num_suffix (char *argument, int *error, char *option_name) ...@@ -572,7 +572,7 @@ static longlong eval_num_suffix (char *argument, int *error, char *option_name)
In case of an error, set error value in *err. In case of an error, set error value in *err.
*/ */
longlong getopt_ll (char *arg, const struct my_option *optp, int *err) static longlong getopt_ll(char *arg, const struct my_option *optp, int *err)
{ {
longlong num; longlong num;
...@@ -596,7 +596,7 @@ longlong getopt_ll (char *arg, const struct my_option *optp, int *err) ...@@ -596,7 +596,7 @@ longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
values. values.
*/ */
static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err) static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err)
{ {
ulonglong num; ulonglong num;
......
...@@ -2119,7 +2119,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) ...@@ -2119,7 +2119,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat); free(stat);
stat=0; stat=0;
} }
if (key_file[i]->stat(key_file[i], (void*) &stat, 0)) if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
share->rec_per_key[i]= (stat->bt_ndata / share->rec_per_key[i]= (stat->bt_ndata /
(stat->bt_nkeys ? stat->bt_nkeys : 1)); (stat->bt_nkeys ? stat->bt_nkeys : 1));
...@@ -2132,7 +2132,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) ...@@ -2132,7 +2132,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat); free(stat);
stat=0; stat=0;
} }
if (file->stat(file, (void*) &stat, 0)) if ((file->stat)(file, (void*) &stat, 0))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
pthread_mutex_lock(&share->mutex); pthread_mutex_lock(&share->mutex);
......
...@@ -545,10 +545,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -545,10 +545,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
bzero((char*) &UNIXaddr,sizeof(UNIXaddr)); bzero((char*) &UNIXaddr,sizeof(UNIXaddr));
UNIXaddr.sun_family = AF_UNIX; UNIXaddr.sun_family = AF_UNIX;
strmov(UNIXaddr.sun_path, unix_socket); strmov(UNIXaddr.sun_path, unix_socket);
if (mc_sock_connect(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), if (mc_sock_connect(sock,
my_reinterpret_cast(struct sockaddr *) (&UNIXaddr),
sizeof(UNIXaddr),
mysql->options.connect_timeout) <0) mysql->options.connect_timeout) <0)
{ {
DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno)); DBUG_PRINT("error",("Got error %d on connect to local server",
socket_errno));
net->last_errno=CR_CONNECTION_ERROR; net->last_errno=CR_CONNECTION_ERROR;
sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno);
goto error; goto error;
...@@ -635,7 +638,9 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -635,7 +638,9 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
my_gethostbyname_r_free(); my_gethostbyname_r_free();
} }
sock_addr.sin_port = (ushort) htons((ushort) port); sock_addr.sin_port = (ushort) htons((ushort) port);
if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), if (mc_sock_connect(sock,
my_reinterpret_cast(struct sockaddr *) (&sock_addr),
sizeof(sock_addr),
mysql->options.connect_timeout) <0) mysql->options.connect_timeout) <0)
{ {
DBUG_PRINT("error",("Got error %d on connect to '%s'", DBUG_PRINT("error",("Got error %d on connect to '%s'",
......
This diff is collapsed.
...@@ -331,7 +331,7 @@ net_store_length(char *pkg, ulonglong length) ...@@ -331,7 +331,7 @@ net_store_length(char *pkg, ulonglong length)
} }
*packet++=254; *packet++=254;
int8store(packet,length); int8store(packet,length);
return (char*) packet+9; return (char*) packet+8;
} }
......
...@@ -432,7 +432,7 @@ public: ...@@ -432,7 +432,7 @@ public:
uint client_capabilities; /* What the client supports */ uint client_capabilities; /* What the client supports */
/* Determines if which non-standard SQL behaviour should be enabled */ /* Determines if which non-standard SQL behaviour should be enabled */
uint sql_mode; uint sql_mode;
uint max_client_packet_length; ulong max_client_packet_length;
ulong master_access; /* Global privileges from mysql.user */ ulong master_access; /* Global privileges from mysql.user */
ulong db_access; /* Privileges for current db */ ulong db_access; /* Privileges for current db */
......
...@@ -74,7 +74,8 @@ const char *command_name[]={ ...@@ -74,7 +74,8 @@ const char *command_name[]={
"Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist", "Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist",
"Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user", "Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave", "Binlog Dump","Table Dump", "Connect Out", "Register Slave",
"Prepare", "Prepare Execute", "Long Data", "Close stmt" "Prepare", "Prepare Execute", "Long Data", "Close stmt",
"Error" // Last command number
}; };
static char empty_c_string[1]= {0}; // Used for not defined 'db' static char empty_c_string[1]= {0}; // Used for not defined 'db'
...@@ -211,7 +212,7 @@ static int check_user(THD *thd,enum_server_command command, const char *user, ...@@ -211,7 +212,7 @@ static int check_user(THD *thd,enum_server_command command, const char *user,
cur_priv_version,hint_user); cur_priv_version,hint_user);
DBUG_PRINT("info", DBUG_PRINT("info",
("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", ("Capabilities: %d packet_length: %ld Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'",
thd->client_capabilities, thd->max_client_packet_length, thd->client_capabilities, thd->max_client_packet_length,
thd->host_or_ip, thd->priv_user, thd->host_or_ip, thd->priv_user,
had_password ? "yes": "no", had_password ? "yes": "no",
...@@ -516,7 +517,8 @@ check_connections(THD *thd) ...@@ -516,7 +517,8 @@ check_connections(THD *thd)
{ {
vio_in_addr(net->vio,&thd->remote.sin_addr); vio_in_addr(net->vio,&thd->remote.sin_addr);
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
thd->host[strnlen(thd->host, HOSTNAME_LENGTH)]= 0; /* Cut very long hostnames to avoid possible overflows */
thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
if (connect_errors > max_connect_errors) if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED); return(ER_HOST_IS_BLOCKED);
} }
...@@ -967,20 +969,22 @@ bool do_command(THD *thd) ...@@ -967,20 +969,22 @@ bool do_command(THD *thd)
net_new_transaction(net); net_new_transaction(net);
if ((packet_length=my_net_read(net)) == packet_error) if ((packet_length=my_net_read(net)) == packet_error)
{ {
DBUG_PRINT("info",("Got error reading command from socket %s", DBUG_PRINT("info",("Got error %d reading command from socket %s",
vio_description(net->vio) )); net->error,
return TRUE; vio_description(net->vio)));
} /* Check if we can continue without closing the connection */
else if (!packet_length) if (net->error != 3)
{ DBUG_RETURN(TRUE); // We have to close it.
send_error(thd,net->last_errno,NullS); send_error(thd,net->last_errno,NullS);
net->error=0; net->error= 0;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
else else
{ {
packet=(char*) net->read_pos; packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0]; command = (enum enum_server_command) (uchar) packet[0];
if (command >= COM_END)
command= COM_END; // Wrong command
DBUG_PRINT("info",("Command on %s = %d (%s)", DBUG_PRINT("info",("Command on %s = %d (%s)",
vio_description(net->vio), command, vio_description(net->vio), command,
command_name[command])); command_name[command]));
...@@ -1184,7 +1188,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1184,7 +1188,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (alloc_query(thd, packet, packet_length)) if (alloc_query(thd, packet, packet_length))
break; // fatal error is set break; // fatal error is set
mysql_log.write(thd,command,"%s",thd->query); mysql_log.write(thd,command,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query)); DBUG_PRINT("query",("%-.4096s",thd->query));
mysql_parse(thd,thd->query, thd->query_length); mysql_parse(thd,thd->query, thd->query_length);
if (!(specialflag & SPECIAL_NO_PRIOR)) if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),WAIT_PRIOR); my_pthread_setprio(pthread_self(),WAIT_PRIOR);
...@@ -1381,6 +1385,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1381,6 +1385,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_CONNECT: // Impossible here case COM_CONNECT: // Impossible here
case COM_TIME: // Impossible from client case COM_TIME: // Impossible from client
case COM_DELAYED_INSERT: case COM_DELAYED_INSERT:
case COM_END:
default: default:
send_error(thd, ER_UNKNOWN_COM_ERROR); send_error(thd, ER_UNKNOWN_COM_ERROR);
break; break;
...@@ -2282,6 +2287,7 @@ mysql_execute_command(THD *thd) ...@@ -2282,6 +2287,7 @@ mysql_execute_command(THD *thd)
for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next) for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next)
auxi->table= auxi->table_list->table; auxi->table= auxi->table_list->table;
if (&lex->select_lex != lex->all_selects_list) if (&lex->select_lex != lex->all_selects_list)
{
for (TABLE_LIST *t= select_lex->get_table_list(); for (TABLE_LIST *t= select_lex->get_table_list();
t; t= t->next) t; t= t->next)
{ {
...@@ -2292,6 +2298,7 @@ mysql_execute_command(THD *thd) ...@@ -2292,6 +2298,7 @@ mysql_execute_command(THD *thd)
break; break;
} }
} }
}
fix_tables_pointers(lex->all_selects_list); fix_tables_pointers(lex->all_selects_list);
if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables, if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables,
table_count))) table_count)))
......
...@@ -146,7 +146,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -146,7 +146,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
bzero((char*) keyinfo,n_length); bzero((char*) keyinfo,n_length);
outparam->key_info=keyinfo; outparam->key_info=keyinfo;
outparam->max_key_length= outparam->total_key_length= 0; outparam->max_key_length= outparam->total_key_length= 0;
key_part= (KEY_PART_INFO*) (keyinfo+keys); key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys);
strpos=disk_buff+6; strpos=disk_buff+6;
ulong *rec_per_key; ulong *rec_per_key;
......
#!/usr/bin/perl #!/usr/bin/perl
# This is a test with stores big records in a blob # This is a test with stores big records in a blob.
# Note that for the default test the mysql server should have been # Note that for the default test the mysql server should have been
# started with at least 'mysqld -O max_allowed_packet=200k' # started with at least 'mysqld -O max_allowed_packet=30M' and you should have
# at least 256M memory in your computer.
$host= shift || "";
$test_db="test";
$opt_user=$opt_password="";
use DBI; use DBI;
$|= 1; # Autoflush use Getopt::Long;
$opt_host="";
$opt_user=$opt_password="";
$opt_db="test";
$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes
$opt_compress=0;
$opt_table="test_big_record";
$table="test_big_record"; GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i",
$rows=20; # Test of blobs up to ($rows-1)*10000+1 bytes "compress") || die "Aborted";
print "Connection to database $test_db\n"; print "Connection to database $test_db\n";
$dbh = DBI->connect("DBI:mysql:$test_db:$host",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n"; $extra_options="";
$extra_options.=":mysql_compression=1" if ($opt_compress);
$dbh->do("drop table if exists $table"); $dbh = DBI->connect("DBI:mysql:$opt_db:$host$extra_options",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n";
print "Creating table $table\n"; $dbh->do("drop table if exists $opt_table");
print "Creating table $opt_table\n";
($dbh->do("\ ($dbh->do("\
CREATE TABLE $table ( CREATE TABLE $opt_table (
auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment, auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment,
test mediumblob, test longblob,
PRIMARY KEY (auto))")) or die $DBI::errstr; PRIMARY KEY (auto))")) or die $DBI::errstr;
print "Inserting $rows records\n"; print "Inserting $opt_rows records\n";
$|=1; # Flush output to stdout to be able to monitor process
for ($i=0 ; $i < $rows ; $i++) for ($i=0 ; $i < $opt_rows ; $i++)
{ {
$tmp= chr(65+$i) x ($i*10000+1); $tmp= chr(65+($i % 16)) x ($i*100000+1);
print $i," ",length($tmp),"\n";
$tmp= $dbh->quote($tmp); $tmp= $dbh->quote($tmp);
$dbh->do("insert into $table (test) values ($tmp)") or die $DBI::errstr; $dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
} }
print "Testing records\n"; print "Reading records\n";
$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr;
$sth=$dbh->prepare("select * from $table") or die $dbh->errstr;
$sth->execute() or die $sth->errstr; $sth->execute() or die $sth->errstr;
$i=0; $i=0;
while (($row = $sth->fetchrow_arrayref)) while (($row = $sth->fetchrow_arrayref))
{ {
print $row->[0]," ",length($row->[1]),"\n"; print $row->[0]," ",length($row->[1]),"\n";
die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+$i)) x ($i*10000+1)); die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1)));
$i++; $i++;
} }
die "Didn't get all rows from server" if ($i != $rows); die "Didn't get all rows from server" if ($i != $opt_rows);
$dbh->do("drop table $table") or die $DBI::errstr; $dbh->do("drop table $opt_table") or die $DBI::errstr;
print "Test ok\n"; print "Test ok\n";
exit 0; exit 0;
...@@ -1241,7 +1241,7 @@ static void handle_child(int __attribute__((unused)) sig) ...@@ -1241,7 +1241,7 @@ static void handle_child(int __attribute__((unused)) sig)
signal(SIGCHLD,handle_child); signal(SIGCHLD,handle_child);
} }
struct manager_thd* manager_thd_new(Vio* vio) static struct manager_thd* manager_thd_new(Vio* vio)
{ {
struct manager_thd* tmp; struct manager_thd* tmp;
if (!(tmp=(struct manager_thd*)my_malloc(sizeof(*tmp), if (!(tmp=(struct manager_thd*)my_malloc(sizeof(*tmp),
......
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