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'};
$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{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
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 -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 9307 -h $host -s shutdown");
}
if ($opt_stage == 0)
{
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 -P $mysql_tcp_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 9307 -h $host -s shutdown");
}
if (!$opt_use_old_distribution)
{
system("mkdir $host") if (! -d $host);
......@@ -86,7 +89,6 @@ if ($opt_stage == 0)
rm_all(<$host/mysql-*>);
system("mkdir $host/bin") if (! -d "$host/bin");
}
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
rm_all("$host/test");
system("mkdir $host/test") if (! -d "$host/test");
system("mkdir Logs") if (! -d "Logs");
......@@ -184,13 +186,14 @@ $ENV{"LD_LIBRARY_PATH"}= "$testdir/lib:" . $ENV{"LD_LIBRARY_PATH"};
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{
my ($slave_port);
$slave_port=$mysql_tcp_port+16;
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
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");
}
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;
safe_cd($test_dir);
......@@ -207,10 +210,11 @@ if ($opt_stage <= 6 && !$opt_no_test)
{
$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);
}
if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
{
safe_cd($test_dir);
......
......@@ -1523,7 +1523,7 @@ MySQL
@subheading Tutorials and Manuals
@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.
@item @uref{http://www.4t2.com/mysql}
......@@ -9620,7 +9620,7 @@ the @code{max_connections} variable.
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
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
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
......@@ -10031,8 +10031,15 @@ make
make_install
@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
@subsection Windows Notes
......@@ -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
"-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:
@example
......@@ -10647,6 +10654,15 @@ CXX=CC CXXFLAGS="-noex -xO4 -mt" \
./configure --prefix=/usr/local/mysql --enable-assembler
@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:
@example
......@@ -10851,7 +10867,7 @@ Configure MySQL with the @code{--with-named-z-libs=no} option.
@node Solaris x86, , Solaris 2.7, Solaris
@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.
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
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}.
The @strong{MYSQL} Makefiles require GNU make (@code{gmake}) to work.
If you want to compile @strong{MYSQL} you need to install GNU make
first.
The MySQL @file{Makefile}s require GNU make (@code{gmake}) to work. If
you want to compile MySQL you need to install GNU @code{make} first.
Be sure to have your name resolver setup correct. Otherwise you may
experience resolver delays or failures when connecting to @code{mysqld}.
......@@ -15499,7 +15514,7 @@ With this option,
@code{SHOW DATABASES} returns only those databases for which the user has
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}
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
......@@ -21371,7 +21386,7 @@ You can find the MySQL-max binaries at
@uref{http://www.mysql.com/downloads/mysql-max-3.23.html}.
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}.
@xref{Windows installation}.
......@@ -21388,7 +21403,7 @@ mysql> show variables like "have_%";
| have_bdb | YES |
| have_innodb | NO |
| have_isam | YES |
| have_raid | YES |
| have_raid | NO |
| have_ssl | NO |
+---------------+-------+
@end example
......@@ -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.
@item
@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
properly locked if another thread issues a table lock.
@item
......@@ -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.
@menu
* News-3.23.42:: Changes in release 3.23.42
* News-3.23.41:: Changes in release 3.23.41
* News-3.23.40:: Changes in release 3.23.40
* News-3.23.39:: Changes in release 3.23.39
......@@ -46509,8 +46525,19 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0
@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
@itemize @bullet
......@@ -46548,9 +46575,6 @@ Added prototypes for @code{my_thread_init()} and @code{my_thread_end()} to
@item
Added option @code{--safe-user-create} to @code{mysqld}.
@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
@code{Can't find record in '#...}
@end itemize
......@@ -259,10 +259,14 @@ double Item_func_plus::val()
longlong Item_func_plus::val_int()
{
longlong value=args[0]->val_int()+args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0;
return value;
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int()+args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0;
return value;
}
return (longlong) Item_func_plus::val();
}
double Item_func_minus::val()
......@@ -275,12 +279,17 @@ double Item_func_minus::val()
longlong Item_func_minus::val_int()
{
longlong value=args[0]->val_int() - args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0;
return value;
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int() - args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0;
return value;
}
return (longlong) Item_func_minus::val();
}
double Item_func_mul::val()
{
double value=args[0]->val()*args[1]->val();
......@@ -291,10 +300,14 @@ double Item_func_mul::val()
longlong Item_func_mul::val_int()
{
longlong value=args[0]->val_int()*args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0; /* purecov: inspected */
return value;
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int()*args[1]->val_int();
if ((null_value=args[0]->null_value || args[1]->null_value))
return 0; /* purecov: inspected */
return value;
}
return (longlong) Item_func_mul::val();
}
......@@ -309,14 +322,15 @@ double Item_func_div::val()
longlong Item_func_div::val_int()
{
// the integer result of division of two arguments needs to be computed
// 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
// if you do val_int(41.5)/val_int(3.4), as in the old code, we get 42/3=
// 14, which is wrong. This would break sec_to_time(a/b),
// from_unixtime(a/b), and
// all functions that do val_int() on their arguments
return (longlong)val();
if (hybrid_type == INT_RESULT)
{
longlong value=args[0]->val_int();
longlong val2=args[1]->val_int();
if ((null_value= val2 == 0 || args[0]->null_value || args[1]->null_value))
return 0;
return value/val2;
}
return (longlong) Item_func_div::val();
}
void Item_func_div::fix_length_and_dec()
......
......@@ -149,11 +149,11 @@ void MYSQL_LOG::init(enum_log_type log_type_arg)
void MYSQL_LOG::close_index()
{
if(index_file >= 0)
{
my_close(index_file, MYF(0));
index_file = -1;
}
if (index_file >= 0)
{
my_close(index_file, MYF(0));
index_file = -1;
}
}
void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
......
......@@ -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
wildcards
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