Merge work:/home/bk/mysql-4.0 into rescue.:/my/bk/mysql-4.0

BitKeeper/etc/logging_ok:
  auto-union
This commit is contained in:
unknown 2002-09-05 14:00:05 +03:00
commit d43ba827ed
78 changed files with 732 additions and 233 deletions

View file

@ -14,6 +14,7 @@ bell@sanja.is.com.ua
davida@isil.mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@work.mysql.com
jani@dsl-jkl1657.dial.inet.fi
jani@hynda.(none)
jani@hynda.mysql.fi
@ -29,6 +30,7 @@ jorge@linux.jorge.mysql.com
kaj@work.mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
miguel@hegel.br
miguel@hegel.local
miguel@light.local
monty@bitch.mysql.fi
@ -37,12 +39,14 @@ monty@hundin.mysql.fi
monty@mashka.mysql.fi
monty@narttu.
monty@narttu.mysql.fi
monty@rescue.
monty@tik.
monty@tik.mysql.fi
monty@tramp.mysql.fi
monty@work.mysql.com
mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org
nick@mysql.com
nick@nick.leippe.com
paul@central.snake.net
paul@teton.kitebird.com
@ -75,5 +79,3 @@ worm@altair.is.lan
zak@balfor.local
zak@linux.local
zgreant@mysql.com
miguel@hegel.br
monty@rescue.

View file

