Commit 301af97d authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fix for handling of floats inside val_int() of +, - * and /.

parent 6c7ce435
...@@ -68,17 +68,20 @@ delete $ENV{'MY_BASEDIR_VERSION'}; ...@@ -68,17 +68,20 @@ delete $ENV{'MY_BASEDIR_VERSION'};
$ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread; $ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread;
$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build"; $ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl"; $ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
if ($opt_stage == 0) if (-x "$host/bin/mysqladmin")
{ {
print "$host: Removing old distribution\n" if ($opt_debug);
if (-x "$host/bin/mysqladmin")
{
log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown"); log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown");
log_system("$host/bin/mysqladmin --no-defaults -u root -P $mysql_tcp_port -h $host -s shutdown"); log_system("$host/bin/mysqladmin --no-defaults -u root -P $mysql_tcp_port -h $host -s shutdown");
log_system("$host/bin/mysqladmin --no-defaults -u root -P $slave_port -h $host -s shutdown");
log_system("$host/bin/mysqladmin --no-defaults -u root -P 9306 -h $host -s shutdown"); log_system("$host/bin/mysqladmin --no-defaults -u root -P 9306 -h $host -s shutdown");
log_system("$host/bin/mysqladmin --no-defaults -u root -P 9307 -h $host -s shutdown"); log_system("$host/bin/mysqladmin --no-defaults -u root -P 9307 -h $host -s shutdown");
} }
if ($opt_stage == 0)
{
print "$host: Removing old distribution\n" if ($opt_debug);
if (!$opt_use_old_distribution) if (!$opt_use_old_distribution)
{ {
system("mkdir $host") if (! -d $host); system("mkdir $host") if (! -d $host);
...@@ -86,7 +89,6 @@ if ($opt_stage == 0) ...@@ -86,7 +89,6 @@ if ($opt_stage == 0)
rm_all(<$host/mysql-*>); rm_all(<$host/mysql-*>);
system("mkdir $host/bin") if (! -d "$host/bin"); system("mkdir $host/bin") if (! -d "$host/bin");
} }
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
rm_all("$host/test"); rm_all("$host/test");
system("mkdir $host/test") if (! -d "$host/test"); system("mkdir $host/test") if (! -d "$host/test");
system("mkdir Logs") if (! -d "Logs"); system("mkdir Logs") if (! -d "Logs");
...@@ -184,13 +186,14 @@ $ENV{"LD_LIBRARY_PATH"}= "$testdir/lib:" . $ENV{"LD_LIBRARY_PATH"}; ...@@ -184,13 +186,14 @@ $ENV{"LD_LIBRARY_PATH"}= "$testdir/lib:" . $ENV{"LD_LIBRARY_PATH"};
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest) if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{ {
my ($slave_port); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
$slave_port=$mysql_tcp_port+16;
safe_cd("${test_dir}/mysql-test"); safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --sleep=10", "tests were successful"); check_system("./mysql-test-run --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --sleep=10", "tests were successful");
} }
if ($opt_stage <= 6 && !$opt_no_test) # Start the server if we are going to run any of the benchmarks
if (!$opt_no_test)
{ {
my $extra; my $extra;
safe_cd($test_dir); safe_cd($test_dir);
...@@ -207,10 +210,11 @@ if ($opt_stage <= 6 && !$opt_no_test) ...@@ -207,10 +210,11 @@ if ($opt_stage <= 6 && !$opt_no_test)
{ {
$extra.=" --innodb_data_file_path=ibdata1:100M"; $extra.=" --innodb_data_file_path=ibdata1:100M";
} }
safe_system("./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking $extra >> $log 2>&1 &"); safe_system("./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-l\ocking $extra >> $log 2>&1 &");
sleep(2); sleep(2);
} }
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)
{ {
safe_cd($test_dir); safe_cd($test_dir);
......
...@@ -1523,7 +1523,7 @@ MySQL ...@@ -1523,7 +1523,7 @@ MySQL
@subheading Tutorials and Manuals @subheading Tutorials and Manuals
@table @asis @table @asis
@item @uref{http://netgraft.com/~mbac/research/mysqlmyths.html, MySQL Myths Debunked} @item @uref{http://michael.bacarella.com/research/mysqlmyths.html, MySQL Myths Debunked}
MySQL used in the real world. MySQL used in the real world.
@item @uref{http://www.4t2.com/mysql} @item @uref{http://www.4t2.com/mysql}
...@@ -9620,7 +9620,7 @@ the @code{max_connections} variable. ...@@ -9620,7 +9620,7 @@ the @code{max_connections} variable.
If you build MySQL yourself and do not what to mess with patching If you build MySQL yourself and do not what to mess with patching
LinuxThreads, you should set @code{max_connections} to a value no higher LinuxThreads, you should set @code{max_connections} to a value no higher
than 500. It should be even less if you have a large key buffer, large than 500. It should be even less if you have a large key buffer, large
heap tables, or some other things that make @strong{mysqld} allocate a lot heap tables, or some other things that make @code{mysqld} allocate a lot
of memory or if you are running a 2.2 kernel with a 2GB patch. If you are of memory or if you are running a 2.2 kernel with a 2GB patch. If you are
using our binary or RPM version 3.23.25 or later, you can safely set using our binary or RPM version 3.23.25 or later, you can safely set
@code{max_connections} at 1500, assuming no large key buffer or heap tables @code{max_connections} at 1500, assuming no large key buffer or heap tables
...@@ -10031,8 +10031,15 @@ make ...@@ -10031,8 +10031,15 @@ make
make_install make_install
@end example @end example
and @strong{mysqld} should be ready to run. and @code{mysqld} should be ready to run.
On Ia64 the MySQL client binaries are using shared libraries. This means
that if you install our binary distribution in some other place than
@file{/usr/local/mysql} you need to either modify @file{/etc/ld.so.conf}
or add the path to the directory where you have @file{libmysqlclient.so}
to the @code{LD_LIBRARY_PATH} environment variable.
@xref{Link errors}.
@node Windows, Solaris, Linux, Operating System Specific Notes @node Windows, Solaris, Linux, Operating System Specific Notes
@subsection Windows Notes @subsection Windows Notes
...@@ -10638,7 +10645,7 @@ CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \ ...@@ -10638,7 +10645,7 @@ CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \
If you have a ultra sparc, you can get 4 % more performance by adding If you have a ultra sparc, you can get 4 % more performance by adding
"-mcpu=v8 -Wa,-xarch=v8plusa" to CFLAGS and CXXFLAGS. "-mcpu=v8 -Wa,-xarch=v8plusa" to CFLAGS and CXXFLAGS.
If you have the Sun Workshop (SunPro) 4.2 (or newer) compiler, you can If you have Sun Workshop (Fortre) 5.3 (or newer) compiler, you can
run @code{configure} like this: run @code{configure} like this:
@example @example
...@@ -10647,6 +10654,15 @@ CXX=CC CXXFLAGS="-noex -xO4 -mt" \ ...@@ -10647,6 +10654,15 @@ CXX=CC CXXFLAGS="-noex -xO4 -mt" \
./configure --prefix=/usr/local/mysql --enable-assembler ./configure --prefix=/usr/local/mysql --enable-assembler
@end example @end example
In the MySQL benchmarks, we got a 6 % speedup on an Ultrasparc when
using Sun Workshop 5.3 compared to using gcc with -mcpu flags.
If you get a problem with @code{fdatasync} or @code{sched_yield},
you can fix this by adding @code{LIBS=-lrt} to the configure line
The following paragraph is only relevant for older compilers than
WorkShop 5.3:
You may also have to edit the @code{configure} script to change this line: You may also have to edit the @code{configure} script to change this line:
@example @example
...@@ -10851,7 +10867,7 @@ Configure MySQL with the @code{--with-named-z-libs=no} option. ...@@ -10851,7 +10867,7 @@ Configure MySQL with the @code{--with-named-z-libs=no} option.
@node Solaris x86, , Solaris 2.7, Solaris @node Solaris x86, , Solaris 2.7, Solaris
@subsubsection Solaris x86 Notes @subsubsection Solaris x86 Notes
On Solaris 2.8 on x86, @strong{mysqld} will core dump if you run On Solaris 2.8 on x86, @code{mysqld} will core dump if you run
'strip' in. 'strip' in.
If you are using @code{gcc} or @code{egcs} on Solaris x86 and you If you are using @code{gcc} or @code{egcs} on Solaris x86 and you
...@@ -10919,9 +10935,8 @@ It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on ...@@ -10919,9 +10935,8 @@ It is recommended you use MIT-pthreads on FreeBSD 2.x and native threads on
Versions 3 and up. It is possible to run with native threads on some late Versions 3 and up. It is possible to run with native threads on some late
2.2.x versions but you may encounter problems shutting down @code{mysqld}. 2.2.x versions but you may encounter problems shutting down @code{mysqld}.
The @strong{MYSQL} Makefiles require GNU make (@code{gmake}) to work. The MySQL @file{Makefile}s require GNU make (@code{gmake}) to work. If
If you want to compile @strong{MYSQL} you need to install GNU make you want to compile MySQL you need to install GNU @code{make} first.
first.
Be sure to have your name resolver setup correct. Otherwise you may Be sure to have your name resolver setup correct. Otherwise you may
experience resolver delays or failures when connecting to @code{mysqld}. experience resolver delays or failures when connecting to @code{mysqld}.
...@@ -15499,7 +15514,7 @@ With this option, ...@@ -15499,7 +15514,7 @@ With this option,
@code{SHOW DATABASES} returns only those databases for which the user has @code{SHOW DATABASES} returns only those databases for which the user has
some kind of privilege. some kind of privilege.
@item @code{--safe-user-create} @item --safe-user-create
If this is enabled, an user can't create new users with the @code{GRANT} If this is enabled, an user can't create new users with the @code{GRANT}
command, if the user doesn't have @code{INSERT} privilege to the command, if the user doesn't have @code{INSERT} privilege to the
@code{mysql.user} table. If you want to give a user access to just create @code{mysql.user} table. If you want to give a user access to just create
...@@ -21371,7 +21386,7 @@ You can find the MySQL-max binaries at ...@@ -21371,7 +21386,7 @@ You can find the MySQL-max binaries at
@uref{http://www.mysql.com/downloads/mysql-max-3.23.html}. @uref{http://www.mysql.com/downloads/mysql-max-3.23.html}.
The Windows MySQL 3.23 binary distribution includes both the The Windows MySQL 3.23 binary distribution includes both the
standard @strong{mysqld.exe} binary and the @code{mysqld-max.exe} binary. standard @code{mysqld.exe} binary and the @code{mysqld-max.exe} binary.
@uref{http://www.mysql.com/downloads/mysql-3.23.html}. @uref{http://www.mysql.com/downloads/mysql-3.23.html}.
@xref{Windows installation}. @xref{Windows installation}.
...@@ -21388,7 +21403,7 @@ mysql> show variables like "have_%"; ...@@ -21388,7 +21403,7 @@ mysql> show variables like "have_%";
| have_bdb | YES | | have_bdb | YES |
| have_innodb | NO | | have_innodb | NO |
| have_isam | YES | | have_isam | YES |
| have_raid | YES | | have_raid | NO |
| have_ssl | NO | | have_ssl | NO |
+---------------+-------+ +---------------+-------+
@end example @end example
...@@ -35830,7 +35845,7 @@ stored as the key data + the @code{PRIMARY KEY}, it's important to keep the ...@@ -35830,7 +35845,7 @@ stored as the key data + the @code{PRIMARY KEY}, it's important to keep the
@code{PRIMARY KEY} as short as possible to save disk and get better speed. @code{PRIMARY KEY} as short as possible to save disk and get better speed.
@item @item
@code{LOCK TABLES} works on @code{BDB} tables as with other tables. If @code{LOCK TABLES} works on @code{BDB} tables as with other tables. If
you don't use @code{LOCK TABLE}, @strong{MYSQL} will issue an internal you don't use @code{LOCK TABLE}, MYSQL will issue an internal
multiple-write lock on the table to ensure that the table will be multiple-write lock on the table to ensure that the table will be
properly locked if another thread issues a table lock. properly locked if another thread issues a table lock.
@item @item
...@@ -46464,6 +46479,7 @@ users use this code as the rest of the code and because of this we are ...@@ -46464,6 +46479,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code. not yet 100% confident in this code.
@menu @menu
* News-3.23.42:: Changes in release 3.23.42
* News-3.23.41:: Changes in release 3.23.41 * News-3.23.41:: Changes in release 3.23.41
* News-3.23.40:: Changes in release 3.23.40 * News-3.23.40:: Changes in release 3.23.40
* News-3.23.39:: Changes in release 3.23.39 * News-3.23.39:: Changes in release 3.23.39
...@@ -46509,8 +46525,19 @@ not yet 100% confident in this code. ...@@ -46509,8 +46525,19 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@node News-3.23.42, News-3.23.41, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.42
@itemize @bullet
@item
Use real arithmetic operations even in integer context if not
all arguments are integers. (Fixes uncommon bug in some integer
context).
@item
Don't force everything to lower cases on windows. (To fix problem
with windows and @code{ALTER TABLE}).
@end itemize
@node News-3.23.41, News-3.23.40, News-3.23.x, News-3.23.x @node News-3.23.41, News-3.23.40, News-3.23.42, News-3.23.x
@appendixsubsec Changes in release 3.23.41 @appendixsubsec Changes in release 3.23.41
@itemize @bullet @itemize @bullet
...@@ -46548,9 +46575,6 @@ Added prototypes for @code{my_thread_init()} and @code{my_thread_end()} to ...@@ -46548,9 +46575,6 @@ Added prototypes for @code{my_thread_init()} and @code{my_thread_end()} to
@item @item
Added option @code{--safe-user-create} to @code{mysqld}. Added option @code{--safe-user-create} to @code{mysqld}.
@item @item
Added options to the @code{--ansi} startup options to let the user
decide which @code{ansi} options one to enable.
@item
Fixed bug in @code{SELECT DISTINCT ... HAVING} that casued error message Fixed bug in @code{SELECT DISTINCT ... HAVING} that casued error message
@code{Can't find record in '#...} @code{Can't find record in '#...}
@end itemize @end itemize
...@@ -259,10 +259,14 @@ double Item_func_plus::val() ...@@ -259,10 +259,14 @@ double Item_func_plus::val()
longlong Item_func_plus::val_int() longlong Item_func_plus::val_int()
{ {
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int()+args[1]->val_int(); longlong value=args[0]->val_int()+args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value)) if ((null_value=args[0]->null_value || args[1]->null_value))
return 0; return 0;
return value; return value;
}
return (longlong) Item_func_plus::val();
} }
double Item_func_minus::val() double Item_func_minus::val()
...@@ -275,12 +279,17 @@ double Item_func_minus::val() ...@@ -275,12 +279,17 @@ double Item_func_minus::val()
longlong Item_func_minus::val_int() longlong Item_func_minus::val_int()
{ {
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int() - args[1]->val_int(); longlong value=args[0]->val_int() - args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value)) if ((null_value=args[0]->null_value || args[1]->null_value))
return 0; return 0;
return value; return value;
}
return (longlong) Item_func_minus::val();
} }
double Item_func_mul::val() double Item_func_mul::val()
{ {
double value=args[0]->val()*args[1]->val(); double value=args[0]->val()*args[1]->val();
...@@ -291,10 +300,14 @@ double Item_func_mul::val() ...@@ -291,10 +300,14 @@ double Item_func_mul::val()
longlong Item_func_mul::val_int() longlong Item_func_mul::val_int()
{ {
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int()*args[1]->val_int(); longlong value=args[0]->val_int()*args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value)) if ((null_value=args[0]->null_value || args[1]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
return value; return value;
}
return (longlong) Item_func_mul::val();
} }
...@@ -309,14 +322,15 @@ double Item_func_div::val() ...@@ -309,14 +322,15 @@ double Item_func_div::val()
longlong Item_func_div::val_int() longlong Item_func_div::val_int()
{ {
// the integer result of division of two arguments needs to be computed if (hybrid_type == INT_RESULT)
// as a type-cast division of val(), not as diviion of val_int() of each {
// argument. For example, val_int(41.5/3.4) = val_int(12.206) = 12, but longlong value=args[0]->val_int();
// if you do val_int(41.5)/val_int(3.4), as in the old code, we get 42/3= longlong val2=args[1]->val_int();
// 14, which is wrong. This would break sec_to_time(a/b), if ((null_value= val2 == 0 || args[0]->null_value || args[1]->null_value))
// from_unixtime(a/b), and return 0;
// all functions that do val_int() on their arguments return value/val2;
return (longlong)val(); }
return (longlong) Item_func_div::val();
} }
void Item_func_div::fix_length_and_dec() void Item_func_div::fix_length_and_dec()
......
...@@ -149,7 +149,7 @@ void MYSQL_LOG::init(enum_log_type log_type_arg) ...@@ -149,7 +149,7 @@ void MYSQL_LOG::init(enum_log_type log_type_arg)
void MYSQL_LOG::close_index() void MYSQL_LOG::close_index()
{ {
if(index_file >= 0) if (index_file >= 0)
{ {
my_close(index_file, MYF(0)); my_close(index_file, MYF(0));
index_file = -1; index_file = -1;
......
...@@ -354,7 +354,7 @@ static uint get_access(TABLE *form,uint fieldnr) ...@@ -354,7 +354,7 @@ static uint get_access(TABLE *form,uint fieldnr)
/* /*
return a number with if sorted put string in this order: return a number which, if sorted 'desc', puts strings in this order:
no wildcards no wildcards
wildcards wildcards
empty string empty string
......
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