summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/compile-dist47
-rwxr-xr-xBuild-tools/Bootstrap49
-rwxr-xr-xBuild-tools/Do-pkg2
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_sys.h1
-rw-r--r--innobase/os/os0file.c24
-rw-r--r--mysql-test/r/alter_table.result2
-rw-r--r--mysql-test/r/grant.result2
-rw-r--r--mysql-test/r/grant_cache.result6
-rw-r--r--mysys/mf_iocache.c49
-rw-r--r--mysys/my_write.c3
-rw-r--r--scripts/mysql_install_db.sh4
-rw-r--r--scripts/mysqlaccess.sh39
-rw-r--r--sql/filesort.cc5
-rw-r--r--sql/ha_innodb.cc11
-rw-r--r--sql/mysqld.cc1
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sql_acl.cc100
-rw-r--r--sql/sql_parse.cc2
20 files changed, 218 insertions, 135 deletions
diff --git a/BUILD/compile-dist b/BUILD/compile-dist
new file mode 100755
index 00000000000..ef6302f0d9c
--- /dev/null
+++ b/BUILD/compile-dist
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# This script's purpose is to update the automake/autoconf helper scripts and
+# to run a plain "configure" without any special compile flags. Only features
+# that affect the content of the source distribution are enabled. The resulting
+# tree can then be picked up by "make dist" to create the "pristine source
+# package" that is used as the basis for all other binary builds.
+#
+make distclean
+aclocal
+autoheader
+libtoolize --automake --force --copy
+automake --force --add-missing --copy
+autoconf
+(cd bdb/dist && sh s_all)
+(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
+
+# Default to gcc for CC and CXX
+if test -z "$CXX" ; then
+ export CXX=gcc
+fi
+
+if test -z "$CC" ; then
+ export CC=gcc
+fi
+
+# Use ccache, if available
+if ccache -V > /dev/null 2>&1
+then
+ if ! (echo "$CC" | grep "ccache" > /dev/null)
+ then
+ export CC="ccache $CC"
+ fi
+ if ! (echo "$CXX" | grep "ccache" > /dev/null)
+ then
+ export CXX="ccache $CXX"
+ fi
+fi
+
+# Make sure to enable all features that affect "make dist"
+./configure \
+ --with-embedded-server \
+ --with-berkeley-db \
+ --with-innodb \
+ --enable-thread-safe-client \
+ --with-extra-charsets=complex
+make
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index a7d347ba32f..10ebc5c2dd1 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -26,7 +26,7 @@ else
}
# Some predefined settings
-$build_command= "BUILD/compile-pentium-max";
+$build_command= "BUILD/compile-dist";
$PWD= cwd();
$opt_docdir= $PWD . "/mysqldoc";
$opt_archive_log= undef;
@@ -38,7 +38,7 @@ $opt_dry_run= undef;
$opt_export_only= undef;
$opt_help= $opt_verbose= 0;
$opt_log= undef;
-$opt_mail= "";
+$opt_mail= "build\@mysql.com";
$opt_pull= undef;
$opt_revision= undef;
$opt_suffix= "";
@@ -70,7 +70,7 @@ GetOptions(
"test|t",
"verbose|v",
"win-dist|w",
- "quiet|q",
+ "quiet|q",
) || print_help("");
#
@@ -122,18 +122,8 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
#
if ($opt_pull)
{
- &logger("Updating BK tree $REPO to latest ChangeSet first");
- chdir ($REPO) or &abort("Could not chdir to $REPO!");
- &run_command("bk pull", "Could not update $REPO!");
- chdir ($PWD) or &abort("Could not chdir to $PWD!");
-
- unless ($opt_skip_manual)
- {
- &logger("Updating manual tree in $opt_docdir");
- chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!");
- &run_command("bk pull", "Could not update $opt_docdir!");
- chdir ($PWD) or &abort("Could not chdir to $PWD!");
- }
+ &bk_pull("$REPO");
+ &bk_pull("$opt_docdir") unless ($opt_skip_manual);
}
#
@@ -262,7 +252,7 @@ if (defined $opt_changelog)
$msg= "Adding $target_dir/ChangeLog";
$msg.= " (down to revision $opt_changelog)" if $opt_changelog ne "";
&logger($msg);
- $command= "bk changes -mv";
+ $command= "bk changes -v";
$command.= " -r" if ($opt_changelog ne "" || $opt_revision);
$command.= $opt_changelog if $opt_changelog ne "";
$command.= ".." if ($opt_changelog ne "" && !$opt_revision);
@@ -270,7 +260,7 @@ if (defined $opt_changelog)
$command.= " " . $REPO . " > $target_dir/ChangeLog";
&logger($command);
# We cannot use run_command here because of output redirection
- if (!$opt_dry_run)
+ unless ($opt_dry_run)
{
system($command) == 0 or &abort("Could not create $target_dir/ChangeLog!");
}
@@ -281,17 +271,17 @@ if (defined $opt_changelog)
#
unless ($opt_skip_manual)
{
- $msg= "Updating manual files";
- &logger($msg);
+ &logger("Updating manual files");
foreach $file qw/internals manual reservedwords/
{
system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0
or &abort("Could not update $file.texi in $target_dir/Docs/!");
}
- system ("rm -f $target_dir/Docs/Images/Makefile*") == 0
- or &abort("Could not remove Makefiles in $target_dir/Docs/Images/!");
- system ("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images") == 0
- or &abort("Could not copy image files in $target_dir/Docs/Images/!");
+
+ &run_command("rm -f $target_dir/Docs/Images/Makefile*",
+ "Could not remove Makefiles in $target_dir/Docs/Images/!");
+ &run_command("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images",
+ "Could not copy image files in $target_dir/Docs/Images/!");
}
#
@@ -378,6 +368,18 @@ if ($opt_archive_log)
exit 0;
#
+# Run a BK pull on the given BK tree
+#
+sub bk_pull
+{
+ my $bk_tree= $_[0];
+ &logger("Updating BK tree $bk_tree to latest ChangeSet first");
+ chdir ($bk_tree) or &abort("Could not chdir to $bk_tree!");
+ &run_command("bk pull", "Could not update $bk_tree!");
+ chdir ($PWD) or &abort("Could not chdir to $PWD!");
+}
+
+#
# Print the help text message (with an optional message on top)
#
sub print_help
@@ -429,6 +431,7 @@ Options:
include a log file snippet, if logging is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
+ Default: build\@mysql.com
-q, --quiet Be quiet
-p, --pull Update the source BK trees before building
-r, --revision=<rev> Export the tree as of revision <rev>
diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg
index 2fd1946ed0e..04d7ba021e5 100755
--- a/Build-tools/Do-pkg
+++ b/Build-tools/Do-pkg
@@ -84,7 +84,7 @@ $LOGFILE= "$PWD/Logs/$HOST-$MAJOR.$MINOR$SUFFIX.log";
$BUILDDIR= "$PWD/$HOST";
$SRCBASEDIR= <$BUILDDIR/mysql*-$VERSION>;
$SUPFILEDIR= <$SRCBASEDIR/support-files/MacOSX>;
-$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc.tar.gz>;
+$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc*.tar.gz>;
$TAR =~ /.*\/$NAME(.*)\.tar\.gz$/;
$ARCH= $1;
$NAME= $NAME . $ARCH;
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 40302f48bd5..7620b46e08b 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -624,6 +624,7 @@ extern int pthread_dummy(int);
/* All thread specific variables are in the following struct */
#define THREAD_NAME_SIZE 10
+#ifndef DEFAULT_THREAD_STACK
#if defined(__ia64__)
/*
MySQL can survive with 32K, but some glibc libraries require > 128K stack
@@ -633,6 +634,7 @@ extern int pthread_dummy(int);
#else
#define DEFAULT_THREAD_STACK (192*1024L)
#endif
+#endif
struct st_my_thread_var
{
diff --git a/include/my_sys.h b/include/my_sys.h
index 9e43889d0e0..0fdb8d640e7 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -671,6 +671,7 @@ extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
my_off_t seek_offset,pbool use_async_io,
pbool clear_cache);
+extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index b8339134fb1..cadf1c0385f 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -375,7 +375,7 @@ os_io_init_simple(void)
}
}
-#ifndef UNIV_HOTBACKUP
+#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
/*************************************************************************
Creates a temporary file. This function is defined in ha_innodb.cc. */
@@ -383,7 +383,7 @@ int
innobase_mysql_tmpfile(void);
/*========================*/
/* out: temporary file descriptor, or < 0 on error */
-#endif /* !UNIV_HOTBACKUP */
+#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
/***************************************************************************
Creates a temporary file. */
@@ -393,9 +393,12 @@ os_file_create_tmpfile(void)
/*========================*/
/* out: temporary file handle, or NULL on error */
{
+#ifdef __NETWARE__
+ FILE* file = tmpfile();
+#else /* __NETWARE__ */
FILE* file = NULL;
int fd = -1;
-#ifdef UNIV_HOTBACKUP
+# ifdef UNIV_HOTBACKUP
int tries;
for (tries = 10; tries--; ) {
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
@@ -404,15 +407,15 @@ os_file_create_tmpfile(void)
}
fd = open(name,
-# ifdef __WIN__
+# ifdef __WIN__
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
-# endif /* __WIN__ */
+# endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
S_IREAD | S_IWRITE);
if (fd >= 0) {
-# ifndef __WIN__
+# ifndef __WIN__
unlink(name);
-# endif /* !__WIN__ */
+# endif /* !__WIN__ */
free(name);
break;
}
@@ -423,22 +426,25 @@ os_file_create_tmpfile(void)
name);
free(name);
}
-#else /* UNIV_HOTBACKUP */
+# else /* UNIV_HOTBACKUP */
fd = innobase_mysql_tmpfile();
-#endif /* UNIV_HOTBACKUP */
+# endif /* UNIV_HOTBACKUP */
if (fd >= 0) {
file = fdopen(fd, "w+b");
}
+#endif /* __NETWARE__ */
if (!file) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: unable to create temporary file;"
" errno: %d\n", errno);
+#ifndef __NETWARE__
if (fd >= 0) {
close(fd);
}
+#endif /* !__NETWARE__ */
}
return(file);
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index e7a8d2c7cdf..78925a64e93 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -121,7 +121,7 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
-insert command denied to user: 'mysqltest_1@localhost' for table 't2'
+INSERT,CREATE command denied to user: 'mysqltest_1@localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 19d83a95c5e..9df50a242d7 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -198,7 +198,7 @@ GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
UPDATE command denied to user: 'mysqltest_3@localhost' for column 'q' in table 't1'
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
-select command denied to user: 'mysqltest_3@localhost' for table 't1'
+SELECT command denied to user: 'mysqltest_3@localhost' for table 't1'
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
UPDATE command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 96eb9d2bc62..e31294154bb 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -121,7 +121,7 @@ a b c a
1 1 1 test.t1
2 2 2 test.t1
select * from t2;
-select command denied to user: 'mysqltest_2@localhost' for table 't2'
+SELECT command denied to user: 'mysqltest_2@localhost' for table 't2'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -135,7 +135,7 @@ select "user3";
user3
user3
select * from t1;
-select command denied to user: 'mysqltest_3@localhost' for column 'b' in table 't1'
+SELECT command denied to user: 'mysqltest_3@localhost' for column 'b' in table 't1'
select a from t1;
a
1
@@ -143,7 +143,7 @@ a
select c from t1;
SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
select * from t2;
-select command denied to user: 'mysqltest_3@localhost' for table 't2'
+SELECT command denied to user: 'mysqltest_3@localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1;
SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache";
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 8fb93dc4780..a7937da0cc2 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -71,9 +71,40 @@ static void my_aiowait(my_aio_result *result);
#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1))
+
+/*
+ Setup internal pointers inside IO_CACHE
+
+ SYNOPSIS
+ setup_io_cache()
+ info IO_CACHE handler
+
+ NOTES
+ This is called on automaticly on init or reinit of IO_CACHE
+ It must be called externally if one moves or copies an IO_CACHE
+ object.
+*/
+
+void setup_io_cache(IO_CACHE* info)
+{
+ /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
+ if (info->type == WRITE_CACHE)
+ {
+ info->current_pos= &info->write_pos;
+ info->current_end= &info->write_end;
+ }
+ else
+ {
+ info->current_pos= &info->read_pos;
+ info->current_end= &info->read_end;
+ }
+}
+
+
static void
-init_functions(IO_CACHE* info, enum cache_type type)
+init_functions(IO_CACHE* info)
{
+ enum cache_type type= info->type;
switch (type) {
case READ_NET:
/*
@@ -97,17 +128,7 @@ init_functions(IO_CACHE* info, enum cache_type type)
info->write_function = _my_b_write;
}
- /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
- if (type == WRITE_CACHE)
- {
- info->current_pos= &info->write_pos;
- info->current_end= &info->write_end;
- }
- else
- {
- info->current_pos= &info->read_pos;
- info->current_end= &info->read_end;
- }
+ setup_io_cache(info);
}
/*
@@ -211,7 +232,7 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
/* End_of_file may be changed by user later */
info->end_of_file= end_of_file;
info->error=0;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io)
{
@@ -333,7 +354,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
}
info->type=type;
info->error=0;
- init_functions(info,type);
+ init_functions(info);
#ifdef HAVE_AIOWAIT
if (use_async_io && ! my_disable_async_io &&
diff --git a/mysys/my_write.c b/mysys/my_write.c
index da378d115f1..1d1a893090a 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -49,8 +49,7 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
#endif
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
- (MyFlags & MY_WAIT_IF_FULL) &&
- (uint) writenbytes != (uint) -1)
+ (MyFlags & MY_WAIT_IF_FULL))
{
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index f9f3160d220..8d47d67792a 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -98,9 +98,9 @@ else
if test -x "$basedir/libexec/mysqld"
then
execdir="$basedir/libexec"
-elif test -x "@libexecdir@/mysqld"
+elif test -x "$basedir/sbin/mysqld"
then
- execdir="@libexecdir@"
+ execdir="$basedir/sbin"
else
execdir="$basedir/bin"
fi
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index 75ef63ecdd0..b71f6847baf 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -2,7 +2,7 @@
# ****************************
package MySQLaccess;
#use strict;
-use POSIX qw(tmpnam);
+use File::Temp qw(tempfile tmpnam);
use Fcntl;
BEGIN {
@@ -32,7 +32,6 @@ BEGIN {
$ACCESS_U_BCK = 'user_backup';
$ACCESS_D_BCK = 'db_backup';
$DIFF = '/usr/bin/diff';
- $TMP_PATH = '/tmp'; #path to writable tmp-directory
$MYSQLDUMP = '@bindir@/mysqldump';
#path to mysqldump executable
@@ -432,7 +431,7 @@ use IPC::Open3;
# no caching on STDOUT
$|=1;
- $MYSQL_CNF = POSIX::tmpnam();
+ $MYSQL_CNF = tmpnam();
%MYSQL_CNF = (client => { },
mysql => { },
mysqldump => { },
@@ -577,8 +576,6 @@ if (!defined($Param{'host'})) { $Param{'host'}='localhost'; }
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL);
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF);
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
-push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH);
-push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH);
if (@MySQLaccess::Grant::Error) {
MySQLaccess::Report::Print_Error_Messages() ;
exit 0;
@@ -1777,17 +1774,15 @@ sub Diff_Privileges {
@before = sort(@before);
@after = sort(@after);
- $before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$";
- $after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$";
- #$after = "/tmp/t0";
- open(BEFORE,"> $before") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing");
- open(AFTER,"> $after") ||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing");
- print BEFORE join("\n",@before);
- print AFTER join("\n",@after);
- close(BEFORE);
- close(AFTER);
+ ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+ ($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
+
+ print $hb join("\n",@before);
+ print $ha join("\n",@after);
+ close $hb;
+ close $ha;
# ----------------------------------
# compute difference
@@ -1800,8 +1795,8 @@ sub Diff_Privileges {
# ----------------------------------
# cleanup temp. files
- unlink(BEFORE);
- unlink(AFTER);
+ unlink($before);
+ unlink($after);
return \@diffs;
}
@@ -2316,14 +2311,6 @@ BEGIN {
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n"
."+ Check your path, or\n"
."+ edit the source of this script to point \$DIFF to the diff program.\n"
- ,'not_found_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n"
- ."+ create this directory (writeable!), or\n"
- ."+ edit the source of this script to point \$TMP_PATH to the right directory.\n"
- ,'write_err_tmp'
- => "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n"
- ."+ make this directory writeable!, or\n"
- ."+ edit the source of this script to point \$TMP_PATH to another directory.\n"
,'Unrecognized_option'
=> "Sorry,\n"
."You are using an old version of the mysql-program,\n"
diff --git a/sql/filesort.cc b/sql/filesort.cc
index ae6895b26b9..a53067ccd73 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -680,11 +680,16 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
+ setup_io_cache(from_file);
+ setup_io_cache(to_file);
*maxbuffer= (uint) (lastbuff-buffpek)-1;
}
close_cached_file(to_file); // This holds old result
if (to_file == t_file)
+ {
*t_file=t_file2; // Copy result file
+ setup_io_cache(t_file);
+ }
DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */
} /* merge_many_buff */
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 69d9d885b8e..2e441b4f085 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -413,6 +413,7 @@ innobase_mysql_print_thd(
putc('\n', f);
}
+#ifndef __NETWARE__
/*************************************************************************
Creates a temporary file. */
extern "C"
@@ -456,6 +457,7 @@ innobase_mysql_tmpfile(void)
}
return(fd2);
}
+#endif /* !__NETWARE__ */
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
@@ -4925,7 +4927,9 @@ ha_innobase::store_lock(
if ((lock_type == TL_READ && thd->in_lock_tables) ||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
- lock_type == TL_READ_NO_INSERT) {
+ lock_type == TL_READ_NO_INSERT ||
+ thd->lex.sql_command != SQLCOM_SELECT) {
+
/* The OR cases above are in this order:
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
@@ -4933,7 +4937,10 @@ ha_innobase::store_lock(
4) we are doing a complex SQL statement like
INSERT INTO ... SELECT ... and the logical logging (MySQL
binlog) requires the use of a locking read, or
- MySQL is doing LOCK TABLES ... READ. */
+ MySQL is doing LOCK TABLES ... READ.
+ 5) we let InnoDB do locking reads for all SQL statements that
+ are not simple SELECTs; note that select_lock_type in this
+ case may get strengthened in ::external_lock() to LOCK_X. */
prebuilt->select_lock_type = LOCK_S;
prebuilt->stored_select_lock_type = LOCK_S;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index eae63c5deb3..c6ec942d0d9 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4487,6 +4487,7 @@ struct show_var_st status_vars[]= {
{"Com_truncate", (char*) (com_stat+(uint) SQLCOM_TRUNCATE),SHOW_LONG},
{"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG},
{"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG},
+ {"Com_update_multi", (char*) (com_stat+(uint) SQLCOM_MULTI_UPDATE),SHOW_LONG},
{"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG},
{"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG},
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index e5cb4d1e815..cad1f041005 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -227,6 +227,8 @@ int
my_net_write(NET *net,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE];
+ if (unlikely(!net->vio)) // nowhere to write
+ return 0;
/*
Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH
length. The last packet is always a packet that is < MAX_PACKET_LENGTH.
diff --git a/sql/set_var.cc b/sql/set_var.cc
index d5aadbfbdab..122daa0ea95 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -593,6 +593,8 @@ struct show_var_st init_vars[]= {
{sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
{sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
{sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
+ {sys_query_cache_wlock_invalidate.name,
+ (char*) &sys_query_cache_wlock_invalidate, SHOW_SYS},
#endif /* HAVE_QUERY_CACHE */
{sys_query_prealloc_size.name, (char*) &sys_query_prealloc_size, SHOW_SYS},
{sys_range_alloc_block_size.name, (char*) &sys_range_alloc_block_size,
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 1b55168695b..c883407970a 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2134,37 +2134,57 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(-1);
}
- if (columns.elements && !revoke_grant)
+ if (!revoke_grant)
{
- TABLE *table;
- class LEX_COLUMN *column;
- List_iterator <LEX_COLUMN> column_iter(columns);
-
- if (!(table=open_ltable(thd,table_list,TL_READ)))
- DBUG_RETURN(-1);
- while ((column = column_iter++))
+ if (columns.elements && !revoke_grant)
{
- if (!find_field_in_table(thd,table,column->column.ptr(),
- column->column.length(),0,0))
+ TABLE *table;
+ class LEX_COLUMN *column;
+ List_iterator <LEX_COLUMN> column_iter(columns);
+
+ if (!(table=open_ltable(thd,table_list,TL_READ)))
+ DBUG_RETURN(-1);
+ while ((column = column_iter++))
{
- my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
- column->column.c_ptr(), table_list->alias);
- DBUG_RETURN(-1);
+ Field *f= find_field_in_table(thd,table,column->column.ptr(),
+ column->column.length(),1,0);
+ if (!f)
+ {
+ my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
+ column->column.c_ptr(), table_list->alias);
+ DBUG_RETURN(-1);
+ }
+ if (f == (Field*)-1)
+ {
+ DBUG_RETURN(-1);
+ }
+ column_priv|= column->rights;
}
- column_priv|= column->rights;
+ close_thread_tables(thd);
}
- close_thread_tables(thd);
- }
- else if (!(rights & CREATE_ACL) && !revoke_grant)
- {
- char buf[FN_REFLEN];
- sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db,
- table_list->real_name);
- fn_format(buf,buf,"","",4+16+32);
- if (access(buf,F_OK))
+ else
{
- my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db, table_list->alias);
- DBUG_RETURN(-1);
+ if (!(rights & CREATE_ACL))
+ {
+ char buf[FN_REFLEN];
+ sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db,
+ table_list->real_name);
+ fn_format(buf,buf,"","",4+16+32);
+ if (access(buf,F_OK))
+ {
+ my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db, table_list->alias);
+ DBUG_RETURN(-1);
+ }
+ }
+ if (table_list->grant.want_privilege)
+ {
+ char command[128];
+ get_privilege_desc(command, sizeof(command),
+ table_list->grant.want_privilege);
+ my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
+ command, thd->priv_user, thd->host_or_ip, table_list->alias);
+ DBUG_RETURN(-1);
+ }
}
}
@@ -2189,7 +2209,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
*/
if (thd->slave_thread && table_rules_on)
{
- /*
+ /*
The tables must be marked "updating" so that tables_ok() takes them into
account in tests.
*/
@@ -2636,25 +2656,8 @@ err:
pthread_mutex_unlock(&LOCK_grant);
if (!no_errors) // Not a silent skip of table
{
- const char *command="";
- if (want_access & SELECT_ACL)
- command ="select";
- else if (want_access & INSERT_ACL)
- command = "insert";
- else if (want_access & UPDATE_ACL)
- command = "update";
- else if (want_access & DELETE_ACL)
- command = "delete";
- else if (want_access & DROP_ACL)
- command = "drop";
- else if (want_access & CREATE_ACL)
- command = "create";
- else if (want_access & ALTER_ACL)
- command = "alter";
- else if (want_access & INDEX_ACL)
- command = "index";
- else if (want_access & GRANT_ACL)
- command = "grant";
+ char command[128];
+ get_privilege_desc(command, sizeof(command), want_access);
net_printf(&thd->net,ER_TABLEACCESS_DENIED_ERROR,
command,
thd->priv_user,
@@ -2767,11 +2770,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
err:
pthread_mutex_unlock(&LOCK_grant);
- const char *command="";
- if (want_access & SELECT_ACL)
- command ="select";
- else if (want_access & INSERT_ACL)
- command = "insert";
+ char command[128];
+ get_privilege_desc(command, sizeof(command), want_access);
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
ER(ER_COLUMNACCESS_DENIED_ERROR),
MYF(0),
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6b3723d89c4..1aeb158dc11 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1104,7 +1104,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->free_list=0;
table_list.alias= table_list.real_name= thd->strdup(packet);
packet=strend(packet)+1;
- // command not cachable => no gap for data base name
+ thd->query_length= strlen(packet); // for simplicity: don't optimize
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
break;
mysql_log.write(thd,command,"%s %s",table_list.real_name,fields);