@ -1,15 +1,56 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
use Getopt::Long;
$opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env="";
$opt_dbd_options=$opt_perl_options=$opt_make_options=$opt_suffix="";
@config_options= ();
@make_options= ();
$opt_distribution=$opt_user=$opt_config_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$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_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=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=0;
$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0;
GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","make-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","raid","libwrap","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s") || usage();
GetOptions(
"bdb",
"build-thread=i",
"config-env=s",
"config-options=s" => \@config_options,
"dbd-options=s",
"debug",
"delete",
"distribution=s",
"enable-shared",
"fast-benchmark",
"help|Information",
"innodb",
"libwrap",
"local-perl",
"make-options=s" => \@make_options,
"no-crash-me",
"no-perl",
"no-strip",
"no-test|no-mysqltest",
"perl-files=s",
"perl-options=s",
"raid",
"stage=i",
"static-client",
"static-perl",
"static-server",
"suffix=s",
"sur",
"tcpip",
"tmp=s",
"use-old-distribution",
"user=s",
"version-suffix=s",
"with-low-memory",
"with-other-libc=s",
"with-small-disk",
) || usage();
usage() if ($opt_help || $opt_Information);
usage() if ($opt_help);
usage() if (!$opt_distribution);
if ($opt_bdb && $opt_version_suffix eq "")
@ -17,9 +58,20 @@ if ($opt_bdb && $opt_version_suffix eq "")
$opt_version_suffix="-max";
}
if (@make_options > 0)
{
chomp(@make_options);
$opt_make_options= join(" ", @make_options);
}
if (@config_options > 0)
{
chomp(@config_options);
$opt_config_options= join(" ", @config_options);
}
chomp($host=`hostname`);
$full_host_name=$host;
info("Compiling MySQL$opt_version_suffix at $host$suffix, stage: $opt_stage\n");
$connect_option= ($opt_tcpip ? "--host=$host" : "");
$host =~ /^([^.-]*)/;
$host=$1 . $opt_suffix;
@ -62,7 +114,6 @@ else
}
$bench_tmpdir="$opt_tmp/my_build-$host";
$ENV{'PATH'}= "$pwd/$host/bin:" . $ENV{'PATH'};
$rsh=which("rcmd","rsh");
$make=which("gmake","make"); # Can't use -j here!
$tar=which("gtar","tar");
$sendmail=find("/usr/lib/sendmail","/usr/sbin/sendmail");
@ -88,6 +139,8 @@ $|=1;
select STDOUT;
$|=1;
info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n");
if (-x "$host/bin/mysqladmin")
{
log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown");
@ -141,47 +194,32 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution)
}
safe_cd("$pwd/$host/$ver");
#
# Configure the sources
#
if ($opt_stage <= 1)
{
$opt_config_options.=" --with-low-memory" if ($opt_with_low_memory);
# Fix files if this is in another timezone than work.mysql.com
# Fix files if this is in another timezone than the build host
unlink("config.cache");
unlink("bdb/build_unix/config.cache");
unlink("innobase/config.cache");
log_system("$make clean") if ($opt_use_old_distribution);
if ($opt_static_server)
{
$opt_config_options.=" --with-mysqld-ldflags=-all-static";
}
if ($opt_static_client)
{
$opt_config_options.=" --with-client-ldflags=-all-static";
}
$opt_config_options.= " --disable-shared" if (!$opt_enable_shared); # Default for binary versions
$opt_config_options.= " --with-berkeley-db" if ($opt_bdb);
$opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client);
$opt_config_options.= " --with-innodb" if ($opt_innodb);
$opt_config_options.= " --with-libwrap" if ($opt_libwrap);
$opt_config_options.= " --with-low-memory" if ($opt_with_low_memory);
$opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server);
$opt_config_options.= " --with-raid" if ($opt_raid);
if ($opt_with_other_libc)
{
$opt_with_other_libc= "--with-other-libc=$opt_with_other_libc";
$opt_config_options.= " $opt_with_other_libc";
}
if (!$opt_enable_shared)
{
$opt_config_options.= " --disable-shared"; # Default for binary versions
}
if ($opt_bdb)
{
$opt_config_options.= " --with-berkeley-db"
}
if ($opt_raid)
{
$opt_config_options.= " --with-raid"
}
if ($opt_innodb)
{
$opt_config_options.= " --with-innodb"
}
if ($opt_libwrap)
{
$opt_config_options.= " --with-libwrap"
$opt_with_other_libc= " --with-other-libc=$opt_with_other_libc";
$opt_config_options.= $opt_with_other_libc;
}
check_system("$opt_config_env ./configure --prefix=/usr/local/mysql --with-comment=\"Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
if (-d "$pwd/$host/include-mysql")
{
@ -189,6 +227,9 @@ if ($opt_stage <= 1)
}
}
#
# Compile the binaries
#
if ($opt_stage <= 2)
{
my ($command);
@ -199,16 +240,15 @@ if ($opt_stage <= 2)
}
#
# Create a binary distrubtion
# Create the binary distribution
#
if ($opt_stage <= 3)
{
my ($flags);
my $flags= "";
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");
$flags="";
$flags.="--no-strip" if ($opt_no_strip);
$flags.= "--no-strip" if ($opt_no_strip);
check_system("scripts/make_binary_distribution --tmp=$opt_tmp --suffix=$opt_suffix $flags",".tar.gz created");
safe_system("mv mysql*.tar.gz $pwd/$host");
if (-f "client/.libs/mysqladmin")
@ -222,15 +262,15 @@ if ($opt_stage <= 3)
safe_system("$make clean") if ($opt_with_small_disk);
}
#
# Unpack and test the binary distrubtion
#
$tar_file=<$pwd/$host/*.tar.gz>;
if (!defined($tar_file))
{
$tar_file=<$pwd/$host/*.tgz>;
}
#
# Unpack the binary distribution
#
if ($opt_stage <= 4 && !$opt_no_test)
{
rm_all(<$pwd/$host/test/*>);
@ -243,15 +283,19 @@ $ver=$1;
$test_dir="$pwd/$host/test/$ver";
$ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"};
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
#
# Run the test suite
#
if ($opt_stage <= 5 && !$opt_no_test)
{
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
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");
}
#
# Start the server if we are going to run any of the benchmarks
#
if (!$opt_no_test)
{
my $extra;
@ -273,7 +317,9 @@ if (!$opt_no_test)
sleep(2);
}
#
# Compile and install the required Perl modules
#
if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
{
safe_cd($test_dir);
@ -306,7 +352,9 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test)
}
}
#
# Run crash-me test
#
if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
{
safe_cd("$test_dir/sql-bench");
@ -314,6 +362,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me)
safe_system("perl ./crash-me --force --batch-mode $connect_option");
}
#
# Run sql-bench Benchmarks
#
if ($opt_stage <= 9 && !$opt_no_test)
{
safe_cd("$test_dir/sql-bench");
@ -330,11 +381,6 @@ if ($opt_stage <= 9 && !$opt_no_test)
}
}
if ($opt_stage <= 10 && $opt_result)
{
safe_system("rcp $pwd/$host/*.tar.gz $opt_result");
}
rm_all($bench_tmpdir);
rm_all("$opt_tmp") if ($new_opt_tmp);
@ -353,57 +399,105 @@ $0 version 1.4
$0 takes the following options:
--bdb
Compile with support for Berkeley DB tables
--config-env <environment for configure>
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
--config-options <options>
To add some extra options to configure (e.g. '--with-perl=yes')
--dbd-options <options>
Options for Makefile.PL when configuring msql-mysql-modules.
--debug
Print all shell commands on stdout.
--delete
Delete the distribution file.
--distribution <distribution_file>
Name of the MySQL source distribution file.
--enable-shared
Compile with shared libraries
--fast-benchmark
Run fast benchmark only to speed up testing
--help or --Information
Show this help
--innodb
Compile with support for Innodb tables
--bdb
Compile with support for Berkeley DB tables
--libwrap
Compile with TCP wrapper support
--user 'user_name'
Mail 'user_name'\@mysql.com if something went wrong.
If user is empty then no mail is sent.
--local-perl
Install Perl modules locally
--distribution 'distribution_file'
Name of the MySQL distribution file.
--make-options <options>
Options to make after configure. (Like 'CXXLD=gcc')
--result 'result_dir'
Send binary distribution to result_dir
--no-crash-me
Do not run the "crash-me" test
--no-delete
Do not delete the distribution file.
--no-strip
Do not strip the binaries included in the binary distribution
--no-test
Do not run any tests
--perl-files=list of files
Compile and install the given perl modules.
--no-test
Don not run crash-me or the benchmarks.
--perl-options <options>
Build Perl modules with the additional options
--config-options 'some extra configure options'
To add some extra options, like '--with-perl=yes'
--raid
Compile with RAID support
--config-env 'environment for configure'
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
--stage (1-6)
Start script from some specific point.
--dbd-options 'options'
Options for Makefile.PL when configuring msql-mysql-modules.
--static-client
Build statically linked client binaries
--make-options 'options'
Options to make after configure. (Like 'CXXLD=gcc')
--static-perl
Build statically linked Perl modules
--static-server
Build statically linked server binary
--tcpip
Connect to the server to be tested via TCP/IP instead of socket
--tmp <directory>
Use a different temporary directory than /tmp
--use-old-distribution
Do not clean up the build environment and extract a fresh source
distribution, use an existing one instead.
--user <user_name>
Mail 'user_name'\@mysql.com if something went wrong.
If user is empty then no mail is sent.
--version-suffix suffix
Can be used to set a suffix (normally 'com' or '-max') for a distribution
Set name suffix (e.g. 'com' or '-max') for a distribution
--with-low-memory
Use less memory when compiling.
-- stage (1-6)
Start script from some specific point.
--with-other-libc <path to libc>
Link against libc and other standard libraries installed in the specified
non-standard location overriding default.
-- debug
Print all shell commands on stdout.
--with-small-disk
Clean up the build environment before testing the binary distribution
(to save disk space)
EOF
exit 1;
}
@ -411,7 +505,7 @@ exit 1;
sub abort
{
my($message)=@_;
my($command,$mail_header_file);
my($mail_header_file);
print LOG "\n$message\n";
print "$host: $message\n" if ($opt_debug);
close LOG;
@ -424,9 +518,8 @@ sub abort
print TMP "To: $email\n";
print TMP "Subject: MySQL compilation failed again\n\n";
close TMP;
$command=($opt_rsh_mail) ? "$rsh analytik" : "";
system("tail -30 $log > $log.mail");
system("cat $mail_header_file $log.mail | $command $sendmail -t -f $email");
system("cat $mail_header_file $log.mail | $sendmail -t -f $email");
unlink($mail_header_file);
unlink("$log.mail");
}

View file

@ -152,12 +152,11 @@ database server.
production systems as well as for embedding into mass-deployed software.
@code{MySQL} is a trademark of @code{MySQL AB}.
The @code{MySQL} software has @code{Dual Licensing}, which means you can use
the @code{MySQL} software free of charge under the
@code{GNU General Public License} (@uref{http://www.gnu.org/licenses/}).
You can also purchase commercial @code{MySQL} licenses from
@code{MySQL AB} if you do not wish to be bound by the terms of the
@code{GPL}.
The @code{MySQL} software is @code{Dual Licensed}. Users can choose to
use the @code{MySQL} software as an @code{Open Source}/@code{Free Software}
product under the terms of the @code{GNU General Public License}
(@uref{http://www.gnu.org/licenses/}) or can purchase a standard
commercial license from @code{MySQL AB}.
@xref{Licensing and Support}.
The @code{MySQL} web site (@uref{http://www.mysql.com/}) provides the
@ -215,6 +214,7 @@ For a list of all the contributors to this project, see @ref{Credits}.
Reports of errors (often called bugs), as well as questions and comments,
should be sent to the mailing list at @email{mysql@@lists.mysql.com}.
@xref{Bug reports}.
The @code{mysqlbug} script should be used to generate bug reports.
@c FIX! RPMs are also binary
For source distributions, the @code{mysqlbug} script can be found in the
@ -271,7 +271,7 @@ The PostScript version is produced using @code{texi2dvi} and @code{dvips}.
The PDF version is produced with @code{pdftex}.
If you have a hard time finding information in the manual, you can try
our searchable PHP version at @uref{http://www.mysql.com/doc/}.
our searchable version at @uref{http://www.mysql.com/doc/}.
If you have any suggestions concerning additions or corrections to this
manual, please send them to the documentation team at @email{docs@@mysql.com}.
@ -404,9 +404,9 @@ alternatives are listed within braces (@samp{@{} and @samp{@}}):
@cindex MySQL, introduction
@code{MySQL}, the most popular @code{Open Source} SQL database, is
developed and provided by @code{MySQL AB}. @code{MySQL AB} is a
commercial company that builds its business providing services around
the @code{MySQL} database.
developed, distributed and supported by @code{MySQL AB}. @code{MySQL AB} is a
commercial company founded by the MySQL developers that builds its business
providing services around the @code{MySQL} database.
@xref{What is MySQL AB}.
The @code{MySQL} web site (@uref{http://www.mysql.com/})
@ -3464,6 +3464,11 @@ that in MySQL Server, @code{VARCHAR} columns are treated the same way.
@item
You can only have up to 255 @code{ENUM} and @code{SET} columns in one table.
@item
In @code{MIN()}, @code{MAX()} and other aggregate functions, MySQL
currently compares @code{ENUM} and @code{SET} columns by their string
value rather than by the string's relative position in the set.
@item
@code{safe_mysqld} redirects all messages from @code{mysqld} to the
@code{mysqld} log. One problem with this is that if you execute
@ -8707,7 +8712,7 @@ cat /proc/sys/fs/super-max
@end example
If you have more than 16 MB of memory, you should add something like the
following in your boot script (@file{/etc/rc/boot.local} on SuSE):
following to your init scripts (e.g. @file{/etc/init.d/boot.local} on SuSE Linux):
@example
echo 65536 > /proc/sys/fs/file-max
@ -8715,10 +8720,22 @@ echo 8192 > /proc/sys/fs/dquot-max
echo 1024 > /proc/sys/fs/super-max
@end example
You can also run the preceding commands from the command-line as root, but in this case
your old limits will be used the next time your computer reboots.
You can also run the preceding commands from the command-line as root, but
these settings will be lost the next time your computer reboots.
You should also add /etc/my.cnf:
Alternatively, you can set these parameters on bootup by using the
@code{sysctl} tool, which is used by many Linux distributions (SuSE has
added it as well, beginning with SuSE Linux 8.0). Just put the following
values into a file named @file{/etc/sysctl.conf}:
@example
# Increase some values for MySQL
fs.file-max = 65536
fs.dquot-max = 8192
fs.super-max = 1024
@end example
You should also add the following to @file{/etc/my.cnf}:
@example
[safe_mysqld]
@ -10462,6 +10479,18 @@ CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
--with-named-thread-libs='-ldce' --prefix=/usr/local/mysql --disable-shared
@end example
The following configure line should work with gcc 3.1:
@example
CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors -fno-exceptions \
-fno-rtti -O3 -fPIC" ./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --with-pthread \
--with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
--disable-shared
@end example
@node HP-UX 11.x, IBM-AIX, HP-UX 10.20, Other Unix Notes
@subsubsection HP-UX Version 11.x Notes
@ -23395,13 +23424,14 @@ The binary logging is done immediately after a query completes but before
any locks are released or any commit is done. This ensures that the log
will be logged in the execution order.
All updates (@code{UPDATE}, @code{DELETE} or @code{INSERT}) that change
a transactional table (like BDB tables) are cached until a @code{COMMIT}.
Any updates to a non-transactional table are stored in the binary log at
once. Every thread will, on start, allocate a buffer of
@code{binlog_cache_size} to buffer queries. If a query is bigger than
this, the thread will open a temporary file to handle the bigger cache.
The temporary file will be deleted when the thread ends.
Updates to non-transactional tables are stored in the binary log
immediately after execution. For transactional tables such as @code{BDB}
or @code{InnoDB} tables, all updates (@code{UPDATE}, @code{DELETE}
or @code{INSERT}) that change tables are cached until a @code{COMMIT}.
Every thread will, on start, allocate a buffer of @code{binlog_cache_size}
to buffer queries. If a query is bigger than this, the thread will open
a temporary file to handle the bigger cache. The temporary file will
be deleted when the thread ends.
The @code{max_binlog_cache_size} can be used to restrict the total size used
to cache a multi-query transaction.
@ -24329,7 +24359,8 @@ MASTER_LOG_SEQ=log_seq AND MASTER_SERVER_ID=server_id} @tab
This command is used when a slave of a possibly dead/unavailable master
needs to be switched to replicate off another slave that has been
replicating the same master. The command will return recalculated
replication coordinates, and the output can be used in a subsequent
replication coordinates (the slave's current binary log file
name and position within that file). The output can be used in a subsequent
@code{CHANGE MASTER TO} command. Normal users should never need to run
this command. It is primarily reserved for internal use by the fail-safe
replication code. We may later change the syntax if we find a more
@ -26959,7 +26990,7 @@ For @code{BLOB} and @code{TEXT} columns, you must index a prefix of the
column. You cannot index the entire column.
In MySQL Version 3.23.23 or later, you can also create special
@strong{FULLTEXT} indexes. They are used for full-text search. Only the
@code{FULLTEXT} indexes. They are used for full-text search. Only the
@code{MyISAM} table type supports @code{FULLTEXT} indexes. They can be
created only from @code{VARCHAR} and @code{TEXT} columns.
Indexing always happens over the entire column and partial indexing is not
@ -28034,7 +28065,7 @@ You should not symlink tables on systems that don't have a fully
working @code{realpath()} call. (At least Linux and Solaris support
@code{realpath()})
In MySQL 4.0 symlinks are only fully supported for @code{MyISAM}
In MySQL 4.0 symlinks are fully supported only for @code{MyISAM}
tables. For other table types you will probably get strange problems
when doing any of the above mentioned commands.
@ -28044,11 +28075,11 @@ way (this is mostly relevant only for @code{MyISAM} tables).
@itemize @bullet
@item
In the data directory you will always have the table definition file
and the data/index files.
and the data and index files.
@item
You can symlink the index file and the datafile to different directories
independent of the other.
You can symlink the index file and the data file to different directories
independently of the other.
@item
The symlinking can be done from the operating system (if @code{mysqld} is
@ -28056,28 +28087,31 @@ not running) or with the @code{INDEX/DATA DIRECTORY="path-to-dir"} command
in @code{CREATE TABLE}. @xref{CREATE TABLE}.
@item
@code{myisamchk} will not replace a symlink with the index/file but
work directly on the files the symlinks points to. Any temporary files
will be created in the same directory where the data/index file is.
@code{myisamchk} will not replace a symlink with the data or index file but
work directly on the file the symlink points to. Any temporary files
will be created in the same directory where the data or index file is
located.
@item
When you drop a table that is using symlinks, both the symlink and the
file the symlink points to is dropped. This is a good reason to why you
should @strong{not} run @code{mysqld} as root and not allow persons to have write
access to the MySQL database directories.
file the symlink points to are dropped. This is a good reason to why you
should @strong{not} run @code{mysqld} as @code{root} or allow
persons to have write access to the MySQL database directories.
@item
If you rename a table with @code{ALTER TABLE RENAME} and you don't change
database, the symlink in the database directory will be renamed to the new
name and the data/index file will be renamed accordingly.
If you rename a table with @code{ALTER TABLE RENAME} and you don't move
the table to another database, the symlinks in the database directory
will be renamed to the new names and the data and index files will be
renamed accordingly.
@item
If you use @code{ALTER TABLE RENAME} to move a table to another database,
then the table will be moved to the other database directory and the old
symlinks and the files they pointed to will be deleted.
the table will be moved to the other database directory and the old
symlinks and the files they pointed to will be deleted. (In other words,
the new table will not be symlinked.)
@item
If you are not using symlinks you should use the @code{--skip-symlink}
If you are not using symlinks, you should use the @code{--skip-symlink}
option to @code{mysqld} to ensure that no one can drop or rename a file
outside of the @code{mysqld} data directory.
@end itemize
@ -28091,7 +28125,7 @@ Things that are not yet supported:
@item
@code{CREATE TABLE} doesn't report if the table has symbolic links.
@item
@code{mysqldump} doesn't include the symbolic links information in the output.
@code{mysqldump} doesn't include the symbolic link information in the output.
@item
@code{BACKUP TABLE} and @code{RESTORE TABLE} don't respect symbolic links.
@end itemize
@ -33845,6 +33879,11 @@ mysql> SELECT student_name, MIN(test_score), MAX(test_score)
-> GROUP BY student_name;
@end example
In @code{MIN()}, @code{MAX()} and other aggregate functions, MySQL
currently compares @code{ENUM} and @code{SET} columns by their string
value rather than by the string's relative position in the set.
This will be rectified.
@findex SUM()
@item SUM(expr)
Returns the sum of @code{expr}. Note that if the return set has no rows,
@ -36008,7 +36047,7 @@ When you use @code{ORDER BY} or @code{GROUP BY} with a @code{TEXT} or
@item
In MySQL Version 3.23.23 or later, you can also create special
@strong{FULLTEXT} indexes. They are used for full-text search. Only the
@code{FULLTEXT} indexes. They are used for full-text search. Only the
@code{MyISAM} table type supports @code{FULLTEXT} indexes. They can be created
only from @code{VARCHAR} and @code{TEXT} columns.
Indexing always happens over the entire column, partial indexing is not
@ -36920,7 +36959,7 @@ Lock one table at a time until the thread gets all locks.
This policy ensures that table locking is deadlock free. There is
however other things one needs to be aware of with this schema:
If you are using a @code{LOW_PRIORITY_WRITE} lock for a table, this
If you are using a @code{LOW_PRIORITY WRITE} lock for a table, this
means only that MySQL will wait for this particlar lock until
there is no threads that wants a @code{READ} lock. When the thread has
got the @code{WRITE} lock and is waiting to get the lock for the next
@ -50347,11 +50386,33 @@ each individual 4.0.x release.
@itemize @bullet
@item
Fixed a bug that caused @code{REPAIR TABLE} to fail on tables
with duplicates in a unique key.
@item
Fixed a bug in guessing a field type out of the function. The error was
introduced in 4.0.3 so that field type depended on the first argument to
the function instead of the function itself
@item
Fixed a bug with wildcarded fields in select list, which led to the wrong
number of elements in a list containing all fields
@item
Fixed bug with the @code{--slow-log} when logging an administrator command
(like @code{FLUSH TABLES}).
@item
Fixed a bug that @code{OPTIMIZE} of locked and modified table,
reported table corruption.
@item
Fixed a bug in my_getopt in handling of special prefixes (--skip-, --enable-).
--skip-external-locking didn't work and the bug may have affected other
similar options.
@item
Fixed bug in checking for output file name of the @code{tee} option.
@item
Added some more optimisation to use index for
@code{SELECT ... FROM many_tables .. ORDER BY key limit #}
@item
Fixed problem in @code{SHOW OPEN TABLES} when a user didn't have access right
to one of the opened tables.
@end itemize
@node News-4.0.3, News-4.0.2, News-4.0.4, News-4.0.x
@ -50649,6 +50710,8 @@ Fixed incorrect error value when doing a @code{SELECT} with an empty
@code{HEAP} table.
@item
Use @code{ORDER BY column DESC} now sorts @code{NULL} values first.
(In other words, @code{NULL} values sort first in all cases, whether or
not @code{DESC} is specified.)
@item
Fixed bug in @code{WHERE key_name='constant' ORDER BY key_name DESC}.
@item
@ -51050,11 +51113,21 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
Changed @code{AND/OR} to report that they can return NULL. This fixes a
small problem in @code{GROUP BY} on @code{AND/OR} expression that return
@code{NULL}.
@item
Fixed a bug that @code{OPTIMIZE} of locked and modified MyISAM table,
reported table corruption.
@item
Fixed a @code{BDB}-related @code{ALTER TABLE} bug with dropping a column
and shutting down immediately thereafter.
@item
Fixed problem with @code{configure ... --localstatedir=...}.
@item
Fixed problem with @code{UNSIGNED BIGINT} on AIX (again).
@item
Fixed bug in pthread_mutex_trylock() on HPUX 11.0
Fixed bug in pthread_mutex_trylock() on HPUX 11.0.
@item
Multithreaded stress tests for InnoDB.
@end itemize

View file

@ -1857,7 +1857,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1])))
end--;
end[0]= 0;
if (!strlen(file_name))
if (end == file_name)
{
printf("No outfile specified!\n");
return 0;

View file

@ -87,7 +87,7 @@ static struct my_option my_long_options[] =
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"extended", 'e',
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will run an extended repair on the table, which may not only take a long time to execute, but may produce a lot of garbage rows also!",
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
(gptr*) &opt_extended, (gptr*) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,

View file

@ -185,7 +185,9 @@ Q_LET, Q_ECHO,
Q_WHILE, Q_END_BLOCK,
Q_SYSTEM, Q_RESULT,
Q_REQUIRE, Q_SAVE_MASTER_POS,
Q_SYNC_WITH_MASTER, Q_ERROR,
Q_SYNC_WITH_MASTER,
Q_SYNC_SLAVE_WITH_MASTER,
Q_ERROR,
Q_SEND, Q_REAP,
Q_DIRTY_CLOSE, Q_REPLACE,
Q_PING, Q_EVAL,
@ -233,6 +235,7 @@ const char *command_names[]=
"require",
"save_master_pos",
"sync_with_master",
"sync_slave_with_master",
"error",
"send",
"reap",
@ -966,14 +969,13 @@ int do_echo(struct st_query* q)
}
int do_sync_with_master(struct st_query* q)
int do_sync_with_master2(const char* p)
{
MYSQL_RES* res;
MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql;
char query_buf[FN_REFLEN+128];
int offset = 0;
char* p = q->first_argument;
int rpl_parse;
if (!master_pos.file[0])
@ -1005,6 +1007,10 @@ int do_sync_with_master(struct st_query* q)
return 0;
}
int do_sync_with_master(struct st_query* q)
{
return do_sync_with_master2(q->first_argument);
}
int do_save_master_pos()
{
@ -1298,10 +1304,9 @@ void free_replace()
DBUG_VOID_RETURN;
}
int select_connection(struct st_query* q)
int select_connection(char *p)
{
char* p=q->first_argument, *name;
char* name;
struct connection *con;
DBUG_ENTER("select_connection");
DBUG_PRINT("enter",("name: '%s'",p));
@ -2403,7 +2408,7 @@ int main(int argc, char** argv)
processed = 1;
switch (q->type) {
case Q_CONNECT: do_connect(q); break;
case Q_CONNECTION: select_connection(q); break;
case Q_CONNECTION: select_connection(q->first_argument); break;
case Q_DISCONNECT:
case Q_DIRTY_CLOSE:
close_connection(q); break;
@ -2492,6 +2497,19 @@ int main(int argc, char** argv)
break;
case Q_SAVE_MASTER_POS: do_save_master_pos(); break;
case Q_SYNC_WITH_MASTER: do_sync_with_master(q); break;
case Q_SYNC_SLAVE_WITH_MASTER:
{
do_save_master_pos();
if (*q->first_argument)
select_connection(q->first_argument);
else
{
char buf[] = "slave";
select_connection(buf);
}
do_sync_with_master2("");
break;
}
case Q_COMMENT: /* Ignore row */
case Q_COMMENT_WITH_COMMAND:
case Q_PING:

View file

@ -22,6 +22,25 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
/*
Latching strategy of the InnoDB B-tree
--------------------------------------
A tree latch protects all non-leaf nodes of the tree. Each node of a tree
also has a latch of its own.
A B-tree operation normally first acquires an S-latch on the tree. It
searches down the tree and releases the tree latch when it has the
leaf node latch. To save CPU time we do not acquire any latch on
non-leaf nodes of the tree during a search, those pages are only bufferfixed.
If an operation needs to restructure the tree, it acquires an X-latch on
the tree before searching to a leaf node. If it needs, for example, to
split a leaf,
(1) InnoDB decides the split point in the leaf,
(2) allocates a new page,
(3) inserts the appropriate node pointer to the first non-leaf level,
(4) releases the tree X-latch,
(5) and then moves records from the leaf to the new allocated page.
Node pointers
-------------
Leaf pages of a B-tree contain the index records stored in the

View file

@ -90,6 +90,8 @@ case "$target_os" in
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
hp*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
aix*)
CFLAGS="$CFLAGS -DUNIV_AIX";;
irix*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
osf*)

View file

@ -308,13 +308,28 @@ dict_table_autoinc_get(
}
/************************************************************************
Reads the autoinc counter value, 0 if not yet initialized. Does not
increment the counter. */
Decrements the autoinc counter value by 1. */
void
dict_table_autoinc_decrement(
/*=========================*/
dict_table_t* table) /* in: table */
{
mutex_enter(&(table->autoinc_mutex));
table->autoinc = table->autoinc - 1;
mutex_exit(&(table->autoinc_mutex));
}
/************************************************************************
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
ib_longlong
dict_table_autoinc_read(
/*====================*/
/* out: value of the counter */
/* out: value for a new row, or 0 */
dict_table_t* table) /* in: table */
{
ib_longlong value;

View file

@ -114,13 +114,20 @@ dict_table_autoinc_get(
/* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */
/************************************************************************
Reads the autoinc counter value, 0 if not yet initialized. Does not
increment the counter. */
Decrements the autoinc counter value by 1. */
void
dict_table_autoinc_decrement(
/*=========================*/
dict_table_t* table); /* in: table */
/************************************************************************
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
ib_longlong
dict_table_autoinc_read(
/*====================*/
/* out: value of the counter */
/* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */
/************************************************************************
Peeks the autoinc counter value, 0 if not yet initialized. Does not

View file

@ -11,6 +11,7 @@ Created 10/21/1995 Heikki Tuuri
#include "ut0mem.h"
#include "srv0srv.h"
#include "fil0fil.h"
#include "buf0buf.h"
#undef HAVE_FDATASYNC
@ -2105,6 +2106,7 @@ os_aio_simulated_handle(
ibool ret;
ulint n;
ulint i;
ulint len2;
segment = os_aio_get_array_and_local_segment(&array, global_segment);
@ -2260,6 +2262,29 @@ consecutive_loop:
/* Do the i/o with ordinary, synchronous i/o functions: */
if (slot->type == OS_FILE_WRITE) {
if (array == os_aio_write_array) {
/* Do a 'last millisecond' check that the page end
is sensible; reported page checksum errors from
Linux seem to wipe over the page end */
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= total_len;
len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(combined_buf + len2
+ FIL_PAGE_LSN + 4)
!= mach_read_from_4(combined_buf + len2
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n");
page_print(combined_buf + len2);
fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
}
}
}
ret = os_file_write(slot->name, slot->file, combined_buf,
slot->offset, slot->offset_high, total_len);
} else {

View file

@ -128,8 +128,28 @@ os_thread_create(
pthread_attr_init(&attr);
#ifdef UNIV_AIX
/* We must make sure a thread stack is at least 32 kB, otherwise
InnoDB might crash; we do not know if the default stack size on
AIX is always big enough. An empirical test on AIX-4.3 suggested
the size was 96 kB, though. */
ret = pthread_attr_setstacksize(&attr,
(size_t)(PTHREAD_STACK_MIN + 32 * 1024));
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
exit(1);
}
#endif
ret = pthread_create(&pthread, &attr, start_f, arg);
if (ret) {
fprintf(stderr,
"InnoDB: Error: pthread_create returned %d\n", ret);
exit(1);
}
pthread_attr_destroy(&attr);
if (srv_set_thread_priorities) {

View file

@ -1350,7 +1350,9 @@ row_create_table_for_mysql(
"InnoDB: creating an InnoDB table with the same name in another\n"
"InnoDB: database and moving the .frm file to the current database.\n"
"InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
"InnoDB: succeed.\n");
"InnoDB: succeed.\n"
"InnoDB: You can look further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.html\n");
}
trx->error_state = DB_SUCCESS;
@ -1872,7 +1874,9 @@ row_drop_table_for_mysql(
" InnoDB: Error: table %s does not exist in the InnoDB internal\n"
"InnoDB: data dictionary though MySQL is trying to drop it.\n"
"InnoDB: Have you copied the .frm file of the table to the\n"
"InnoDB: MySQL database directory from another database?\n",
"InnoDB: MySQL database directory from another database?\n"
"InnoDB: You can look further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.html\n",
name);
goto funct_exit;
}
@ -2194,7 +2198,9 @@ row_rename_table_for_mysql(
fprintf(stderr,
" InnoDB: Error: table %s exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table %s to it.\n"
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n",
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
"InnoDB: You can look further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.html\n",
new_name, old_name);
fprintf(stderr,

View file

@ -1351,13 +1351,12 @@ mysql_init(MYSQL *mysql)
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
return 0;
mysql->free_me=1;
mysql->net.vio = 0;
}
else
bzero((char*) (mysql),sizeof(*(mysql)));
mysql->options.connect_timeout=CONNECT_TIMEOUT;
mysql->last_used_con = mysql->next_slave = mysql->master = mysql;
mysql->last_used_slave = 0;
/*
By default, we are a replication pivot. The caller must reset it
after we return if this is not the case.

View file

@ -1238,7 +1238,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
USE_WHOLE_KEY);
}
sort_info.dupp++;
if (!(rep_quick & T_FORCE_UNIQUENESS))
if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
{
param->testflag|=T_RETRY_WITHOUT_QUICK;
param->error_printed=1;
@ -3210,7 +3210,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param)
MI_INFO *info=sort_info->info;
DBUG_ENTER("sort_delete_record");
if (!(param->testflag & T_FORCE_UNIQUENESS))
if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
{
mi_check_print_error(param,
"Quick-recover aborted; Run recovery without switch -q or with switch -qq");

View file

@ -186,7 +186,7 @@ static struct my_option my_long_options[] =
(gptr*) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"Try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option if you are not totally desperate.",
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fast", 'F',
"Check only tables that haven't been closed properly.",

View file

@ -0,0 +1,11 @@
drop table if exists t1;
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
insert into t1 values(1, 't1',4,9);
insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
select * from t1;
objid tablename oid test
1 t1 4 9
2 metatable 1 9
3 metaindex 1 9
alter table t1 drop column test;

View file

@ -0,0 +1,6 @@
select * from t1;
objid tablename oid
1 t1 4
2 metatable 1
3 metaindex 1
drop table t1;

View file

@ -1,3 +1,4 @@
drop table if exists t1,t2;
create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");

View file

@ -136,3 +136,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;

View file

@ -92,7 +92,8 @@ NULL NULL NULL
0 0
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
grp count(*)
0 7
NULL 1
0 6
1 6
SELECT DISTINCT FACILITY FROM t1;
FACILITY
@ -379,3 +380,11 @@ test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate
128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1
DROP TABLE IF EXISTS t1,t2;

View file

@ -1,3 +1,4 @@
drop table if exists t1, t2;
CREATE TABLE t1 (
id VARCHAR(255) NOT NULL PRIMARY KEY,
sujet VARCHAR(255),

View file

@ -1,3 +1,4 @@
drop table if exists t1,t2;
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");

View file

@ -1,3 +1,4 @@
drop table if exists t1;
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);

View file

@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
You have an error in your SQL syntax near '' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;

View file

@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
You have an error in your SQL syntax near '' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (t1 char(3) primary key);
insert into t1 values("ABC");
insert into t1 values("ABA");

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1(n int);
insert into t1 values (1);
lock tables t1 write;

View file

@ -100,3 +100,11 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES (1), (2), (3);
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;

View file

@ -1,6 +1,7 @@
select {fn length("hello")}, { date "1997-10-20" };
{fn length("hello")} 1997-10-20
5 1997-10-20
drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;

View file

@ -0,0 +1,7 @@
drop table if exists t1;
create table t1 SELECT 1,"table 1";
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
test.t1 repair status OK
drop table if exists t1;

View file

@ -1718,7 +1718,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
@ -1731,7 +1731,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
@ -1768,7 +1768,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
@ -1781,7 +1781,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
@ -1809,6 +1809,18 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
table type possible_keys key key_len ref rows Extra
t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
t3 ref period period 4 t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
table type possible_keys key key_len ref rows Extra
t3 index period period 4 NULL 41810
t1 ref period period 4 t3.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
table type possible_keys key key_len ref rows Extra
t1 index period period 4 NULL 41810
t3 ref period period 4 t1.period 4181
select period from t1;
period
9410

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (a set (' ','a','b') not null);
show create table t1;
Table Create Table

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (t time);
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");

View file

@ -1,3 +1,4 @@
drop table if exists t1;
CREATE TABLE t1 ( t timestamp);
SET TIMESTAMP=1234;
insert into t1 values(NULL);

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;

View file

@ -7,6 +7,7 @@ select 0x31+1,concat(0x31)+1,-0xf;
select x'31',X'ffff'+0;
x'31' X'ffff'+0
1 65535
drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
@ -15,7 +16,7 @@ table type possible_keys key key_len ref rows Extra
t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
You have an error in your SQL syntax near 'x'hello'' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
select 0xfg;
Unknown column '0xfg' in 'field list'
create table t1 select 1 as x, 2 as xx;

View file

@ -1,3 +1,4 @@
drop table if exists t1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");

View file

@ -0,0 +1,13 @@
#
# Test of problem when shutting down mysqld at once after ALTER TABLE
#
-- source include/have_bdb.inc
drop table if exists t1;
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
insert into t1 values(1, 't1',4,9);
insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
select * from t1;
alter table t1 drop column test;
# Now we do a reboot and continue with the next test

View file

@ -0,0 +1,2 @@
--skip-external-locking

View file

@ -0,0 +1,8 @@
#
# Note that this test uses tables from the previous test
# This is to test that the table t1 survives a reboot of MySQL
# The options in the -master.opt file are just there to force the reboot
#
-- source include/have_bdb.inc
select * from t1;
drop table t1;

View file

@ -2,6 +2,7 @@
# test sort,min and max on binary fields
#
drop table if exists t1,t2;
create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");

View file

@ -91,3 +91,6 @@ show create table t1;
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
drop table if exists t1;

View file

@ -3,6 +3,7 @@
# (Can't be tested with purify :( )
#
drop table if exists t1;
create table t1 (a char(10), tmsp timestamp);
insert into t1 set a = 1;
insert delayed into t1 set a = 2;

View file

@ -242,3 +242,9 @@ SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
drop table t1,t2;
CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
DROP TABLE IF EXISTS t1,t2;

View file

@ -4,6 +4,7 @@
# Test of flush table
#
#drop table if exists t1;
#create table t1 (a int not null auto_increment primary key);
#insert into t1 values(0);
#lock table t1 read;

View file

@ -2,6 +2,7 @@
# Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr>
#
drop table if exists t1, t2;
CREATE TABLE t1 (
id VARCHAR(255) NOT NULL PRIMARY KEY,
sujet VARCHAR(255),

View file

@ -2,6 +2,7 @@
# simple test of all group functions
#
drop table if exists t1,t2;
create table t1 (grp int, a bigint unsigned, c char(10) not null);
insert into t1 values (1,1,"a");
insert into t1 values (2,2,"b");

View file

@ -2,6 +2,7 @@
# test of IN (NULL)
#
drop table if exists t1;
CREATE TABLE t1 (field char(1));
INSERT INTO t1 VALUES ('A'),(NULL);
SELECT * from t1 WHERE field IN (NULL);

View file

@ -2,6 +2,7 @@
# test of primary key conversions
#
drop table if exists t1;
create table t1 (t1 char(3) primary key);
insert into t1 values("ABC");
insert into t1 values("ABA");

View file

@ -6,6 +6,7 @@
#
-- source include/not_embedded.inc
drop table if exists t1;
#test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);

View file

@ -93,3 +93,14 @@ INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ce
REPAIR TABLE t1;
CHECK TABLE t1;
drop table t1;
#
# Test of OPTIMIZE of locked and modified tables
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES (1), (2), (3);
OPTIMIZE TABLE t1;
DROP TABLE t1;

View file

@ -8,6 +8,7 @@ select {fn length("hello")}, { date "1997-10-20" };
# Test retreiving row with last insert_id value.
#
drop table if exists t1;
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
insert into t1 SET A=NULL,B=1;
insert into t1 SET a=null,b=2;

8
mysql-test/t/repair.test Normal file
View file

@ -0,0 +1,8 @@
#
# Test of repair table
#
drop table if exists t1;
create table t1 SELECT 1,"table 1";
repair table t1 use_frm;
drop table if exists t1;

View file

@ -1405,9 +1405,9 @@ drop table tmp;
# big table done
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
@ -1416,9 +1416,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET OPTION SQL_BIG_TABLES=1; # Force use of MyISAM
SET SQL_BIG_TABLES=1; # Force use of MyISAM
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
@ -1439,6 +1439,14 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
#
# Some test with ORDER BY and limit
#
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
#
# Search with a constant table.
#

View file

@ -1,6 +1,7 @@
#
# Test of truncate
#
drop table if exists t1;
create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1;

View file

@ -2,6 +2,7 @@
# Test of SET with space
#
drop table if exists t1;
create table t1 (a set (' ','a','b') not null);
show create table t1;
drop table t1;

View file

@ -1,6 +1,7 @@
#
# testing of the TIME column type
#
drop table if exists t1;
create table t1 (t time);
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");

View file

@ -2,6 +2,7 @@
# Test timestamp
#
drop table if exists t1;
CREATE TABLE t1 ( t timestamp);
SET TIMESTAMP=1234;
insert into t1 values(NULL);

View file

@ -1,7 +1,7 @@
#
# Test year
#
drop table if exists t1;
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
select * from t1;

View file

@ -10,6 +10,7 @@ select x'31',X'ffff'+0;
# Test of hex constants in WHERE:
#
drop table if exists t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;

View file

@ -1,7 +1,7 @@
#
# Test some warnings
#
drop table if exists t1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");

View file

@ -20,6 +20,7 @@
/* TODO list for the InnoDB handler:
- Ask Monty if strings of different languages can exist in the same
database. Answer: in 4.1 yes.
*/
#ifdef __GNUC__
@ -404,8 +405,6 @@ ha_innobase::update_thd(
return(0);
}
/* The code here appears for documentational purposes only. Not used
or tested yet. Will be used in 4.1. */
/*********************************************************************
Call this when you have opened a new table handle in HANDLER, before you
call index_read_idx() etc. Actually, we can let the cursor stay open even
@ -666,20 +665,20 @@ innobase_commit_low(
/*================*/
trx_t* trx) /* in: transaction handle */
{
if (current_thd->slave_thread)
{
/* Update the replication position info inside InnoDB */
if (current_thd->slave_thread) {
/* Update the replication position info inside InnoDB */
#ifdef NEED_TO_BE_FIXED
trx->mysql_relay_log_file_name= active_mi->rli.log_file_name;
trx->mysql_relay_log_pos= active_mi->rli.relay_log_pos;
trx->mysql_relay_log_file_name = active_mi->rli.log_file_name;
trx->mysql_relay_log_pos = active_mi->rli.relay_log_pos;
#endif
trx->mysql_master_log_file_name= active_mi->rli.master_log_name;
trx->mysql_master_log_pos= ((ib_longlong)
trx->mysql_master_log_file_name
= active_mi->rli.master_log_name;
trx->mysql_master_log_pos = ((ib_longlong)
(active_mi->rli.master_log_pos +
active_mi->rli.event_len +
active_mi->rli.pending));
}
trx_commit_for_mysql(trx);
}
trx_commit_for_mysql(trx);
}
/*********************************************************************
@ -691,7 +690,8 @@ innobase_commit(
/* out: 0 or error number */
THD* thd, /* in: MySQL thread handle of the user for whom
the transaction should be committed */
void* trx_handle)/* in: InnoDB trx handle or NULL: NULL means
void* trx_handle)/* in: InnoDB trx handle or
&innodb_dummy_stmt_trx_handle: the latter means
that the current SQL statement ended, and we should
mark the start of a new statement with a savepoint */
{
@ -715,6 +715,7 @@ innobase_commit(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
innobase_commit_low(trx);
thd->transaction.all.innodb_active_trans=0;
}
/* Release possible statement level resources */
@ -771,7 +772,9 @@ innobase_rollback(
/* out: 0 or error number */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
void* trx_handle)/* in: InnoDB trx handle or a dummy stmt handle */
void* trx_handle)/* in: InnoDB trx handle or a dummy stmt handle;
the latter means we roll back the latest SQL
statement */
{
int error = 0;
trx_t* trx;
@ -795,6 +798,7 @@ innobase_rollback(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
error = trx_rollback_for_mysql(trx);
thd->transaction.all.innodb_active_trans=0;
} else {
error = trx_rollback_last_sql_stat_for_mysql(trx);
}
@ -975,7 +979,9 @@ Cannot find table %s from the internal data dictionary\n\
of InnoDB though the .frm file for the table exists. Maybe you\n\
have deleted and recreated InnoDB data files but have forgotten\n\
to delete the corresponding .frm files of InnoDB tables, or you\n\
have moved .frm files to another database?",
have moved .frm files to another database?\n\
Look from section 15.1 of http://www.innodb.com/ibman.html\n\
how you can resolve the problem.\n",
norm_name);
free_share(share);
@ -1187,11 +1193,11 @@ innobase_mysql_cmp(
ret = my_sortncmp((const char*) a, a_length,
(const char*) b, b_length);
if (ret < 0) {
return(-1);
return(-1);
} else if (ret > 0) {
return(1);
return(1);
} else {
return(0);
return(0);
}
default:
assert(0);
@ -1494,6 +1500,8 @@ ha_innobase::write_row(
int error;
longlong auto_inc;
longlong dummy;
ibool incremented_auto_inc_for_stat = FALSE;
ibool incremented_auto_inc_counter = FALSE;
DBUG_ENTER("ha_innobase::write_row");
@ -1564,6 +1572,7 @@ ha_innobase::write_row(
assign sequential values from the counter. */
auto_inc_counter_for_this_stat++;
incremented_auto_inc_for_stat = TRUE;
auto_inc = auto_inc_counter_for_this_stat;
@ -1612,7 +1621,12 @@ ha_innobase::write_row(
}
}
/* The following call gets the value of the auto-inc
counter of the table and increments it by 1 */
auto_inc = dict_table_autoinc_get(prebuilt->table);
incremented_auto_inc_counter = TRUE;
srv_conc_exit_innodb(prebuilt->trx);
/* We can give the new value for MySQL to place in
@ -1649,6 +1663,20 @@ ha_innobase::write_row(
srv_conc_exit_innodb(prebuilt->trx);
if (error != DB_SUCCESS) {
/* If the insert did not succeed we restore the value of
the auto-inc counter we used; note that this behavior was
introduced only in version 4.0.4 */
if (incremented_auto_inc_counter) {
dict_autoinc_decrement(prebuilt->table);
}
if (incremented_auto_inc_for_stat) {
auto_inc_counter_for_this_stat--;
}
}
prebuilt->trx->ignore_duplicates_in_insert = FALSE;
error = convert_error_code_to_mysql(error, user_thd);
@ -3308,7 +3336,7 @@ ha_innobase::update_table_comment(
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
uint length = strlen(comment);
char* str = my_malloc(length + 550, MYF(0));
char* str = my_malloc(length + 16500, MYF(0));
char* pos;
/* Warning: since it is not sure that MySQL calls external_lock
@ -3330,10 +3358,12 @@ ha_innobase::update_table_comment(
(pos,"InnoDB free: %lu kB",
(ulong) innobase_get_free_space()));
/* We assume 450 - length bytes of space to print info */
/* We assume 16000 - length bytes of space to print info; the limit
16000 bytes is arbitrary, and MySQL could handle at least 64000
bytes */
if (length < 450) {
dict_print_info_on_foreign_keys(FALSE, pos, 450 - length,
if (length < 16000) {
dict_print_info_on_foreign_keys(FALSE, pos, 16000 - length,
prebuilt->table);
}
@ -3505,7 +3535,6 @@ ha_innobase::external_lock(
& (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
innobase_commit(thd, trx);
thd->transaction.all.innodb_active_trans=0;
}
}
}

View file

@ -566,11 +566,12 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
}
if (!optimize ||
memcmp(file->state, & share->state.state, sizeof(MI_STATUS_INFO)) ||
((file->state->del || share->state.split != file->state->records) &&
(!(param.testflag & T_QUICK) ||
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
((ulonglong) 1L << share->base.keys)-1 :
share->state.key_map);
uint testflag=param.testflag;

View file

@ -1120,6 +1120,8 @@ Item_cond::fix_fields(THD *thd,TABLE_LIST *tables)
used_tables_cache|=item->used_tables();
with_sum_func= with_sum_func || item->with_sum_func;
const_item_cache&=item->const_item();
if (item->maybe_null)
maybe_null=1;
}
if (thd)
thd->cond_count+=list.elements;

View file

@ -173,7 +173,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
if (!t_arg)
return result_field;
switch (args[0]->result_type()) {
switch (result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,

View file

@ -1325,6 +1325,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
end=strxmov(buff, "# administrator command: ",
command_name[thd->command], NullS);
query_length=(ulong) (end-buff);
query=buff;
}
if (my_b_write(&log_file, (byte*) query,query_length) ||
my_b_write(&log_file, (byte*) ";\n",2) ||

View file

@ -524,6 +524,7 @@ bool rm_temporary_table(enum db_type base, char *path);
bool send_fields(THD *thd,List<Item> &item,uint send_field_count);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_thread_tables(THD *thd,bool locked=0);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_temporary_tables(THD *thd);

View file

@ -377,11 +377,10 @@ char mysql_real_data_home[FN_REFLEN],
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
*opt_init_file;
char *language_ptr= language;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
#ifndef EMBEDDED_LIBRARY
char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff;
bool mysql_embedded=0;
#else
char *mysql_data_home=mysql_real_data_home;
bool mysql_embedded=1;
#endif
@ -1959,6 +1958,7 @@ int main(int argc, char **argv)
{
unireg_abort(1); /* purecov: inspected */
}
mysql_data_home= mysql_data_home_buff;
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;
server_init();
@ -3004,10 +3004,10 @@ struct my_option my_long_options[] =
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
"Don't flush key buffers between writes for any MyISAM table (Depricated option, use --delay-key-write=all instead)",
"Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"enable-locking", OPT_ENABLE_LOCK,
"Depricated option, use --external-locking instead",
"Deprecated option, use --external-locking instead",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
@ -3244,7 +3244,7 @@ struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
"Depricated option; One should use GRANT SHOW DATABASES instead...",
"Deprecated option; One should use GRANT SHOW DATABASES instead...",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
@ -3274,8 +3274,11 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK,
"Depricated option, use --skip-external-locking instead",
"Deprecated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-external-locking", OPT_SKIP_LOCK, "Do not use system (external) locking",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-name-resolve", OPT_SKIP_RESOLVE,
@ -3403,7 +3406,7 @@ struct my_option my_long_options[] =
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
REQUIRED_ARG, 4, 2, HA_FT_MAXLEN, 0, 1, 0},
REQUIRED_ARG, 4, 1, HA_FT_MAXLEN, 0, 1, 0},
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN,
"The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG,

View file

@ -150,7 +150,7 @@
"Table '%-.64s.%-.64s' doesn't exist",
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'",
"The used command is not allowed with this MySQL version",
"You have an error in your SQL syntax",
"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",
"Delayed insert thread couldn't get requested lock for table %-.64s",
"Too many delayed threads in use",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)",

View file

@ -157,7 +157,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
table_list.db= (char*) entry->table_cache_key;
table_list.real_name= entry->real_name;
table_list.grant.privilege=0;
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list))
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
continue;
/* need to check if we haven't already listed it */
@ -1777,9 +1777,12 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name[0] == '*')
{
uint elem=fields.elements;
if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name,&it))
DBUG_RETURN(-1); /* purecov: inspected */
if (sum_func_list)
sum_func_list->elements += fields.elements - elem;
}
else
{

View file

@ -356,6 +356,18 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
}
#ifdef SIGNAL_WITH_VIO_CLOSE
void THD::close_active_vio()
{
safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
}
#endif
/*****************************************************************************
** Functions to provide a interface to select results
*****************************************************************************/

View file

@ -475,15 +475,6 @@ public:
active_vio = 0;
pthread_mutex_unlock(&LOCK_delete);
}
inline void close_active_vio()
{
safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
}
#endif
void awake(bool prepare_to_die);
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex,

View file

@ -1937,14 +1937,10 @@ mysql_execute_command(void)
goto error;
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
/* TRUNCATE ends previous transaction */
if (lex->sql_command == SQLCOM_TRUNCATE && end_active_trans(thd))
res= -1;
else
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, lex->lock_option,
select_lex->options);
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, lex->lock_option,
select_lex->options);
break;
}
case SQLCOM_DELETE_MULTI:

View file

@ -620,8 +620,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
(join.const_tables == join.tables ||
(simple_order &&
test_if_skip_sort_order(&join.join_tab[join.const_tables], order,
(join.const_tables != join.tables - 1 ||
(join.select_options & OPTION_FOUND_ROWS)) ?
(join.select_options & OPTION_FOUND_ROWS) ?
HA_POS_ERROR : thd->select_limit,0))))
order=0;
select_describe(&join,need_tmp,
@ -640,8 +639,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
DBUG_PRINT("info",("Creating tmp table"));
thd->proc_info="Creating tmp table";
join.tmp_table_param.hidden_field_count=(all_fields.elements-
fields.elements);
join.tmp_table_param.hidden_field_count= all_fields.elements- fields.elements;
if (!(tmp_table =
create_tmp_table(thd,&join.tmp_table_param,all_fields,
((!simple_group && !procedure &&
@ -876,7 +874,6 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if (create_sort_index(&join.join_tab[join.const_tables],
group ? group : order,
(having || group ||
join.const_tables != join.tables - 1 ||
(join.select_options & OPTION_FOUND_ROWS)) ?
HA_POS_ERROR : thd->select_limit))
goto err; /* purecov: inspected */
@ -2018,7 +2015,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
join->positions[idx].key=best_key;
join->positions[idx].table= s;
if (!best_key && idx == join->const_tables &&
s->table == join->sort_by_table)
s->table == join->sort_by_table &&
join->thd->select_limit >= records)
join->sort_by_table= (TABLE*) 1; // Must use temporary table
/*

View file

@ -19,6 +19,9 @@
#include "mysql_priv.h"
#include <hash.h>
#ifdef HAVE_BERKELEY_DB
#include <ha_berkeley.h>
#endif
#include <myisam.h>
#include <assert.h>
@ -258,10 +261,32 @@ static int sort_keys(KEY *a, KEY *b)
}
/*****************************************************************************
* Create a table.
* If one creates a temporary table, this is automaticly opened
****************************************************************************/
/*
Create a table
SYNOPSIS
mysql_create_table()
thd Thread object
db Database
table_name Table name
create_info Create information (like MAX_ROWS)
fields List of fields to create
keys List of keys to create
tmp_table Set to 1 if this is a temporary table
no_log Don't log the query to binary log.
DESCRIPTION
If one creates a temporary table, this is automaticly opened
no_log is needed for the case of CREATE ... SELECT,
as the logging will be done later in sql_insert.cc
select_field_count is also used for CREATE ... SELECT,
and must be zero for standard create of table.
RETURN VALUES
0 ok
-1 error
*/
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
@ -972,7 +997,9 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
fn_format(from, from, "", MI_NAME_DEXT, 4);
sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);
pthread_mutex_lock(&LOCK_open);
close_cached_table(thd,table->table);
pthread_mutex_unlock(&LOCK_open);
if (lock_and_wait_for_table_name(thd,table))
DBUG_RETURN(-1);
@ -1871,11 +1898,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_cond_broadcast(&COND_refresh));
goto err;
}
#ifdef HAVE_BERKELEY_DB
extern bool berkeley_flush_logs(void);
if (old_db_type == DB_TYPE_BERKELEY_DB && berkeley_flush_logs())
goto err;
#endif
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
@ -1885,6 +1907,21 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
VOID(pthread_cond_broadcast(&COND_refresh));
VOID(pthread_mutex_unlock(&LOCK_open));
#ifdef HAVE_BERKELEY_DB
if (old_db_type == DB_TYPE_BERKELEY_DB)
{
(void) berkeley_flush_logs();
/*
For the alter table to be properly flushed to the logs, we
have to open the new table. If not, we get a problem on server
shutdown.
*/
if (!open_tables(thd, table_list)) // Should always succeed
{
close_thread_table(thd, &table_list->table);
}
}
#endif
table_list->table=0; // For query cache
query_cache_invalidate3(thd, table_list, 0);