mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 15:15:34 +02:00
Merge bk-internal:/home/bk/mysql-4.1
into build.mysql.com:/users/tulin/mysql-4.1-cluster-extra BitKeeper/etc/logging_ok: auto-union sql/ha_innodb.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_ndbcluster.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged
This commit is contained in:
commit
1aa55857f0
101 changed files with 4755 additions and 583 deletions
56
.bzrignore
56
.bzrignore
|
|
@ -946,3 +946,59 @@ libmysqld/ha_tina.cc
|
|||
analyse.test
|
||||
client/mysqladmin.c
|
||||
mysql-4.1.8-win-src.zip
|
||||
ndb/include/ndb_version.h
|
||||
ndb/include/ndb_global.h
|
||||
mysql-test/mysql-test-run.log
|
||||
mysql-test/r/alter_table.err
|
||||
mysql-test/r/archive.err
|
||||
mysql-test/r/bdb-alter-table-1.err
|
||||
mysql-test/r/bdb-alter-table-2.err
|
||||
mysql-test/r/bdb-crash.err
|
||||
mysql-test/r/bdb-deadlock.err
|
||||
mysql-test/r/bdb.err
|
||||
mysql-test/r/bdb_cache.err
|
||||
mysql-test/r/client_test.err
|
||||
mysql-test/r/csv.err
|
||||
mysql-test/r/ctype_ucs.err
|
||||
mysql-test/r/derived.err
|
||||
mysql-test/r/exampledb.err
|
||||
mysql-test/r/func_encrypt.err
|
||||
mysql-test/r/isam.err
|
||||
mysql-test/r/lowercase_table2.err
|
||||
mysql-test/r/multi_update.err
|
||||
mysql-test/r/mysql_protocols.err
|
||||
mysql-test/r/mysqlbinlog.err
|
||||
mysql-test/r/mysqlbinlog2.err
|
||||
mysql-test/r/mysqldump.err
|
||||
mysql-test/r/mysqltest.err
|
||||
mysql-test/r/ndb_alter_table.err
|
||||
mysql-test/r/ndb_autodiscover.err
|
||||
mysql-test/r/ndb_autodiscover2.err
|
||||
mysql-test/r/ndb_basic.err
|
||||
mysql-test/r/ndb_blob.err
|
||||
mysql-test/r/ndb_cache.err
|
||||
mysql-test/r/ndb_charset.err
|
||||
mysql-test/r/ndb_index.err
|
||||
mysql-test/r/ndb_index_ordered.err
|
||||
mysql-test/r/ndb_index_unique.err
|
||||
mysql-test/r/ndb_insert.err
|
||||
mysql-test/r/ndb_limit.err
|
||||
mysql-test/r/ndb_lock.err
|
||||
mysql-test/r/ndb_minmax.err
|
||||
mysql-test/r/ndb_replace.err
|
||||
mysql-test/r/ndb_subquery.err
|
||||
mysql-test/r/ndb_transaction.err
|
||||
mysql-test/r/ndb_truncate.err
|
||||
mysql-test/r/ndb_types.err
|
||||
mysql-test/r/ndb_update.err
|
||||
mysql-test/r/openssl_1.err
|
||||
mysql-test/r/ps_1general.err
|
||||
mysql-test/r/ps_6bdb.err
|
||||
mysql-test/r/ps_7ndb.err
|
||||
mysql-test/r/query_cache.err
|
||||
mysql-test/r/query_cache_merge.err
|
||||
mysql-test/r/raid.err
|
||||
mysql-test/r/repair.err
|
||||
mysql-test/r/replace.err
|
||||
mysql-test/r/rpl000001.err
|
||||
mysql-test/r/rpl000015.err
|
||||
|
|
|
|||
47
BUILD/compile-dist
Executable file
47
BUILD/compile-dist
Executable file
|
|
@ -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-ndbcluster
|
||||
make
|
||||
|
|
@ -103,6 +103,7 @@ lenz@mysql.com
|
|||
magnus@neptunus.(none)
|
||||
magnus@shellback.(none)
|
||||
marko@hundin.mysql.fi
|
||||
marty@linux.site
|
||||
mats@mysql.com
|
||||
matt@booty.(none)
|
||||
matt@mysql.com
|
||||
|
|
@ -164,6 +165,7 @@ paul@frost.snake.net
|
|||
paul@ice.local
|
||||
paul@ice.snake.net
|
||||
paul@kite-hub.kitebird.com
|
||||
paul@snake-hub.snake.net
|
||||
paul@teton.kitebird.com
|
||||
pekka@mysql.com
|
||||
pem@mysql.com
|
||||
|
|
|
|||
|
|
@ -1,5 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$BK_USER" = "Administrator" -o "$BK_USER" = "mysqldev" ]
|
||||
then
|
||||
echo "Error: you cannot checkin as 'Administrator' or 'mysqldev' user."
|
||||
echo "as a workaround set BK_USER to your nickname"
|
||||
echo "e.g.: export BK_USER='bar'"
|
||||
echo ""
|
||||
echo "Checkin FAILED!"
|
||||
echo "Set BK_USER and retry."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ `tail -c1 $BK_FILE` ]
|
||||
then
|
||||
echo "File $BK_FILE does not end with a new-line character!"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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/!");
|
||||
}
|
||||
|
||||
#
|
||||
|
|
@ -377,6 +367,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)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
|
|||
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
|
||||
@readline_topdir@ sql-common \
|
||||
@thread_dirs@ pstack \
|
||||
@sql_server_dirs@ @sql_client_dirs@ scripts man tests \
|
||||
@sql_union_dirs@ scripts man tests \
|
||||
netware @libmysqld_dirs@ \
|
||||
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
|
||||
|
||||
DIST_SUBDIRS = . include @docs_dirs@ zlib \
|
||||
@readline_topdir@ sql-common \
|
||||
@thread_dirs@ pstack \
|
||||
@sql_server_dirs@ @sql_client_dirs@ scripts @man_dirs@ tests SSL\
|
||||
@sql_union_dirs@ scripts @man_dirs@ tests SSL\
|
||||
BUILD netware os2 @libmysqld_dirs@ \
|
||||
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqldump - Win32 Debug"
|
||||
|
||||
|
|
@ -76,8 +76,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqldump.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqldump - Win32 classic"
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
# ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib mysys.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysqldump.exe" /libpath:"..\lib_release\\"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ LINK32=link.exe
|
|||
# PROP Output_Dir ".\classic"
|
||||
# PROP Intermediate_Dir ".\classic"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
|
||||
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
|
||||
# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
|
||||
# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "_CONSOLE" /D "_WINDOWS" /D "LICENSE=Commercial" /D "DBUG_OFF" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\classic/mysqltest.pch" /Fo".\classic/" /Fd".\classic/" /c /GX
|
||||
# ADD BASE MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
|
||||
# ADD MTL /nologo /tlb".\classic\mysqltest.tlb" /win32
|
||||
# ADD BASE RSC /l 1033 /d "NDEBUG"
|
||||
|
|
@ -77,8 +77,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_classic\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\classic\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "mysqltest - Win32 Release"
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ LINK32=link.exe
|
|||
# PROP Output_Dir ".\release"
|
||||
# PROP Intermediate_Dir ".\release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
|
||||
# ADD CPP /nologo /MT /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
|
||||
# ADD BASE CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
|
||||
# ADD CPP /nologo /MT /I "../include" /I "../regex" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_CONSOLE" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /GF /Gy /Fp".\release/mysqltest.pch" /Fo".\release/" /Fd".\release/" /c /GX
|
||||
# ADD BASE MTL /nologo /tlb".\release\mysqltest.tlb" /win32
|
||||
# ADD MTL /nologo /tlb".\release\mysqltest.tlb" /win32
|
||||
# ADD BASE RSC /l 1033 /d "NDEBUG"
|
||||
|
|
@ -102,8 +102,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\client_release\mysqltest.exe" /incremental:no /libpath:"..\lib_release\" /pdb:".\release\mysqltest.pdb" /pdbtype:sept /subsystem:console /MACHINE:I386
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:windows
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\mysql-test\mysql_test_run_new.exe" /incremental:no /pdb:".\Release\mysql_test_run_new.pdb" /pdbtype:sept /subsystem:console
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
|
|||
|
|
@ -49,4 +49,5 @@ enum options_client
|
|||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING
|
||||
#endif
|
||||
,OPT_IGNORE_TABLE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <hash.h>
|
||||
|
||||
#include "client_priv.h"
|
||||
#include "mysql.h"
|
||||
|
|
@ -128,6 +129,15 @@ const char *compatible_mode_names[]=
|
|||
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
|
||||
"", compatible_mode_names, NULL};
|
||||
|
||||
#define TABLE_RULE_HASH_SIZE 16
|
||||
|
||||
typedef struct st_table_rule_ent
|
||||
{
|
||||
char* key; /* dbname.tablename */
|
||||
uint key_len;
|
||||
} TABLE_RULE_ENT;
|
||||
|
||||
HASH ignore_table;
|
||||
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
|
|
@ -233,6 +243,11 @@ static struct my_option my_long_options[] =
|
|||
(gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"host", 'h', "Connect to host.", (gptr*) ¤t_host,
|
||||
(gptr*) ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ignore-table", OPT_IGNORE_TABLE,
|
||||
"Do not dump the specified table. To specify more than one table to ignore, "
|
||||
"use the directive multiple times, once for each table. Each table must "
|
||||
"be specified with both database and table names, e.g. --ignore-table=database.table",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
|
||||
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
|
@ -502,6 +517,28 @@ static void write_footer(FILE *sql_file)
|
|||
} /* write_footer */
|
||||
|
||||
|
||||
static void free_table_ent(TABLE_RULE_ENT* e)
|
||||
{
|
||||
my_free((gptr) e, MYF(0));
|
||||
}
|
||||
|
||||
|
||||
static byte* get_table_key(TABLE_RULE_ENT* e, uint* len,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*len= e->key_len;
|
||||
return (byte*)e->key;
|
||||
}
|
||||
|
||||
|
||||
void init_table_rule_hash(HASH* h)
|
||||
{
|
||||
if(hash_init(h, charset_info, TABLE_RULE_HASH_SIZE, 0, 0,
|
||||
(hash_get_key) get_table_key,
|
||||
(hash_free_key) free_table_ent, 0))
|
||||
exit(EX_EOM);
|
||||
}
|
||||
|
||||
|
||||
static my_bool
|
||||
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
|
|
@ -573,8 +610,32 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case (int) OPT_TABLES:
|
||||
opt_databases=0;
|
||||
break;
|
||||
case (int) OPT_IGNORE_TABLE:
|
||||
{
|
||||
uint len= (uint)strlen(argument);
|
||||
TABLE_RULE_ENT* e;
|
||||
if (!strchr(argument, '.'))
|
||||
{
|
||||
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
|
||||
exit(1);
|
||||
}
|
||||
/* len is always > 0 because we know the there exists a '.' */
|
||||
e= (TABLE_RULE_ENT*)my_malloc(sizeof(TABLE_RULE_ENT) + len, MYF(MY_WME));
|
||||
if (!e)
|
||||
exit(EX_EOM);
|
||||
e->key= (char*)e + sizeof(TABLE_RULE_ENT);
|
||||
e->key_len= len;
|
||||
memcpy(e->key, argument, len);
|
||||
|
||||
if (!hash_inited(&ignore_table))
|
||||
init_table_rule_hash(&ignore_table);
|
||||
|
||||
if(my_hash_insert(&ignore_table, (byte*)e))
|
||||
exit(EX_EOM);
|
||||
break;
|
||||
}
|
||||
case (int) OPT_COMPATIBLE:
|
||||
{
|
||||
{
|
||||
char buff[255];
|
||||
char *end= compatible_mode_normal_str;
|
||||
int i;
|
||||
|
|
@ -1946,6 +2007,14 @@ static int init_dumping(char *database)
|
|||
} /* init_dumping */
|
||||
|
||||
|
||||
my_bool include_table(byte* hash_key, uint len)
|
||||
{
|
||||
if (hash_search(&ignore_table, (byte*) hash_key, len))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int dump_all_tables_in_db(char *database)
|
||||
{
|
||||
|
|
@ -1953,6 +2022,12 @@ static int dump_all_tables_in_db(char *database)
|
|||
uint numrows;
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
|
||||
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
|
||||
char *afterdot;
|
||||
|
||||
afterdot= strmov(hash_key, database);
|
||||
*afterdot++= '.';
|
||||
|
||||
if (init_dumping(database))
|
||||
return 1;
|
||||
if (opt_xml)
|
||||
|
|
@ -1961,7 +2036,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
{
|
||||
DYNAMIC_STRING query;
|
||||
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
|
||||
for (numrows=0 ; (table = getTableName(1)) ; numrows++)
|
||||
for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
|
||||
{
|
||||
dynstr_append(&query, quote_name(table, table_buff, 1));
|
||||
dynstr_append(&query, " READ /*!32311 LOCAL */,");
|
||||
|
|
@ -1977,13 +2052,17 @@ static int dump_all_tables_in_db(char *database)
|
|||
DBerror(sock, "when doing refresh");
|
||||
/* We shall continue here, if --force was given */
|
||||
}
|
||||
while ((table = getTableName(0)))
|
||||
while ((table= getTableName(0)))
|
||||
{
|
||||
numrows = getTableStructure(table, database);
|
||||
if (!dFlag && numrows > 0)
|
||||
dumpTable(numrows,table);
|
||||
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
|
||||
order_by= 0;
|
||||
char *end= strmov(afterdot, table);
|
||||
if (include_table(hash_key, end - hash_key))
|
||||
{
|
||||
numrows = getTableStructure(table, database);
|
||||
if (!dFlag && numrows > 0)
|
||||
dumpTable(numrows,table);
|
||||
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
|
||||
order_by= 0;
|
||||
}
|
||||
}
|
||||
if (opt_xml)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -538,7 +538,6 @@ static void free_used_memory()
|
|||
mysql_server_end();
|
||||
if (ps_protocol)
|
||||
ps_free_reg();
|
||||
my_end(MY_CHECK_ERROR);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
@ -556,6 +555,7 @@ static void die(const char* fmt, ...)
|
|||
}
|
||||
va_end(args);
|
||||
free_used_memory();
|
||||
my_end(MY_CHECK_ERROR);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -568,6 +568,7 @@ static void abort_not_supported_test()
|
|||
if (!silent)
|
||||
printf("skipped\n");
|
||||
free_used_memory();
|
||||
my_end(MY_CHECK_ERROR);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
|
@ -3655,6 +3656,7 @@ int main(int argc, char **argv)
|
|||
if (!got_end_timer)
|
||||
timer_output(); /* No end_timer cmd, end it */
|
||||
free_used_memory();
|
||||
my_end(MY_CHECK_ERROR);
|
||||
exit(error ? 1 : 0);
|
||||
return error ? 1 : 0; /* Keep compiler happy */
|
||||
}
|
||||
|
|
|
|||
18
configure.in
18
configure.in
|
|
@ -23,7 +23,7 @@ NDB_VERSION_STATUS=""
|
|||
# Remember that regexps needs to quote [ and ] since this is run through m4
|
||||
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
|
||||
MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"`
|
||||
MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION. | sed -e 's/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'`
|
||||
MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION. | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'`
|
||||
|
||||
# The port should be constant for a LONG time
|
||||
MYSQL_TCP_PORT_DEFAULT=3306
|
||||
|
|
@ -2832,7 +2832,7 @@ thread_dirs=
|
|||
|
||||
dnl This probably should be cleaned up more - for now the threaded
|
||||
dnl client is just using plain-old libs.
|
||||
sql_client_dirs="libmysql client"
|
||||
sql_client_dirs="libmysql strings regex client"
|
||||
linked_client_targets="linked_libmysql_sources"
|
||||
CLIENT_LIBS=$NON_THREADED_CLIENT_LIBS
|
||||
if test "$THREAD_SAFE_CLIENT" != "no"
|
||||
|
|
@ -3014,6 +3014,20 @@ AC_SUBST(sql_server_dirs)
|
|||
AC_SUBST(thread_dirs)
|
||||
AC_SUBST(server_scripts)
|
||||
|
||||
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
|
||||
# Start with the (longer) server list, add each client item not yet present.
|
||||
sql_union_dirs=" $sql_server_dirs "
|
||||
for DIR in $sql_client_dirs
|
||||
do
|
||||
if echo $sql_union_dirs | grep " $DIR " >/dev/null
|
||||
then
|
||||
: # already present, skip
|
||||
else
|
||||
sql_union_dirs="$sql_union_dirs $DIR "
|
||||
fi
|
||||
done
|
||||
AC_SUBST(sql_union_dirs)
|
||||
|
||||
#if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes"
|
||||
#then
|
||||
# MIT pthreads does now support connecting with unix sockets
|
||||
|
|
|
|||
|
|
@ -39,16 +39,17 @@ enum enum_vio_type
|
|||
|
||||
Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
|
||||
#ifdef __WIN__
|
||||
Vio* vio_new_win32pipe(HANDLE hPipe);
|
||||
Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
|
||||
HANDLE handle_map,
|
||||
HANDLE event_server_wrote,
|
||||
HANDLE event_server_read,
|
||||
HANDLE event_client_wrote,
|
||||
HANDLE event_client_read);
|
||||
int vio_read_pipe(Vio *vio, gptr buf, int size);
|
||||
int vio_write_pipe(Vio *vio, const gptr buf, int size);
|
||||
int vio_close_pipe(Vio * vio);
|
||||
Vio* vio_new_win32pipe(HANDLE hPipe);
|
||||
Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
|
||||
HANDLE handle_map,
|
||||
HANDLE event_server_wrote,
|
||||
HANDLE event_server_read,
|
||||
HANDLE event_client_wrote,
|
||||
HANDLE event_client_read,
|
||||
HANDLE event_conn_closed);
|
||||
int vio_read_pipe(Vio *vio, gptr buf, int size);
|
||||
int vio_write_pipe(Vio *vio, const gptr buf, int size);
|
||||
int vio_close_pipe(Vio * vio);
|
||||
#else
|
||||
#define HANDLE void *
|
||||
#endif /* __WIN__ */
|
||||
|
|
@ -197,6 +198,7 @@ struct st_vio
|
|||
HANDLE event_server_read;
|
||||
HANDLE event_client_wrote;
|
||||
HANDLE event_client_read;
|
||||
HANDLE event_conn_closed;
|
||||
long shared_memory_remain;
|
||||
char *shared_memory_pos;
|
||||
NET *net;
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ buf_read_page(
|
|||
if (err == DB_TABLESPACE_DELETED) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: error: trying to access tablespace %lu page no. %lu,\n"
|
||||
" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n"
|
||||
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
|
||||
(ulong) space, (ulong) offset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,12 +205,14 @@ loop:
|
|||
In a crash recovery we already have all the tablespace objects created.
|
||||
This function compares the space id information in the InnoDB data dictionary
|
||||
to what we already read with fil_load_single_table_tablespaces().
|
||||
In a normal startup we just scan the biggest space id, and store it to
|
||||
fil_system. */
|
||||
|
||||
In a normal startup, we create the tablespace objects for every table in
|
||||
InnoDB's data dictionary, if the corresponding .ibd file exists.
|
||||
We also scan the biggest space id, and store it to fil_system. */
|
||||
|
||||
void
|
||||
dict_check_tablespaces_or_store_max_id(
|
||||
/*===================================*/
|
||||
dict_check_tablespaces_and_store_max_id(
|
||||
/*====================================*/
|
||||
ibool in_crash_recovery) /* in: are we doing a crash recovery */
|
||||
{
|
||||
dict_table_t* sys_tables;
|
||||
|
|
@ -280,6 +282,14 @@ loop:
|
|||
FALSE, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (space_id != 0 && !in_crash_recovery) {
|
||||
/* It is a normal database startup: create the space
|
||||
object and check that the .ibd file exists. */
|
||||
|
||||
fil_open_single_table_tablespace(FALSE, space_id,
|
||||
name);
|
||||
}
|
||||
|
||||
mem_free(name);
|
||||
|
||||
if (space_id > max_space_id) {
|
||||
|
|
@ -796,8 +806,18 @@ dict_load_table(
|
|||
/* Ok; (if we did a crash recovery then the tablespace
|
||||
can already be in the memory cache) */
|
||||
} else {
|
||||
/* In >= 4.1.9, InnoDB scans the data dictionary also
|
||||
at a normal mysqld startup. It is an error if the
|
||||
space object does not exist in memory. */
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: error: space object of table %s,\n"
|
||||
"InnoDB: space id %lu did not exist in memory. Retrying an open.\n",
|
||||
name, (ulong)space);
|
||||
/* Try to open the tablespace */
|
||||
if (!fil_open_single_table_tablespace(space, name)) {
|
||||
if (!fil_open_single_table_tablespace(TRUE,
|
||||
space, name)) {
|
||||
/* We failed to find a sensible tablespace
|
||||
file */
|
||||
|
||||
|
|
|
|||
|
|
@ -466,6 +466,10 @@ fil_node_open_file(
|
|||
ulint size_low;
|
||||
ulint size_high;
|
||||
ibool ret;
|
||||
byte* buf2;
|
||||
byte* page;
|
||||
ibool success;
|
||||
ulint space_id;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(mutex_own(&(system->mutex)));
|
||||
|
|
@ -494,6 +498,8 @@ fil_node_open_file(
|
|||
system->n_open++;
|
||||
|
||||
if (node->size == 0) {
|
||||
ut_a(space->purpose != FIL_LOG);
|
||||
|
||||
os_file_get_size(node->handle, &size_low, &size_high);
|
||||
|
||||
size_bytes = (((ib_longlong)size_high) << 32)
|
||||
|
|
@ -507,6 +513,46 @@ fil_node_open_file(
|
|||
|
||||
ut_a(space->id != 0);
|
||||
|
||||
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: the size of single-table tablespace file %s\n"
|
||||
"InnoDB: is only %lu %lu, should be at least %lu!", node->name,
|
||||
(ulong) size_high,
|
||||
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
|
||||
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
/* Read the first page of the tablespace */
|
||||
|
||||
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
|
||||
/* Align the memory for file i/o if we might have O_DIRECT
|
||||
set */
|
||||
page = ut_align(buf2, UNIV_PAGE_SIZE);
|
||||
|
||||
success = os_file_read(node->handle, page, 0, 0,
|
||||
UNIV_PAGE_SIZE);
|
||||
space_id = fsp_header_get_space_id(page);
|
||||
|
||||
ut_free(buf2);
|
||||
|
||||
if (space_id == ULINT_UNDEFINED || space_id == 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: tablespace id %lu in file %s is not sensible\n",
|
||||
(ulong) space_id,
|
||||
node->name);
|
||||
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
if (space_id != space->id) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: tablespace id is %lu in the data dictionary\n"
|
||||
"InnoDB: but in file %s it is %lu!\n", space->id, node->name, space_id);
|
||||
|
||||
ut_a(0);
|
||||
}
|
||||
|
||||
if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
|
||||
node->size = (ulint) ((size_bytes / (1024 * 1024))
|
||||
* ((1024 * 1024) / UNIV_PAGE_SIZE));
|
||||
|
|
@ -2487,21 +2533,29 @@ func_exit:
|
|||
}
|
||||
|
||||
/************************************************************************
|
||||
Tries to open a single-table tablespace and checks the space id is right in
|
||||
it. If does not succeed, prints an error message to the .err log. This
|
||||
function is used to open the tablespace when we load a table definition
|
||||
to the dictionary cache. NOTE that we assume this operation is used under the
|
||||
protection of the dictionary mutex, so that two users cannot race here. This
|
||||
operation does not leave the file associated with the tablespace open, but
|
||||
closes it after we have looked at the space id in it. */
|
||||
Tries to open a single-table tablespace and optionally checks the space id is
|
||||
right in it. If does not succeed, prints an error message to the .err log. This
|
||||
function is used to open a tablespace when we start up mysqld, and also in
|
||||
IMPORT TABLESPACE.
|
||||
NOTE that we assume this operation is used either at the database startup
|
||||
or under the protection of the dictionary mutex, so that two users cannot
|
||||
race here. This operation does not leave the file associated with the
|
||||
tablespace open, but closes it after we have looked at the space id in it. */
|
||||
|
||||
ibool
|
||||
fil_open_single_table_tablespace(
|
||||
/*=============================*/
|
||||
/* out: TRUE if success */
|
||||
ulint id, /* in: space id */
|
||||
const char* name) /* in: table name in the
|
||||
databasename/tablename format */
|
||||
/* out: TRUE if success */
|
||||
ibool check_space_id, /* in: should we check that the space
|
||||
id in the file is right; we assume
|
||||
that this function runs much faster
|
||||
if no check is made, since accessing
|
||||
the file inode probably is much
|
||||
faster (the OS caches them) than
|
||||
accessing the first page of the file */
|
||||
ulint id, /* in: space id */
|
||||
const char* name) /* in: table name in the
|
||||
databasename/tablename format */
|
||||
{
|
||||
os_file_t file;
|
||||
char* filepath;
|
||||
|
|
@ -2540,6 +2594,12 @@ fil_open_single_table_tablespace(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
if (!check_space_id) {
|
||||
space_id = id;
|
||||
|
||||
goto skip_check;
|
||||
}
|
||||
|
||||
/* Read the first page of the tablespace */
|
||||
|
||||
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
|
||||
|
|
@ -2552,6 +2612,8 @@ fil_open_single_table_tablespace(
|
|||
|
||||
space_id = fsp_header_get_space_id(page);
|
||||
|
||||
ut_free(buf2);
|
||||
|
||||
if (space_id != id) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
|
|
@ -2572,6 +2634,7 @@ fil_open_single_table_tablespace(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
skip_check:
|
||||
success = fil_space_create(filepath, space_id, FIL_TABLESPACE);
|
||||
|
||||
if (!success) {
|
||||
|
|
@ -2584,7 +2647,6 @@ fil_open_single_table_tablespace(
|
|||
fil_node_create(filepath, 0, space_id, FALSE);
|
||||
func_exit:
|
||||
os_file_close(file);
|
||||
ut_free(buf2);
|
||||
mem_free(filepath);
|
||||
|
||||
return(ret);
|
||||
|
|
@ -2651,7 +2713,7 @@ fil_load_single_table_tablespace(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Error: could not open single-table tablespace file\n"
|
||||
"InnoDB: %s!\n"
|
||||
"InnoDB: We do not continue crash recovery, because the table will become\n"
|
||||
"InnoDB: We do not continue the crash recovery, because the table may become\n"
|
||||
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
|
||||
"InnoDB: To fix the problem and start mysqld:\n"
|
||||
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
|
||||
|
|
@ -2822,8 +2884,9 @@ fil_load_single_table_tablespace(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
/* We do not measure the size of the file, that is why we pass the 0
|
||||
below */
|
||||
/* We do not use the size information we have about the file, because
|
||||
the rounding formula for extents and pages is somewhat complex; we
|
||||
let fil_node_open() do that task. */
|
||||
|
||||
fil_node_create(filepath, 0, space_id, FALSE);
|
||||
func_exit:
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@ Created 4/24/1996 Heikki Tuuri
|
|||
In a crash recovery we already have all the tablespace objects created.
|
||||
This function compares the space id information in the InnoDB data dictionary
|
||||
to what we already read with fil_load_single_table_tablespaces().
|
||||
In a normal startup we just scan the biggest space id, and store it to
|
||||
fil_system. */
|
||||
|
||||
In a normal startup, we create the tablespace objects for every table in
|
||||
InnoDB's data dictionary, if the corresponding .ibd file exists.
|
||||
We also scan the biggest space id, and store it to fil_system. */
|
||||
|
||||
void
|
||||
dict_check_tablespaces_or_store_max_id(
|
||||
/*===================================*/
|
||||
dict_check_tablespaces_and_store_max_id(
|
||||
/*====================================*/
|
||||
ibool in_crash_recovery); /* in: are we doing a crash recovery */
|
||||
/************************************************************************
|
||||
Finds the first table name in the given database. */
|
||||
|
|
|
|||
|
|
@ -364,19 +364,29 @@ fil_create_new_single_table_tablespace(
|
|||
tablespace file in pages,
|
||||
must be >= FIL_IBD_FILE_INITIAL_SIZE */
|
||||
/************************************************************************
|
||||
Tries to open a single-table tablespace and checks the space id is right in
|
||||
it. If does not succeed, prints an error message to the .err log. This
|
||||
function is used to open the tablespace when we load a table definition
|
||||
to the dictionary cache. NOTE that we assume this operation is used under the
|
||||
protection of the dictionary mutex, so that two users cannot race here. */
|
||||
Tries to open a single-table tablespace and optionally checks the space id is
|
||||
right in it. If does not succeed, prints an error message to the .err log. This
|
||||
function is used to open a tablespace when we start up mysqld, and also in
|
||||
IMPORT TABLESPACE.
|
||||
NOTE that we assume this operation is used either at the database startup
|
||||
or under the protection of the dictionary mutex, so that two users cannot
|
||||
race here. This operation does not leave the file associated with the
|
||||
tablespace open, but closes it after we have looked at the space id in it. */
|
||||
|
||||
ibool
|
||||
fil_open_single_table_tablespace(
|
||||
/*=============================*/
|
||||
/* out: TRUE if success */
|
||||
ulint id, /* in: space id */
|
||||
const char* name); /* in: table name in the
|
||||
databasename/tablename format */
|
||||
/* out: TRUE if success */
|
||||
ibool check_space_id, /* in: should we check that the space
|
||||
id in the file is right; we assume
|
||||
that this function runs much faster
|
||||
if no check is made, since accessing
|
||||
the file inode probably is much
|
||||
faster (the OS caches them) than
|
||||
accessing the first page of the file */
|
||||
ulint id, /* in: space id */
|
||||
const char* name); /* in: table name in the
|
||||
databasename/tablename format */
|
||||
/************************************************************************
|
||||
It is possible, though very improbable, that the lsn's in the tablespace to be
|
||||
imported have risen above the current system lsn, if a lengthy purge, ibuf
|
||||
|
|
|
|||
|
|
@ -367,25 +367,7 @@ row_drop_table_for_mysql(
|
|||
/*************************************************************************
|
||||
Discards the tablespace of a table which stored in an .ibd file. Discarding
|
||||
means that this function deletes the .ibd file and assigns a new table id for
|
||||
the table. Also the flag table->ibd_file_missing is set TRUE.
|
||||
|
||||
How do we prevent crashes caused by ongoing operations on the table? Old
|
||||
operations could try to access non-existent pages.
|
||||
|
||||
1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
|
||||
on the table before we can do DISCARD TABLESPACE. Then there are no running
|
||||
queries on the table.
|
||||
2) Purge and rollback: we assign a new table id for the table. Since purge and
|
||||
rollback look for the table based on the table id, they see the table as
|
||||
'dropped' and discard their operations.
|
||||
3) Insert buffer: we remove all entries for the tablespace in the insert
|
||||
buffer tree; as long as the tablespace mem object does not exist, ongoing
|
||||
insert buffer page merges are discarded in buf0rea.c. If we recreate the
|
||||
tablespace mem object with IMPORT TABLESPACE later, then the tablespace will
|
||||
have the same id, but the tablespace_version field in the mem object is
|
||||
different, and ongoing old insert buffer page merges get discarded.
|
||||
4) Linear readahead and random readahead: we use the same method as in 3) to
|
||||
discard ongoing operations. */
|
||||
the table. Also the flag table->ibd_file_missing is set TRUE. */
|
||||
|
||||
int
|
||||
row_discard_tablespace_for_mysql(
|
||||
|
|
|
|||
|
|
@ -378,6 +378,19 @@ struct trx_struct{
|
|||
replication slave, this is the
|
||||
position in the log file up to which
|
||||
replication has processed */
|
||||
/* A MySQL variable mysql_thd->synchronous_repl tells if we have
|
||||
to use synchronous replication. See ha_innodb.cc. */
|
||||
char* repl_wait_binlog_name;/* NULL, or if synchronous MySQL
|
||||
replication is used, the binlog name
|
||||
up to which we must communicate the
|
||||
binlog to the slave, before returning
|
||||
from a commit; this is the same as
|
||||
mysql_log_file_name, but we allocate
|
||||
and copy the name to a separate buffer
|
||||
here */
|
||||
ib_longlong repl_wait_binlog_pos;/* see above at
|
||||
repl_wait_binlog_name */
|
||||
|
||||
os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
|
||||
with this transaction object */
|
||||
ulint mysql_process_no;/* since in Linux, 'top' reports
|
||||
|
|
|
|||
|
|
@ -2990,8 +2990,7 @@ recv_reset_log_files_for_backup(
|
|||
memcpy(name + log_dir_len, logfilename, sizeof logfilename);
|
||||
|
||||
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
||||
memset(buf, LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE, '\0');
|
||||
|
||||
memset(buf, '\0', LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
||||
|
||||
for (i = 0; i < n_log_files; i++) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1173,7 +1173,7 @@ run_again:
|
|||
check_index = foreign->foreign_index;
|
||||
}
|
||||
|
||||
if (check_table == NULL) {
|
||||
if (check_table == NULL || check_table->ibd_file_missing) {
|
||||
if (check_ref) {
|
||||
FILE* ef = dict_foreign_err_file;
|
||||
mutex_enter(&dict_foreign_err_mutex);
|
||||
|
|
@ -1192,7 +1192,7 @@ run_again:
|
|||
dtuple_print(ef, entry);
|
||||
fputs("\nBut the parent table ", ef);
|
||||
ut_print_name(ef, trx, foreign->referenced_table_name);
|
||||
fputs(" does not currently exist!\n", ef);
|
||||
fputs("\nor its .ibd file does not currently exist!\n", ef);
|
||||
mutex_exit(&dict_foreign_err_mutex);
|
||||
|
||||
return(DB_NO_REFERENCED_ROW);
|
||||
|
|
@ -1415,8 +1415,34 @@ row_ins_check_foreign_constraints(
|
|||
row_mysql_freeze_data_dictionary(trx);
|
||||
}
|
||||
|
||||
if (foreign->referenced_table) {
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
(foreign->referenced_table
|
||||
->n_foreign_key_checks_running)++;
|
||||
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
}
|
||||
|
||||
/* NOTE that if the thread ends up waiting for a lock
|
||||
we will release dict_operation_lock temporarily!
|
||||
But the counter on the table protects the referenced
|
||||
table from being dropped while the check is running. */
|
||||
|
||||
err = row_ins_check_foreign_constraint(TRUE, foreign,
|
||||
table, entry, thr);
|
||||
|
||||
if (foreign->referenced_table) {
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
ut_a(foreign->referenced_table
|
||||
->n_foreign_key_checks_running > 0);
|
||||
(foreign->referenced_table
|
||||
->n_foreign_key_checks_running)--;
|
||||
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
}
|
||||
|
||||
if (got_s_lock) {
|
||||
row_mysql_unfreeze_data_dictionary(trx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -869,7 +869,21 @@ row_insert_for_mysql(
|
|||
|
||||
ut_ad(trx);
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
|
||||
|
||||
if (prebuilt->table->ibd_file_missing) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Error:\n"
|
||||
"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
|
||||
"InnoDB: table %s does not exist.\n"
|
||||
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
|
||||
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
|
||||
"InnoDB: Look from\n"
|
||||
"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
|
||||
"InnoDB: how you can resolve the problem.\n",
|
||||
prebuilt->table->name);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: trying to free a corrupt\n"
|
||||
|
|
@ -1087,6 +1101,20 @@ row_update_for_mysql(
|
|||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
UT_NOT_USED(mysql_rec);
|
||||
|
||||
if (prebuilt->table->ibd_file_missing) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Error:\n"
|
||||
"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
|
||||
"InnoDB: table %s does not exist.\n"
|
||||
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
|
||||
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
|
||||
"InnoDB: Look from\n"
|
||||
"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
|
||||
"InnoDB: how you can resolve the problem.\n",
|
||||
prebuilt->table->name);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: trying to free a corrupt\n"
|
||||
|
|
@ -1805,20 +1833,19 @@ row_drop_table_for_mysql_in_background(
|
|||
|
||||
trx = trx_allocate_for_background();
|
||||
|
||||
/* If the original transaction was dropping a table referenced by
|
||||
foreign keys, we must set the following to be able to drop the
|
||||
table: */
|
||||
|
||||
trx->check_foreigns = FALSE;
|
||||
|
||||
/* fputs("InnoDB: Error: Dropping table ", stderr);
|
||||
ut_print_name(stderr, name);
|
||||
fputs(" in background drop list\n", stderr); */
|
||||
|
||||
/* Drop the table in InnoDB */
|
||||
/* Try to drop the table in InnoDB */
|
||||
|
||||
error = row_drop_table_for_mysql(name, trx, FALSE);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Error: Dropping table ", stderr);
|
||||
ut_print_name(stderr, trx, name);
|
||||
fputs(" in background drop list failed\n", stderr);
|
||||
}
|
||||
|
||||
/* Flush the log to reduce probability that the .frm files and
|
||||
the InnoDB data dictionary get out-of-sync if the user runs
|
||||
|
|
@ -1830,7 +1857,7 @@ row_drop_table_for_mysql_in_background(
|
|||
|
||||
trx_free_for_background(trx);
|
||||
|
||||
return(DB_SUCCESS);
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
|
@ -1864,6 +1891,7 @@ loop:
|
|||
mutex_exit(&kernel_mutex);
|
||||
|
||||
if (drop == NULL) {
|
||||
/* All tables dropped */
|
||||
|
||||
return(n_tables + n_tables_dropped);
|
||||
}
|
||||
|
|
@ -1878,16 +1906,16 @@ loop:
|
|||
|
||||
goto already_dropped;
|
||||
}
|
||||
|
||||
if (table->n_mysql_handles_opened > 0
|
||||
|| table->n_foreign_key_checks_running > 0) {
|
||||
|
||||
if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
|
||||
drop->table_name)) {
|
||||
/* If the DROP fails for some table, we return, and let the
|
||||
main thread retry later */
|
||||
|
||||
return(n_tables + n_tables_dropped);
|
||||
}
|
||||
|
||||
n_tables_dropped++;
|
||||
|
||||
row_drop_table_for_mysql_in_background(drop->table_name);
|
||||
|
||||
already_dropped:
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
|
@ -1931,21 +1959,21 @@ row_get_background_drop_list_len_low(void)
|
|||
}
|
||||
|
||||
/*************************************************************************
|
||||
Adds a table to the list of tables which the master thread drops in
|
||||
background. We need this on Unix because in ALTER TABLE MySQL may call
|
||||
drop table even if the table has running queries on it. */
|
||||
If a table is not yet in the drop list, adds the table to the list of tables
|
||||
which the master thread drops in background. We need this on Unix because in
|
||||
ALTER TABLE MySQL may call drop table even if the table has running queries on
|
||||
it. Also, if there are running foreign key checks on the table, we drop the
|
||||
table lazily. */
|
||||
static
|
||||
void
|
||||
ibool
|
||||
row_add_table_to_background_drop_list(
|
||||
/*==================================*/
|
||||
/* out: TRUE if the table was not yet in the
|
||||
drop list, and was added there */
|
||||
dict_table_t* table) /* in: table */
|
||||
{
|
||||
row_mysql_drop_t* drop;
|
||||
|
||||
drop = mem_alloc(sizeof(row_mysql_drop_t));
|
||||
|
||||
drop->table_name = mem_strdup(table->name);
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
if (!row_mysql_drop_list_inited) {
|
||||
|
|
@ -1953,7 +1981,26 @@ row_add_table_to_background_drop_list(
|
|||
UT_LIST_INIT(row_mysql_drop_list);
|
||||
row_mysql_drop_list_inited = TRUE;
|
||||
}
|
||||
|
||||
/* Look if the table already is in the drop list */
|
||||
drop = UT_LIST_GET_FIRST(row_mysql_drop_list);
|
||||
|
||||
while (drop != NULL) {
|
||||
if (strcmp(drop->table_name, table->name) == 0) {
|
||||
/* Already in the list */
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
drop = UT_LIST_GET_NEXT(row_mysql_drop_list, drop);
|
||||
}
|
||||
|
||||
drop = mem_alloc(sizeof(row_mysql_drop_t));
|
||||
|
||||
drop->table_name = mem_strdup(table->name);
|
||||
|
||||
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
|
||||
|
||||
/* fputs("InnoDB: Adding table ", stderr);
|
||||
|
|
@ -1961,14 +2008,32 @@ row_add_table_to_background_drop_list(
|
|||
fputs(" to background drop list\n", stderr); */
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Discards the tablespace of a table which stored in an .ibd file. Discarding
|
||||
means that this function deletes the .ibd file and assigns a new table id for
|
||||
the table. Also the flag table->ibd_file_missing is set TRUE.
|
||||
the table. Also the flag table->ibd_file_missing is set TRUE. */
|
||||
|
||||
How do we prevent crashes caused by ongoing operations on the table? Old
|
||||
int
|
||||
row_discard_tablespace_for_mysql(
|
||||
/*=============================*/
|
||||
/* out: error code or DB_SUCCESS */
|
||||
const char* name, /* in: table name */
|
||||
trx_t* trx) /* in: transaction handle */
|
||||
{
|
||||
dict_foreign_t* foreign;
|
||||
dulint new_id;
|
||||
dict_table_t* table;
|
||||
que_thr_t* thr;
|
||||
que_t* graph = NULL;
|
||||
ibool success;
|
||||
ulint err;
|
||||
char* buf;
|
||||
|
||||
/* How do we prevent crashes caused by ongoing operations on the table? Old
|
||||
operations could try to access non-existent pages.
|
||||
|
||||
1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
|
||||
|
|
@ -1984,22 +2049,9 @@ tablespace mem object with IMPORT TABLESPACE later, then the tablespace will
|
|||
have the same id, but the tablespace_version field in the mem object is
|
||||
different, and ongoing old insert buffer page merges get discarded.
|
||||
4) Linear readahead and random readahead: we use the same method as in 3) to
|
||||
discard ongoing operations. */
|
||||
|
||||
int
|
||||
row_discard_tablespace_for_mysql(
|
||||
/*=============================*/
|
||||
/* out: error code or DB_SUCCESS */
|
||||
const char* name, /* in: table name */
|
||||
trx_t* trx) /* in: transaction handle */
|
||||
{
|
||||
dulint new_id;
|
||||
dict_table_t* table;
|
||||
que_thr_t* thr;
|
||||
que_t* graph = NULL;
|
||||
ibool success;
|
||||
ulint err;
|
||||
char* buf;
|
||||
discard ongoing operations.
|
||||
5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
|
||||
do not allow the discard. We also reserve the data dictionary latch. */
|
||||
|
||||
static const char discard_tablespace_proc1[] =
|
||||
"PROCEDURE DISCARD_TABLESPACE_PROC () IS\n"
|
||||
|
|
@ -2060,6 +2112,54 @@ row_discard_tablespace_for_mysql(
|
|||
goto funct_exit;
|
||||
}
|
||||
|
||||
if (table->n_foreign_key_checks_running > 0) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: You are trying to DISCARD table ", stderr);
|
||||
ut_print_name(stderr, trx, table->name);
|
||||
fputs("\n"
|
||||
"InnoDB: though there is a foreign key check running on it.\n"
|
||||
"InnoDB: Cannot discard the table.\n",
|
||||
stderr);
|
||||
|
||||
err = DB_ERROR;
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
/* Check if the table is referenced by foreign key constraints from
|
||||
some other table (not the table itself) */
|
||||
|
||||
foreign = UT_LIST_GET_FIRST(table->referenced_list);
|
||||
|
||||
while (foreign && foreign->foreign_table == table) {
|
||||
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
|
||||
}
|
||||
|
||||
if (foreign && trx->check_foreigns) {
|
||||
|
||||
FILE* ef = dict_foreign_err_file;
|
||||
|
||||
/* We only allow discarding a referenced table if
|
||||
FOREIGN_KEY_CHECKS is set to 0 */
|
||||
|
||||
err = DB_CANNOT_DROP_CONSTRAINT;
|
||||
|
||||
mutex_enter(&dict_foreign_err_mutex);
|
||||
rewind(ef);
|
||||
ut_print_timestamp(ef);
|
||||
|
||||
fputs(" Cannot DISCARD table ", ef);
|
||||
ut_print_name(ef, trx, name);
|
||||
fputs("\n"
|
||||
"because it is referenced by ", ef);
|
||||
ut_print_name(ef, trx, foreign->foreign_table_name);
|
||||
putc('\n', ef);
|
||||
mutex_exit(&dict_foreign_err_mutex);
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
|
||||
|
||||
buf = mem_alloc((sizeof discard_tablespace_proc1) +
|
||||
|
|
@ -2077,6 +2177,10 @@ row_discard_tablespace_for_mysql(
|
|||
|
||||
ut_a(graph);
|
||||
|
||||
/* Remove any locks there are on the table or its records */
|
||||
|
||||
lock_reset_all_on_table(table);
|
||||
|
||||
graph->trx = trx;
|
||||
trx->graph = NULL;
|
||||
|
||||
|
|
@ -2227,8 +2331,8 @@ row_import_tablespace_for_mysql(
|
|||
|
||||
ibuf_delete_for_discarded_space(table->space);
|
||||
|
||||
success = fil_open_single_table_tablespace(table->space, table->name);
|
||||
|
||||
success = fil_open_single_table_tablespace(TRUE, table->space,
|
||||
table->name);
|
||||
if (success) {
|
||||
table->ibd_file_missing = FALSE;
|
||||
table->tablespace_discarded = FALSE;
|
||||
|
|
@ -2236,7 +2340,7 @@ row_import_tablespace_for_mysql(
|
|||
if (table->ibd_file_missing) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(
|
||||
" InnoDB: cannot find of open in the database directory the .ibd file of\n"
|
||||
" InnoDB: cannot find or open in the database directory the .ibd file of\n"
|
||||
"InnoDB: table ", stderr);
|
||||
ut_print_name(stderr, trx, name);
|
||||
fputs("\n"
|
||||
|
|
@ -2258,7 +2362,7 @@ funct_exit:
|
|||
}
|
||||
|
||||
/*************************************************************************
|
||||
Drops a table for MySQL. If the name of the table to be dropped is equal
|
||||
Drops a table for MySQL. If the name of the table to be dropped is equal
|
||||
with one of the predefined magic table names, then this also stops printing
|
||||
the corresponding monitor output by the master thread. */
|
||||
|
||||
|
|
@ -2492,36 +2596,60 @@ row_drop_table_for_mysql(
|
|||
}
|
||||
|
||||
if (table->n_mysql_handles_opened > 0) {
|
||||
ibool added;
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Warning: MySQL is trying to drop table ",
|
||||
stderr);
|
||||
ut_print_name(stderr, trx, table->name);
|
||||
fputs("\n"
|
||||
"InnoDB: though there are still open handles to it.\n"
|
||||
"InnoDB: Adding the table to the background drop queue.\n",
|
||||
added = row_add_table_to_background_drop_list(table);
|
||||
|
||||
if (added) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Warning: MySQL is trying to drop table ", stderr);
|
||||
ut_print_name(stderr, trx, table->name);
|
||||
fputs("\n"
|
||||
"InnoDB: though there are still open handles to it.\n"
|
||||
"InnoDB: Adding the table to the background drop queue.\n",
|
||||
stderr);
|
||||
|
||||
/* We return DB_SUCCESS to MySQL though the drop will
|
||||
happen lazily later */
|
||||
|
||||
row_add_table_to_background_drop_list(table);
|
||||
|
||||
err = DB_SUCCESS;
|
||||
err = DB_SUCCESS;
|
||||
} else {
|
||||
/* The table is already in the background drop list */
|
||||
err = DB_ERROR;
|
||||
}
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
/* TODO: could we replace the counter n_foreign_key_checks_running
|
||||
with lock checks on the table? Acquire here an exclusive lock on the
|
||||
table, and rewrite lock0lock.c and the lock wait in srv0srv.c so that
|
||||
they can cope with the table having been dropped here? Foreign key
|
||||
checks take an IS or IX lock on the table. */
|
||||
|
||||
if (table->n_foreign_key_checks_running > 0) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: You are trying to drop table ", stderr);
|
||||
ut_print_name(stderr, trx, table->name);
|
||||
fputs("\n"
|
||||
"InnoDB: though there is a foreign key check running on it.\n"
|
||||
"InnoDB: Adding the table to the background drop queue.\n",
|
||||
ibool added;
|
||||
|
||||
added = row_add_table_to_background_drop_list(table);
|
||||
|
||||
if (added) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: You are trying to drop table ", stderr);
|
||||
ut_print_name(stderr, trx, table->name);
|
||||
fputs("\n"
|
||||
"InnoDB: though there is a foreign key check running on it.\n"
|
||||
"InnoDB: Adding the table to the background drop queue.\n",
|
||||
stderr);
|
||||
|
||||
row_add_table_to_background_drop_list(table);
|
||||
/* We return DB_SUCCESS to MySQL though the drop will
|
||||
happen lazily later */
|
||||
|
||||
err = DB_SUCCESS;
|
||||
err = DB_SUCCESS;
|
||||
} else {
|
||||
/* The table is already in the background drop list */
|
||||
err = DB_ERROR;
|
||||
}
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
|
@ -3284,6 +3412,20 @@ row_check_table_for_mysql(
|
|||
ulint ret = DB_SUCCESS;
|
||||
ulint old_isolation_level;
|
||||
|
||||
if (prebuilt->table->ibd_file_missing) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Error:\n"
|
||||
"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
|
||||
"InnoDB: table %s does not exist.\n"
|
||||
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
|
||||
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
|
||||
"InnoDB: Look from\n"
|
||||
"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
|
||||
"InnoDB: how you can resolve the problem.\n",
|
||||
prebuilt->table->name);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
prebuilt->trx->op_info = "checking table";
|
||||
|
||||
old_isolation_level = prebuilt->trx->isolation_level;
|
||||
|
|
|
|||
|
|
@ -2776,7 +2776,7 @@ row_search_for_mysql(
|
|||
/* out: DB_SUCCESS,
|
||||
DB_RECORD_NOT_FOUND,
|
||||
DB_END_OF_INDEX, DB_DEADLOCK,
|
||||
DB_LOCK_TABLE_FULL,
|
||||
DB_LOCK_TABLE_FULL, DB_CORRUPTION,
|
||||
or DB_TOO_BIG_RECORD */
|
||||
byte* buf, /* in/out: buffer for the fetched
|
||||
row in the MySQL format */
|
||||
|
|
@ -2828,7 +2828,21 @@ row_search_for_mysql(
|
|||
|
||||
ut_ad(index && pcur && search_tuple);
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
|
||||
|
||||
if (prebuilt->table->ibd_file_missing) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Error:\n"
|
||||
"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
|
||||
"InnoDB: table %s does not exist.\n"
|
||||
"InnoDB: Have you deleted the .ibd file from the database directory under\n"
|
||||
"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
|
||||
"InnoDB: Look from\n"
|
||||
"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
|
||||
"InnoDB: how you can resolve the problem.\n",
|
||||
prebuilt->table->name);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: trying to free a corrupt\n"
|
||||
|
|
|
|||
|
|
@ -381,8 +381,14 @@ row_upd_changes_field_size_or_external(
|
|||
new_len = new_val->len;
|
||||
|
||||
if (new_len == UNIV_SQL_NULL) {
|
||||
/* A bug fixed on Dec 31st, 2004: we looked at the
|
||||
SQL NULL size from the wrong field! We may backport
|
||||
this fix also to 4.0. The merge to 5.0 will be made
|
||||
manually immediately after we commit this to 4.1. */
|
||||
|
||||
new_len = dtype_get_sql_null_size(
|
||||
dict_index_get_nth_type(index, i));
|
||||
dict_index_get_nth_type(index,
|
||||
upd_field->field_no));
|
||||
}
|
||||
|
||||
old_len = rec_get_nth_field_size(rec, upd_field->field_no);
|
||||
|
|
|
|||
|
|
@ -1378,14 +1378,39 @@ NetWare. */
|
|||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
/* Since ibuf init is in dict_boot, and ibuf is needed
|
||||
in any disk i/o, first call dict_boot */
|
||||
/* Since the insert buffer init is in dict_boot, and the
|
||||
insert buffer is needed in any disk i/o, first we call
|
||||
dict_boot(). Note that trx_sys_init_at_db_start() only needs
|
||||
to access space 0, and the insert buffer at this stage already
|
||||
works for space 0. */
|
||||
|
||||
dict_boot();
|
||||
trx_sys_init_at_db_start();
|
||||
|
||||
/* The following needs trx lists which are initialized in
|
||||
trx_sys_init_at_db_start */
|
||||
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
|
||||
/* The following call is necessary for the insert
|
||||
buffer to work with multiple tablespaces. We must
|
||||
know the mapping between space id's and .ibd file
|
||||
names.
|
||||
|
||||
In a crash recovery, we check that the info in data
|
||||
dictionary is consistent with what we already know
|
||||
about space id's from the call of
|
||||
fil_load_single_table_tablespaces().
|
||||
|
||||
In a normal startup, we create the space objects for
|
||||
every table in the InnoDB data dictionary that has
|
||||
an .ibd file.
|
||||
|
||||
We also determine the maximum tablespace id used.
|
||||
|
||||
TODO: We may have incomplete transactions in the
|
||||
data dictionary tables. Does that harm the scanning of
|
||||
the data dictionary below? */
|
||||
|
||||
dict_check_tablespaces_and_store_max_id(
|
||||
recv_needed_recovery);
|
||||
}
|
||||
|
||||
srv_startup_is_before_trx_rollback_phase = FALSE;
|
||||
|
||||
|
|
@ -1393,6 +1418,9 @@ NetWare. */
|
|||
system */
|
||||
fsp_header_get_free_limit(0);
|
||||
|
||||
/* recv_recovery_from_checkpoint_finish needs trx lists which
|
||||
are initialized in trx_sys_init_at_db_start(). */
|
||||
|
||||
recv_recovery_from_checkpoint_finish();
|
||||
}
|
||||
|
||||
|
|
@ -1433,13 +1461,6 @@ NetWare. */
|
|||
}
|
||||
}
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
if (!create_new_db && srv_force_recovery == 0) {
|
||||
/* After a crash recovery we only check that the info in data
|
||||
dictionary is consistent with what we already know about space
|
||||
id's from the call of fil_load_single_table_tablespaces(). */
|
||||
|
||||
dict_check_tablespaces_or_store_max_id(recv_needed_recovery);
|
||||
}
|
||||
|
||||
if (srv_measure_contention) {
|
||||
/* os_thread_create(&test_measure_cont, NULL, thread_ids +
|
||||
|
|
@ -1507,6 +1528,21 @@ NetWare. */
|
|||
"InnoDB: the sum of data file sizes is %lu pages\n",
|
||||
(ulong) tablespace_size_in_header,
|
||||
(ulong) sum_of_data_file_sizes);
|
||||
|
||||
if (srv_force_recovery == 0
|
||||
&& sum_of_data_file_sizes < tablespace_size_in_header) {
|
||||
/* This is a fatal error, the tail of a tablespace is
|
||||
missing */
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
|
||||
"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
|
||||
"InnoDB: inappropriate way, removing ibdata files from there?\n"
|
||||
"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
|
||||
"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (srv_auto_extend_last_data_file
|
||||
|
|
@ -1517,6 +1553,18 @@ NetWare. */
|
|||
"InnoDB: the sum of data file sizes is only %lu pages\n",
|
||||
(ulong) tablespace_size_in_header,
|
||||
(ulong) sum_of_data_file_sizes);
|
||||
|
||||
if (srv_force_recovery == 0) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
|
||||
"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
|
||||
"InnoDB: inappropriate way, removing ibdata files from there?\n"
|
||||
"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
|
||||
"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that os_fast_mutexes work as expected */
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ trx_create(
|
|||
trx->mysql_log_offset = 0;
|
||||
trx->mysql_master_log_file_name = "";
|
||||
trx->mysql_master_log_pos = 0;
|
||||
|
||||
trx->repl_wait_binlog_name = NULL;
|
||||
trx->repl_wait_binlog_pos = 0;
|
||||
|
||||
mutex_create(&(trx->undo_mutex));
|
||||
mutex_set_level(&(trx->undo_mutex), SYNC_TRX_UNDO);
|
||||
|
|
@ -271,6 +274,11 @@ trx_free(
|
|||
trx_undo_arr_free(trx->undo_no_arr);
|
||||
}
|
||||
|
||||
if (trx->repl_wait_binlog_name != NULL) {
|
||||
|
||||
mem_free(trx->repl_wait_binlog_name);
|
||||
}
|
||||
|
||||
ut_a(UT_LIST_GET_LEN(trx->signals) == 0);
|
||||
ut_a(UT_LIST_GET_LEN(trx->reply_signals) == 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1466,12 +1466,14 @@ static int writekeys(MI_CHECK *param, register MI_INFO *info, byte *buff,
|
|||
if (_mi_ft_add(info,i,(char*) key,buff,filepos))
|
||||
goto err;
|
||||
}
|
||||
#ifdef HAVE_SPATIAL
|
||||
else if (info->s->keyinfo[i].flag & HA_SPATIAL)
|
||||
{
|
||||
uint key_length=_mi_make_key(info,i,key,buff,filepos);
|
||||
if (rtree_insert(info, i, key, key_length))
|
||||
goto err;
|
||||
}
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
else
|
||||
{
|
||||
uint key_length=_mi_make_key(info,i,key,buff,filepos);
|
||||
|
|
|
|||
54
mysql-test/lib/init_db.sql
Normal file
54
mysql-test/lib/init_db.sql
Normal file
File diff suppressed because one or more lines are too long
44
mysql-test/lib/mtr_gcov.pl
Normal file
44
mysql-test/lib/mtr_gcov.pl
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
# These are not to be prefixed with "mtr_"
|
||||
|
||||
sub gcov_prepare ();
|
||||
sub gcov_collect ();
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub gcov_prepare () {
|
||||
|
||||
`find $::glob_basedir -name \*.gcov \
|
||||
-or -name \*.da | xargs rm`;
|
||||
}
|
||||
|
||||
sub gcov_collect () {
|
||||
|
||||
print "Collecting source coverage info...\n";
|
||||
-f $::opt_gcov_msg and unlink($::opt_gcov_msg);
|
||||
-f $::opt_gcov_err and unlink($::opt_gcov_err);
|
||||
foreach my $d ( @::mysqld_src_dirs )
|
||||
{
|
||||
chdir("$::glob_basedir/$d");
|
||||
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
|
||||
{
|
||||
`$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`;
|
||||
}
|
||||
chdir($::glob_mysql_test_dir);
|
||||
}
|
||||
print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
50
mysql-test/lib/mtr_gprof.pl
Normal file
50
mysql-test/lib/mtr_gprof.pl
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
# These are not to be prefixed with "mtr_"
|
||||
|
||||
sub gprof_prepare ();
|
||||
sub gprof_collect ();
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub gprof_prepare () {
|
||||
|
||||
rmtree($::opt_gprof_dir);
|
||||
mkdir($::opt_gprof_dir);
|
||||
}
|
||||
|
||||
# FIXME what about master1 and slave1?!
|
||||
sub gprof_collect () {
|
||||
|
||||
if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
|
||||
{
|
||||
# FIXME check result code?!
|
||||
mtr_run("gprof",
|
||||
[$::exe_master_mysqld,
|
||||
"$::master->[0]->{'path_myddir'}/gmon.out"],
|
||||
$::opt_gprof_master, "", "", "");
|
||||
print "Master execution profile has been saved in $::opt_gprof_master\n";
|
||||
}
|
||||
if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
|
||||
{
|
||||
# FIXME check result code?!
|
||||
mtr_run("gprof",
|
||||
[$::exe_slave_mysqld,
|
||||
"$::slave->[0]->{'path_myddir'}/gmon.out"],
|
||||
$::opt_gprof_slave, "", "", "");
|
||||
print "Slave execution profile has been saved in $::opt_gprof_slave\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
71
mysql-test/lib/mtr_io.pl
Normal file
71
mysql-test/lib/mtr_io.pl
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
sub mtr_get_pid_from_file ($);
|
||||
sub mtr_get_opts_from_file ($);
|
||||
sub mtr_tofile ($@);
|
||||
sub mtr_tonewfile($@);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_get_pid_from_file ($) {
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
my $pid= <FILE>;
|
||||
chomp($pid);
|
||||
close FILE;
|
||||
return $pid;
|
||||
}
|
||||
|
||||
sub mtr_get_opts_from_file ($) {
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
my @args;
|
||||
while ( <FILE> )
|
||||
{
|
||||
chomp;
|
||||
s/\$MYSQL_TEST_DIR/$::glob_mysql_test_dir/g;
|
||||
push(@args, split(' ', $_));
|
||||
}
|
||||
close FILE;
|
||||
return \@args;
|
||||
}
|
||||
|
||||
sub mtr_fromfile ($) {
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
my $text= join('', <FILE>);
|
||||
close FILE;
|
||||
return $text;
|
||||
}
|
||||
|
||||
sub mtr_tofile ($@) {
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,">>",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
print FILE join("", @_);
|
||||
close FILE;
|
||||
}
|
||||
|
||||
sub mtr_tonewfile ($@) {
|
||||
my $file= shift;
|
||||
|
||||
open(FILE,">",$file) or mtr_error("can't open file \"$file\": $!");
|
||||
print FILE join("", @_);
|
||||
close FILE;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
67
mysql-test/lib/mtr_match.pl
Normal file
67
mysql-test/lib/mtr_match.pl
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
sub mtr_match_prefix ($$);
|
||||
sub mtr_match_extension ($$);
|
||||
sub mtr_match_any_exact ($$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Match a prefix and return what is after the prefix
|
||||
|
||||
sub mtr_match_prefix ($$) {
|
||||
my $string= shift;
|
||||
my $prefix= shift;
|
||||
|
||||
if ( $string =~ /^\Q$prefix\E(.*)$/ ) # strncmp
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # NULL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Match extension and return the name without extension
|
||||
|
||||
sub mtr_match_extension ($$) {
|
||||
my $file= shift;
|
||||
my $ext= shift;
|
||||
|
||||
if ( $file =~ /^(.*)\.\Q$ext\E$/ ) # strchr+strcmp or something
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # NULL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_match_any_exact ($$) {
|
||||
my $string= shift;
|
||||
my $mlist= shift;
|
||||
|
||||
foreach my $m (@$mlist)
|
||||
{
|
||||
if ( $string eq $m )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
50
mysql-test/lib/mtr_misc.pl
Normal file
50
mysql-test/lib/mtr_misc.pl
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
sub mtr_full_hostname ();
|
||||
sub mtr_init_args ($);
|
||||
sub mtr_add_arg ($$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# We want the fully qualified host name and hostname() may have returned
|
||||
# only the short name. So we use the resolver to find out.
|
||||
|
||||
sub mtr_full_hostname () {
|
||||
|
||||
my $hostname= hostname();
|
||||
if ( $hostname !~ /\./ )
|
||||
{
|
||||
my $address= gethostbyname($hostname)
|
||||
or die "Couldn't resolve $hostname : $!";
|
||||
my $fullname= gethostbyaddr($address, AF_INET);
|
||||
$hostname= $fullname if $fullname;
|
||||
}
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
# FIXME move to own lib
|
||||
|
||||
sub mtr_init_args ($) {
|
||||
my $args = shift;
|
||||
$$args = []; # Empty list
|
||||
}
|
||||
|
||||
sub mtr_add_arg ($$) {
|
||||
my $args= shift;
|
||||
my $format= shift;
|
||||
my @fargs = @_;
|
||||
|
||||
push(@$args, sprintf($format, @fargs));
|
||||
}
|
||||
|
||||
1;
|
||||
467
mysql-test/lib/mtr_process.pl
Normal file
467
mysql-test/lib/mtr_process.pl
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use Carp qw(cluck);
|
||||
use strict;
|
||||
|
||||
use POSIX ":sys_wait_h";
|
||||
|
||||
sub mtr_run ($$$$$$);
|
||||
sub mtr_spawn ($$$$$$);
|
||||
sub mtr_stop_mysqld_servers ($$);
|
||||
sub mtr_kill_leftovers ();
|
||||
|
||||
# static in C
|
||||
sub spawn_impl ($$$$$$$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Execute an external command
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# This function try to mimic the C version used in "netware/mysql_test_run.c"
|
||||
# FIXME learn it to handle append mode as well, a "new" flag or a "append"
|
||||
|
||||
sub mtr_run ($$$$$$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
|
||||
return spawn_impl($path,$arg_list_t,1,$input,$output,$error,$pid_file);
|
||||
}
|
||||
|
||||
sub mtr_spawn ($$$$$$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
|
||||
return spawn_impl($path,$arg_list_t,0,$input,$output,$error,$pid_file);
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# If $join is set, we return the error code, else we return the PID
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub spawn_impl ($$$$$$$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $join= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift; # FIXME
|
||||
|
||||
# FIXME really needing a PATH???
|
||||
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
|
||||
|
||||
$ENV{'TZ'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
|
||||
$ENV{'LC_COLLATE'}= "C";
|
||||
$ENV{'MYSQL_TEST_DIR'}= $::glob_mysql_test_dir;
|
||||
$ENV{'MASTER_MYPORT'}= $::opt_master_myport;
|
||||
$ENV{'SLAVE_MYPORT'}= $::opt_slave_myport;
|
||||
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
|
||||
$ENV{'MYSQL_TCP_PORT'}= 3306;
|
||||
$ENV{'MASTER_MYSOCK'}= $::master->[0]->{'path_mysock'};
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
print STDERR "\n";
|
||||
print STDERR "#### ", "-" x 78, "\n";
|
||||
print STDERR "#### ", "STDIN $input\n" if $input;
|
||||
print STDERR "#### ", "STDOUT $output\n" if $output;
|
||||
print STDERR "#### ", "STDERR $error\n" if $error;
|
||||
if ( $join )
|
||||
{
|
||||
print STDERR "#### ", "run";
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "#### ", "spawn";
|
||||
}
|
||||
print STDERR "$path ", join(" ",@$arg_list_t), "\n";
|
||||
print STDERR "#### ", "-" x 78, "\n";
|
||||
}
|
||||
|
||||
my $pid= fork();
|
||||
|
||||
if ( $pid )
|
||||
{
|
||||
# Parent, i.e. the main script
|
||||
if ( $join )
|
||||
{
|
||||
# We run a command and wait for the result
|
||||
# FIXME this need to be improved
|
||||
waitpid($pid,0);
|
||||
my $exit_value= $? >> 8;
|
||||
my $signal_num= $? & 127;
|
||||
my $dumped_core= $? & 128;
|
||||
if ( $signal_num )
|
||||
{
|
||||
mtr_error("spawn got signal $signal_num");
|
||||
}
|
||||
if ( $dumped_core )
|
||||
{
|
||||
mtr_error("spawn dumped core");
|
||||
}
|
||||
return $exit_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
# We spawned a process we don't wait for
|
||||
return $pid;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Child, redirect output and exec
|
||||
# FIXME I tried POSIX::setsid() here to detach and, I hoped,
|
||||
# avoid zombies. But everything went wild, somehow the parent
|
||||
# became a deamon as well, and was hard to kill ;-)
|
||||
# Need to catch SIGCHLD and do waitpid or something instead......
|
||||
|
||||
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
|
||||
|
||||
if ( $output )
|
||||
{
|
||||
if ( ! open(STDOUT,">",$output) )
|
||||
{
|
||||
mtr_error("can't redirect STDOUT to \"$output\": $!");
|
||||
}
|
||||
}
|
||||
if ( $error )
|
||||
{
|
||||
if ( $output eq $error )
|
||||
{
|
||||
if ( ! open(STDERR,">&STDOUT") )
|
||||
{
|
||||
mtr_error("can't dup STDOUT: $!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! open(STDERR,">",$error) )
|
||||
{
|
||||
mtr_error("can't redirect STDERR to \"$output\": $!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $input )
|
||||
{
|
||||
if ( ! open(STDIN,"<",$input) )
|
||||
{
|
||||
mtr_error("can't redirect STDIN to \"$input\": $!");
|
||||
}
|
||||
}
|
||||
exec($path,@$arg_list_t);
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Kill processes left from previous runs
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_kill_leftovers () {
|
||||
|
||||
# First, kill all masters and slaves that would conflict with
|
||||
# this run. Make sure to remove the PID file, if any.
|
||||
|
||||
my @args;
|
||||
|
||||
for ( my $idx; $idx < 2; $idx++ )
|
||||
{
|
||||
push(@args,{
|
||||
pid => 0, # We don't know the PID
|
||||
pidfile => $::master->[$idx]->{'path_mypid'},
|
||||
sockfile => $::master->[$idx]->{'path_mysock'},
|
||||
port => $::master->[$idx]->{'path_myport'},
|
||||
});
|
||||
}
|
||||
|
||||
for ( my $idx; $idx < 3; $idx++ )
|
||||
{
|
||||
push(@args,{
|
||||
pid => 0, # We don't know the PID
|
||||
pidfile => $::slave->[$idx]->{'path_mypid'},
|
||||
sockfile => $::slave->[$idx]->{'path_mysock'},
|
||||
port => $::slave->[$idx]->{'path_myport'},
|
||||
});
|
||||
}
|
||||
|
||||
mtr_stop_mysqld_servers(\@args, 1);
|
||||
|
||||
# We scan the "var/run/" directory for other process id's to kill
|
||||
my $rundir= "$::glob_mysql_test_dir/var/run"; # FIXME $path_run_dir or something
|
||||
|
||||
if ( -d $rundir )
|
||||
{
|
||||
opendir(RUNDIR, $rundir)
|
||||
or mtr_error("can't open directory \"$rundir\": $!");
|
||||
|
||||
my @pids;
|
||||
|
||||
while ( my $elem= readdir(RUNDIR) )
|
||||
{
|
||||
my $pidfile= "$rundir/$elem";
|
||||
|
||||
if ( -f $pidfile )
|
||||
{
|
||||
my $pid= mtr_get_pid_from_file($pidfile);
|
||||
if ( ! unlink($pidfile) )
|
||||
{
|
||||
mtr_error("can't remove $pidfile");
|
||||
}
|
||||
push(@pids, $pid);
|
||||
}
|
||||
}
|
||||
closedir(RUNDIR);
|
||||
|
||||
start_reap_all();
|
||||
|
||||
if ( $::glob_cygwin_perl )
|
||||
{
|
||||
# We have no (easy) way of knowing the Cygwin controlling
|
||||
# process, in the PID file we only have the Windows process id.
|
||||
system("kill -f " . join(" ",@pids)); # Hope for the best....
|
||||
}
|
||||
else
|
||||
{
|
||||
my $retries= 10; # 10 seconds
|
||||
do
|
||||
{
|
||||
kill(9, @pids);
|
||||
} while ( $retries-- and kill(0, @pids) );
|
||||
|
||||
if ( kill(0, @pids) )
|
||||
{
|
||||
mtr_error("can't kill processes " . join(" ", @pids));
|
||||
}
|
||||
}
|
||||
|
||||
stop_reap_all();
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Shut down mysqld servers
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# To speed things we kill servers in parallel.
|
||||
# The argument is a list of 'pidfiles' and 'socketfiles'.
|
||||
# We use the pidfiles and socketfiles to try to terminate the servers.
|
||||
# This is not perfect, there could still be other server processes
|
||||
# left.
|
||||
|
||||
# Force flag is to be set only for killing mysqld servers this script
|
||||
# didn't create in this run, i.e. initial cleanup before we start working.
|
||||
# If force flag is set, we try to kill all with mysqladmin, and
|
||||
# give up if we have no PIDs.
|
||||
|
||||
# FIXME On some operating systems, $srv->{'pid'} and $srv->{'pidfile'}
|
||||
# will not be the same PID. We need to try to kill both I think.
|
||||
|
||||
sub mtr_stop_mysqld_servers ($$) {
|
||||
my $spec= shift;
|
||||
my $force= shift;
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If the process was not started from this file, we got no PID,
|
||||
# we try to find it in the PID file.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
my $any_pid= 0; # If we have any PIDs
|
||||
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( ! $srv->{'pid'} and -f $srv->{'pidfile'} )
|
||||
{
|
||||
$srv->{'pid'}= mtr_get_pid_from_file($srv->{'pidfile'});
|
||||
}
|
||||
if ( $srv->{'pid'} )
|
||||
{
|
||||
$any_pid= 1;
|
||||
}
|
||||
}
|
||||
|
||||
# If the processes where started from this script, and we know
|
||||
# no PIDs, then we don't have to do anything.
|
||||
|
||||
if ( ! $any_pid and ! $force )
|
||||
{
|
||||
# cluck "This is how we got here!";
|
||||
return;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# First try nice normal shutdown using 'mysqladmin'
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
start_reap_all(); # Don't require waitpid() of children
|
||||
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( -e $srv->{'sockfile'} or $srv->{'port'} )
|
||||
{
|
||||
# FIXME wrong log.....
|
||||
# FIXME, stderr.....
|
||||
# Shutdown time must be high as slave may be in reconnect
|
||||
my $args;
|
||||
|
||||
mtr_init_args(\$args);
|
||||
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "-uroot");
|
||||
if ( -e $srv->{'sockfile'} )
|
||||
{
|
||||
mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
|
||||
}
|
||||
if ( $srv->{'port'} )
|
||||
{
|
||||
mtr_add_arg($args, "--port=%s", $srv->{'port'});
|
||||
}
|
||||
mtr_add_arg($args, "--connect_timeout=5");
|
||||
mtr_add_arg($args, "--shutdown_timeout=70");
|
||||
mtr_add_arg($args, "shutdown");
|
||||
# We don't wait for termination of mysqladmin
|
||||
mtr_spawn($::exe_mysqladmin, $args,
|
||||
"", $::path_manager_log, $::path_manager_log, "");
|
||||
}
|
||||
}
|
||||
|
||||
# Wait for them all to remove their pid and socket file
|
||||
|
||||
PIDSOCKFILEREMOVED:
|
||||
for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
|
||||
{
|
||||
my $pidsockfiles_left= 0;
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( -e $srv->{'sockfile'} or -f $srv->{'pidfile'} )
|
||||
{
|
||||
$pidsockfiles_left++; # Could be that pidfile is left
|
||||
}
|
||||
}
|
||||
if ( ! $pidsockfiles_left )
|
||||
{
|
||||
last PIDSOCKFILEREMOVED;
|
||||
}
|
||||
mtr_debug("Sleep for 1 second waiting for pid and socket file removal");
|
||||
sleep(1); # One second
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If no known PIDs, we have nothing more to try
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
if ( ! $any_pid )
|
||||
{
|
||||
stop_reap_all();
|
||||
return;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# We may have killed all that left a socket, but we are not sure we got
|
||||
# them all killed. If we suspect it lives, try nice kill with SIG_TERM.
|
||||
# Note that for true Win32 processes, kill(0,$pid) will not return 1.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
SIGNAL:
|
||||
foreach my $sig (15,9)
|
||||
{
|
||||
my $process_left= 0;
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( $srv->{'pid'} and
|
||||
( -f $srv->{'pidfile'} or kill(0,$srv->{'pid'}) ) )
|
||||
{
|
||||
$process_left++;
|
||||
mtr_warning("process $srv->{'pid'} not cooperating, " .
|
||||
"will send signal $sig to process");
|
||||
kill($sig,$srv->{'pid'}); # SIG_TERM
|
||||
}
|
||||
if ( ! $process_left )
|
||||
{
|
||||
last SIGNAL;
|
||||
}
|
||||
}
|
||||
mtr_debug("Sleep for 5 seconds waiting for processes to die");
|
||||
sleep(5); # We wait longer than usual
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Now, we check if all we can find using kill(0,$pid) are dead,
|
||||
# and just assume the rest are. We cleanup socket and PID files.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
{
|
||||
my $errors= 0;
|
||||
foreach my $srv ( @$spec )
|
||||
{
|
||||
if ( $srv->{'pid'} )
|
||||
{
|
||||
if ( kill(0,$srv->{'pid'}) )
|
||||
{
|
||||
# FIXME In Cygwin there seem to be some fast reuse
|
||||
# of PIDs, so dying may not be the right thing to do.
|
||||
$errors++;
|
||||
mtr_warning("can't kill process $srv->{'pid'}");
|
||||
}
|
||||
else
|
||||
{
|
||||
# We managed to kill it at last
|
||||
# FIXME In Cygwin, we will get here even if the process lives.
|
||||
|
||||
# Not needed as we know the process is dead, but to be safe
|
||||
# we unlink and check success in two steps. We first unlink
|
||||
# without checking the error code, and then check if the
|
||||
# file still exists.
|
||||
|
||||
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
|
||||
{
|
||||
unlink($file);
|
||||
if ( -e $file )
|
||||
{
|
||||
$errors++;
|
||||
mtr_warning("couldn't delete $file");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $errors )
|
||||
{
|
||||
# We are in trouble, just die....
|
||||
mtr_error("we could not kill or clean up all processes");
|
||||
}
|
||||
}
|
||||
|
||||
stop_reap_all();
|
||||
|
||||
# FIXME We just assume they are all dead, we don't know....
|
||||
}
|
||||
|
||||
sub start_reap_all {
|
||||
$SIG{CHLD}= 'IGNORE'; # FIXME is this enough?
|
||||
}
|
||||
|
||||
sub stop_reap_all {
|
||||
$SIG{CHLD}= 'DEFAULT';
|
||||
}
|
||||
|
||||
1;
|
||||
262
mysql-test/lib/mtr_report.pl
Normal file
262
mysql-test/lib/mtr_report.pl
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
# -*- cperl -*-
|
||||
|
||||
# This is a library file used by the Perl version of mysql-test-run,
|
||||
# and is part of the translation of the Bourne shell script with the
|
||||
# same name.
|
||||
|
||||
use strict;
|
||||
|
||||
sub mtr_report_test_name($);
|
||||
sub mtr_report_test_passed($);
|
||||
sub mtr_report_test_failed($);
|
||||
sub mtr_report_test_skipped($);
|
||||
|
||||
sub mtr_show_failed_diff ($);
|
||||
sub mtr_report_stats ($);
|
||||
sub mtr_print_line ();
|
||||
sub mtr_print_thick_line ();
|
||||
sub mtr_print_header ();
|
||||
sub mtr_report (@);
|
||||
sub mtr_warning (@);
|
||||
sub mtr_error (@);
|
||||
sub mtr_debug (@);
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# We can't use diff -u or diff -a as these are not portable
|
||||
|
||||
sub mtr_show_failed_diff ($) {
|
||||
my $tname= shift;
|
||||
|
||||
my $reject_file= "r/$tname.reject";
|
||||
my $result_file= "r/$tname.result";
|
||||
my $eval_file= "r/$tname.eval";
|
||||
|
||||
if ( -f $eval_file )
|
||||
{
|
||||
$result_file= $eval_file;
|
||||
}
|
||||
elsif ( $::opt_result_ext and
|
||||
( $::opt_record or -f "$result_file$::opt_result_ext" ))
|
||||
{
|
||||
# If we have an special externsion for result files we use it if we are
|
||||
# recording or a result file with that extension exists.
|
||||
$result_file= "$result_file$::opt_result_ext";
|
||||
}
|
||||
|
||||
if ( -f $reject_file )
|
||||
{
|
||||
print "Below are the diffs between actual and expected results:\n";
|
||||
print "-------------------------------------------------------\n";
|
||||
# FIXME check result code?!
|
||||
mtr_run("diff",["-c",$result_file,$reject_file], "", "", "", "");
|
||||
print "-------------------------------------------------------\n";
|
||||
print "Please follow the instructions outlined at\n";
|
||||
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
|
||||
print "to find the reason to this problem and how to report this.\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub mtr_report_test_name ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
printf "%-31s ", $tinfo->{'name'};
|
||||
}
|
||||
|
||||
sub mtr_report_test_skipped ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
|
||||
print "[ skipped ]\n";
|
||||
}
|
||||
|
||||
sub mtr_report_test_passed ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
my $timer= "";
|
||||
# FIXME
|
||||
# if ( $::opt_timer and -f "$::glob_mysql_test_dir/var/log/timer" )
|
||||
# {
|
||||
# $timer= `cat var/log/timer`;
|
||||
# $timer= sprintf "%13s", $timer;
|
||||
# }
|
||||
$tinfo->{'result'}= 'MTR_RES_PASSED';
|
||||
print "[ pass ] $timer\n";
|
||||
}
|
||||
|
||||
sub mtr_report_test_failed ($) {
|
||||
my $tinfo= shift;
|
||||
|
||||
$tinfo->{'result'}= 'MTR_RES_FAILED';
|
||||
print "[ fail ]\n";
|
||||
|
||||
print "Errors are (from $::path_timefile) :\n";
|
||||
print mtr_fromfile($::path_timefile); # FIXME print_file() instead
|
||||
print "\n(the last lines may be the most important ones)\n";
|
||||
}
|
||||
|
||||
sub mtr_report_stats ($) {
|
||||
my $tests= shift;
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Find out how we where doing
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
my $tot_skiped= 0;
|
||||
my $tot_passed= 0;
|
||||
my $tot_failed= 0;
|
||||
my $tot_tests= 0;
|
||||
|
||||
foreach my $tinfo (@$tests)
|
||||
{
|
||||
if ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
|
||||
{
|
||||
$tot_skiped++;
|
||||
}
|
||||
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
|
||||
{
|
||||
$tot_tests++;
|
||||
$tot_passed++;
|
||||
}
|
||||
elsif ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
|
||||
{
|
||||
$tot_tests++;
|
||||
$tot_failed++;
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Print out a summary report to screen
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
if ( ! $tot_failed )
|
||||
{
|
||||
print "All $tot_tests tests were successful.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
my $ratio= $tot_passed * 100 / $tot_tests;
|
||||
printf "Failed $tot_failed/$tot_tests tests, " .
|
||||
"%.2f\% successful.\n\n", $ratio;
|
||||
print
|
||||
"The log files in var/log may give you some hint\n",
|
||||
"of what when wrong.\n",
|
||||
"If you want to report this error, please read first ",
|
||||
"the documentation at\n",
|
||||
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
if ( ! $::glob_use_running_server )
|
||||
{
|
||||
|
||||
# Report if there was any fatal warnings/errors in the log files
|
||||
#
|
||||
unlink("$::glob_mysql_test_dir/var/log/warnings");
|
||||
unlink("$::glob_mysql_test_dir/var/log/warnings.tmp");
|
||||
# Remove some non fatal warnings from the log files
|
||||
|
||||
# FIXME what is going on ????? ;-)
|
||||
# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
|
||||
# var/log/*.err \
|
||||
# | sed -e 's!Warning: Table:.* on rename!!g' \
|
||||
# > var/log/warnings.tmp;
|
||||
#
|
||||
# found_error=0;
|
||||
# # Find errors
|
||||
# for i in "^Warning:" "^Error:" "^==.* at 0x"
|
||||
# do
|
||||
# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings )
|
||||
# {
|
||||
# found_error=1
|
||||
# }
|
||||
# done
|
||||
# unlink("$::glob_mysql_test_dir/var/log/warnings.tmp");
|
||||
# if ( $found_error= "1" )
|
||||
# {
|
||||
# print "WARNING: Got errors/warnings while running tests. Please examine\n"
|
||||
# print "$::glob_mysql_test_dir/var/log/warnings for details.\n"
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
if ( $tot_failed != 0 )
|
||||
{
|
||||
print "mysql-test-run: *** Failing the test(s):";
|
||||
|
||||
foreach my $tinfo (@$tests)
|
||||
{
|
||||
if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
|
||||
{
|
||||
print " $tinfo->{'name'}";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
mtr_error("there where failing test cases");
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Text formatting
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_print_line () {
|
||||
print '-' x 55, "\n";
|
||||
}
|
||||
|
||||
sub mtr_print_thick_line () {
|
||||
print '=' x 55, "\n";
|
||||
}
|
||||
|
||||
sub mtr_print_header () {
|
||||
print "\n";
|
||||
if ( $::opt_timer )
|
||||
{
|
||||
print "TEST RESULT TIME (ms)\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "TEST RESULT\n";
|
||||
}
|
||||
mtr_print_line();
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub mtr_report (@) {
|
||||
print join(" ", @_),"\n";
|
||||
}
|
||||
|
||||
sub mtr_warning (@) {
|
||||
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
|
||||
}
|
||||
|
||||
sub mtr_error (@) {
|
||||
die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
|
||||
}
|
||||
|
||||
sub mtr_debug (@) {
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
print STDERR "####: ",join(" ", @_),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -327,7 +327,7 @@ int spawn(char *path, arg_list_t *al, int join, char *input,
|
|||
int spawn(char *path, arg_list_t *al, int join, char *input,
|
||||
char *output, char *error, HANDLE *pid)
|
||||
{
|
||||
intptr_t result;
|
||||
bool result;
|
||||
int i;
|
||||
STARTUPINFO startup_info;
|
||||
PROCESS_INFORMATION process_information;
|
||||
|
|
@ -665,7 +665,11 @@ void del_tree(char *dir)
|
|||
rmdir(dir);
|
||||
#else
|
||||
struct _finddata_t parent;
|
||||
#if defined(_MSC_VER) && _MSC_VER > 1200
|
||||
intptr_t handle;
|
||||
#else
|
||||
long handle;
|
||||
#endif /* _MSC_VER && _MSC_VER > 1200 */
|
||||
char temp[FN_REFLEN];
|
||||
char mask[FN_REFLEN];
|
||||
|
||||
|
|
@ -728,7 +732,11 @@ int removef(const char *format, ...)
|
|||
va_list ap;
|
||||
char path[FN_REFLEN];
|
||||
struct _finddata_t parent;
|
||||
#if defined(_MSC_VER) && _MSC_VER > 1200
|
||||
intptr_t handle;
|
||||
#else
|
||||
long handle;
|
||||
#endif /* _MSC_VER && _MSC_VER > 1200 */
|
||||
char temp[FN_REFLEN];
|
||||
char *p;
|
||||
|
||||
|
|
|
|||
2182
mysql-test/mysql-test-run.pl
Executable file
2182
mysql-test/mysql-test-run.pl
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -596,7 +596,8 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=
|
|||
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
|
||||
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
|
||||
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR TESTS_BINDIR
|
||||
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
|
||||
export CLIENT_BINDIR TESTS_BINDIR CHARSETSDIR
|
||||
export NDB_TOOLS_DIR
|
||||
|
||||
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@
|
|||
#include <sys/mode.h>
|
||||
#endif
|
||||
#ifdef __WIN__
|
||||
#include <Shlwapi.h>
|
||||
#include <windows.h>
|
||||
#include <shlwapi.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -89,15 +90,25 @@ static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
|
|||
static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
|
||||
#endif
|
||||
|
||||
#define MAX_COUNT_TESTES 1024
|
||||
|
||||
#ifdef __WIN__
|
||||
# define sting_compare_func _stricmp
|
||||
#else
|
||||
# ifdef HAVE_STRCASECMP
|
||||
# define sting_compare_func strcasecmp
|
||||
# else
|
||||
# define sting_compare_func strcmp
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* comma delimited list of tests to skip or empty string */
|
||||
#ifndef __WIN__
|
||||
static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
|
||||
#else
|
||||
/*
|
||||
The most ignore testes contain the calls of system command
|
||||
*/
|
||||
#define MAX_COUNT_TESTES 1024
|
||||
/*
|
||||
|
||||
lowercase_table3 is disabled by Gerg
|
||||
system_mysql_db_fix is disabled by Gerg
|
||||
sp contains a command system
|
||||
|
|
@ -1437,12 +1448,11 @@ void setup(char *file __attribute__((unused)))
|
|||
/*
|
||||
Compare names of testes for right order
|
||||
*/
|
||||
#ifdef __WIN__
|
||||
int compare( const void *arg1, const void *arg2 )
|
||||
{
|
||||
return _stricmp( * ( char** ) arg1, * ( char** ) arg2 );
|
||||
return sting_compare_func( * ( char** ) arg1, * ( char** ) arg2 );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -1454,6 +1464,10 @@ int compare( const void *arg1, const void *arg2 )
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
int is_ignore_list= 0;
|
||||
char **names= 0;
|
||||
char **testes= 0;
|
||||
int name_index;
|
||||
int index;
|
||||
/* setup */
|
||||
setup(argv[0]);
|
||||
|
||||
|
|
@ -1517,6 +1531,11 @@ int main(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
/* run all tests */
|
||||
testes= malloc(MAX_COUNT_TESTES*sizeof(void*));
|
||||
if (!testes)
|
||||
die("can not allcate memory for sorting");
|
||||
names= testes;
|
||||
name_index= 0;
|
||||
#ifndef __WIN__
|
||||
struct dirent *entry;
|
||||
DIR *parent;
|
||||
|
|
@ -1534,74 +1553,79 @@ int main(int argc, char **argv)
|
|||
/* find the test suffix */
|
||||
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
|
||||
{
|
||||
/* null terminate at the suffix */
|
||||
*(test + position - 1)= '\0';
|
||||
/* run test */
|
||||
run_test(test);
|
||||
if (name_index < MAX_COUNT_TESTES)
|
||||
{
|
||||
/* null terminate at the suffix */
|
||||
*(test + position - 1)= '\0';
|
||||
/* insert test */
|
||||
*names= malloc(FN_REFLEN);
|
||||
strcpy(*names,test);
|
||||
names++;
|
||||
name_index++;
|
||||
}
|
||||
else
|
||||
die("can not sort files, array is overloaded");
|
||||
}
|
||||
}
|
||||
closedir(parent);
|
||||
}
|
||||
#else
|
||||
struct _finddata_t dir;
|
||||
intptr_t handle;
|
||||
char test[FN_LEN];
|
||||
char mask[FN_REFLEN];
|
||||
char *p;
|
||||
int position;
|
||||
char **names= 0;
|
||||
char **testes= 0;
|
||||
int name_index;
|
||||
int index;
|
||||
|
||||
/* single test */
|
||||
single_test= FALSE;
|
||||
|
||||
snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
|
||||
|
||||
if ((handle=_findfirst(mask,&dir)) == -1L)
|
||||
{
|
||||
die("Unable to open tests directory.");
|
||||
}
|
||||
struct _finddata_t dir;
|
||||
int* handle;
|
||||
char test[FN_LEN];
|
||||
char mask[FN_REFLEN];
|
||||
char *p;
|
||||
int position;
|
||||
|
||||
names= malloc(MAX_COUNT_TESTES*4);
|
||||
testes= names;
|
||||
name_index= 0;
|
||||
/* single test */
|
||||
single_test= FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if (!(dir.attrib & _A_SUBDIR))
|
||||
snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
|
||||
|
||||
if ((handle=_findfirst(mask,&dir)) == -1L)
|
||||
{
|
||||
strcpy(test, strlwr(dir.name));
|
||||
|
||||
/* find the test suffix */
|
||||
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
|
||||
{
|
||||
p= test + position - 1;
|
||||
/* null terminate at the suffix */
|
||||
*p= 0;
|
||||
|
||||
/* insert test */
|
||||
*names= malloc(FN_REFLEN);
|
||||
strcpy(*names,test);
|
||||
names++;
|
||||
name_index++;
|
||||
}
|
||||
die("Unable to open tests directory.");
|
||||
}
|
||||
}while (_findnext(handle,&dir) == 0);
|
||||
|
||||
_findclose(handle);
|
||||
|
||||
do
|
||||
{
|
||||
if (!(dir.attrib & _A_SUBDIR))
|
||||
{
|
||||
strcpy(test, strlwr(dir.name));
|
||||
|
||||
/* find the test suffix */
|
||||
if ((position= strinstr(test, TEST_SUFFIX)) != 0)
|
||||
{
|
||||
if (name_index < MAX_COUNT_TESTES)
|
||||
{
|
||||
/* null terminate at the suffix */
|
||||
*(test + position - 1)= '\0';
|
||||
/* insert test */
|
||||
*names= malloc(FN_REFLEN);
|
||||
strcpy(*names,test);
|
||||
names++;
|
||||
name_index++;
|
||||
}
|
||||
else
|
||||
die("can not sort files, array is overloaded");
|
||||
}
|
||||
}
|
||||
}while (_findnext(handle,&dir) == 0);
|
||||
|
||||
_findclose(handle);
|
||||
}
|
||||
#endif
|
||||
qsort( (void *)testes, name_index, sizeof( char * ), compare );
|
||||
|
||||
for (index= 0; index <= name_index; index++)
|
||||
for (index= 0; index < name_index; index++)
|
||||
{
|
||||
run_test(testes[index]);
|
||||
free(testes[index]);
|
||||
}
|
||||
|
||||
free(testes);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* stop server */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2'
|
||||
ERROR 42000: 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=_binary'mysqltest_1';
|
||||
drop database mysqltest;
|
||||
|
|
|
|||
|
|
@ -178,3 +178,12 @@ aaa aa
|
|||
aab aa
|
||||
aac aa
|
||||
DROP TABLE t1;
|
||||
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
|
||||
date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
|
||||
2004-12-30 00:00:00
|
||||
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
|
||||
timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
|
||||
00:00:00
|
||||
select timediff(cast('1 12:00:00' as time), '12:00:00');
|
||||
timediff(cast('1 12:00:00' as time), '12:00:00')
|
||||
24:00:00
|
||||
|
|
|
|||
|
|
@ -63,8 +63,4 @@ a0
|
|||
select 'a' union select concat('a', -0.0);
|
||||
a
|
||||
a
|
||||
a-0.0
|
||||
select 'a' union select concat('a', -0.0000);
|
||||
a
|
||||
a
|
||||
a-0.0000
|
||||
good
|
||||
|
|
|
|||
|
|
@ -691,3 +691,15 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de
|
|||
total reg
|
||||
10 2004-12-10
|
||||
drop table t1;
|
||||
select quote(ltrim(concat(' ', 'a')));
|
||||
quote(ltrim(concat(' ', 'a')))
|
||||
'a'
|
||||
select quote(trim(concat(' ', 'a')));
|
||||
quote(trim(concat(' ', 'a')))
|
||||
'a'
|
||||
select trim(null from 'kate') as "must_be_null";
|
||||
must_be_null
|
||||
NULL
|
||||
select trim('xyz' from null) as "must_be_null";
|
||||
must_be_null
|
||||
NULL
|
||||
|
|
|
|||
|
|
@ -474,12 +474,15 @@ unix_timestamp(@a)
|
|||
select unix_timestamp('1969-12-01 19:00:01');
|
||||
unix_timestamp('1969-12-01 19:00:01')
|
||||
0
|
||||
select from_unixtime(0);
|
||||
from_unixtime(0)
|
||||
select from_unixtime(-1);
|
||||
from_unixtime(-1)
|
||||
NULL
|
||||
select from_unixtime(2145916800);
|
||||
from_unixtime(2145916800)
|
||||
NULL
|
||||
select from_unixtime(0);
|
||||
from_unixtime(0)
|
||||
1970-01-01 03:00:00
|
||||
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
|
||||
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
|
||||
SELECT * from t1;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,28 @@ Grants for mysqltest_1@localhost
|
|||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
|
||||
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 20 30
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ show grants for current_user();
|
|||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
use mysqltest;
|
||||
insert into t1 values (1, 'I can''t change it!');
|
||||
update t1 set data='I can change it!' where id = 1;
|
||||
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
|
||||
|
|
@ -47,8 +46,20 @@ select * from t1;
|
|||
id data
|
||||
1 I can't change it!
|
||||
drop table t1;
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
create table t1 (a int, b int);
|
||||
grant select (a) on t1 to mysqltest_1@localhost with grant option;
|
||||
grant select (a,b) on t1 to mysqltest_2@localhost;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
|
||||
grant select on t1 to mysqltest_3@localhost;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
drop table t1;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ a b c a
|
|||
1 1 1 test.t1
|
||||
2 2 2 test.t1
|
||||
select * from t2;
|
||||
ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't2'
|
||||
ERROR 42000: 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
|
||||
|
|
@ -148,7 +148,7 @@ select "user3";
|
|||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
|
@ -156,7 +156,7 @@ a
|
|||
select c from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
|
||||
select * from t2;
|
||||
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't2'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2'
|
||||
select mysqltest.t1.c from test.t1,mysqltest.t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
|
||||
show status like "Qcache_queries_in_cache";
|
||||
|
|
|
|||
|
|
@ -675,4 +675,9 @@ a b c
|
|||
1 2 0
|
||||
1 1 1
|
||||
1 1 0
|
||||
show index from t3;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t3 1 a 1 a A NULL NULL NULL YES BTREE
|
||||
t3 1 a 2 b A NULL NULL NULL YES BTREE
|
||||
t3 1 a 3 c A NULL NULL NULL YES BTREE
|
||||
drop table t1, t2, t3;
|
||||
|
|
|
|||
|
|
@ -480,3 +480,36 @@ UNLOCK TABLES;
|
|||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (4),(5),(6);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
|
||||
LOCK TABLES `t2` WRITE;
|
||||
INSERT INTO `t2` VALUES (4),(5),(6);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ execute s_t9 ;
|
|||
my_col
|
||||
1
|
||||
select a as my_col from t1;
|
||||
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
|
||||
grant select on mysqltest.t1 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
|
@ -873,7 +873,7 @@ Grants for second_user@localhost
|
|||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
execute s_t1 ;
|
||||
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
|
||||
revoke all privileges, grant option from second_user@localhost ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
|
|
|
|||
|
|
@ -3027,7 +3027,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -3010,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -3011,7 +3011,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -2947,7 +2947,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
@ -5957,7 +5957,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -3010,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -3010,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
|
|||
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
|
||||
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,7 @@ Note 1003 (select test.t1.s1 AS `s1` from test.t1)
|
|||
s1
|
||||
tttt
|
||||
drop table t1;
|
||||
create table t1 (s1 char(5), index s1(s1));
|
||||
create table t1 (s1 char(5) not null, index s1(s1));
|
||||
create table t2 (s1 char(5), index s1(s1));
|
||||
insert into t1 values ('a1'),('a2'),('a3');
|
||||
insert into t2 values ('a1'),('a2');
|
||||
|
|
@ -1451,25 +1451,25 @@ a2 1
|
|||
a3 1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
|
||||
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
|
||||
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
|
||||
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
|
||||
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
|
||||
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
|
||||
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
|
||||
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
|
||||
|
|
@ -2125,3 +2125,30 @@ SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1
|
|||
c
|
||||
Oceania
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( f1 BIGINT );
|
||||
INSERT INTO t1 SET f1= NULL;
|
||||
INSERT INTO t1 SET f1= 1;
|
||||
CREATE TABLE t2 ( f1 BIGINT );
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 );
|
||||
f1
|
||||
NULL
|
||||
1
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 WHERE f1 > 2 );
|
||||
f1
|
||||
NULL
|
||||
1
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 WHERE f1 > 2
|
||||
UNION
|
||||
SELECT f1 FROM t2 WHERE f1 > 3);
|
||||
f1
|
||||
NULL
|
||||
1
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT SUM(f1) AS sf1 FROM t2 HAVING sf1 > 10000);
|
||||
f1
|
||||
NULL
|
||||
1
|
||||
|
|
|
|||
|
|
@ -295,9 +295,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
|
|||
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
|
||||
where t1.a = t2.c and t2.d = (select max(d) from t2);
|
||||
select * from mysql.time_zone_name;
|
||||
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
|
||||
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
|
||||
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
|
|
|
|||
|
|
@ -143,3 +143,13 @@ t
|
|||
0000-00-00 00:00:00
|
||||
2003-01-01 00:00:00
|
||||
drop table t1;
|
||||
create table t1 (dt datetime);
|
||||
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
|
||||
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
|
||||
select * from t1;
|
||||
dt
|
||||
2012-00-00 00:00:00
|
||||
2000-00-00 01:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
drop table t1;
|
||||
|
|
|
|||
|
|
@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
|
|||
show variables like 'concurrent_insert';
|
||||
Variable_name Value
|
||||
concurrent_insert ON
|
||||
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
|
||||
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
|
||||
show local variables like 'storage_engine';
|
||||
Variable_name Value
|
||||
storage_engine HEAP
|
||||
show global variables like 'storage_engine';
|
||||
Variable_name Value
|
||||
storage_engine InnoDB
|
||||
storage_engine MERGE
|
||||
set GLOBAL query_cache_size=100000;
|
||||
set GLOBAL myisam_max_sort_file_size=2000000;
|
||||
show global variables like 'myisam_max_sort_file_size';
|
||||
|
|
@ -220,7 +220,7 @@ set max_join_size="hello";
|
|||
ERROR 42000: Incorrect argument type to variable 'max_join_size'
|
||||
set storage_engine=UNKNOWN_TABLE_TYPE;
|
||||
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
|
||||
set storage_engine=INNODB, big_tables=2;
|
||||
set storage_engine=MERGE, big_tables=2;
|
||||
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
|
||||
show local variables like 'storage_engine';
|
||||
Variable_name Value
|
||||
|
|
|
|||
|
|
@ -108,3 +108,13 @@ SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
|
|||
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
|
||||
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test for bug #6914 "Problems using time()/date() output in expressions".
|
||||
# When we are casting datetime value to DATE/TIME we should throw away
|
||||
# time/date parts (correspondingly).
|
||||
#
|
||||
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
|
||||
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
|
||||
# Still we should not throw away "days" part of time value
|
||||
select timediff(cast('1 12:00:00' as time), '12:00:00');
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ select 'a' union select concat('a', -'3');
|
|||
select 'a' union select concat('a', -concat('3',4));
|
||||
|
||||
select 'a' union select concat('a', -0);
|
||||
|
||||
--replace_result 'a-0.0' good 'a0.0' good
|
||||
select 'a' union select concat('a', -0.0);
|
||||
|
||||
select 'a' union select concat('a', -0.0000);
|
||||
|
||||
|
|
|
|||
|
|
@ -429,3 +429,17 @@ create table t1 (a int not null primary key, b varchar(40), c datetime);
|
|||
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
|
||||
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
|
||||
drop table t1;
|
||||
# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
|
||||
# Bug #7495
|
||||
#
|
||||
|
||||
select quote(ltrim(concat(' ', 'a')));
|
||||
select quote(trim(concat(' ', 'a')));
|
||||
|
||||
#
|
||||
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
|
||||
# According to ANSI if one of the TRIM arguments is NULL, then the result
|
||||
# must be NULL too.
|
||||
#
|
||||
select trim(null from 'kate') as "must_be_null";
|
||||
select trim('xyz' from null) as "must_be_null";
|
||||
|
|
|
|||
|
|
@ -231,10 +231,14 @@ select unix_timestamp('1969-12-01 19:00:01');
|
|||
|
||||
#
|
||||
# Test for bug #6439 "unix_timestamp() function returns wrong datetime
|
||||
# values for too big argument". It should return error instead.
|
||||
# values for too big argument" and bug #7515 "from_unixtime(0) now
|
||||
# returns NULL instead of the epoch". unix_timestamp() should return error
|
||||
# for too big or negative argument. It should return Epoch value for zero
|
||||
# argument since it seems that many user's rely on this fact.
|
||||
#
|
||||
select from_unixtime(0);
|
||||
select from_unixtime(-1);
|
||||
select from_unixtime(2145916800);
|
||||
select from_unixtime(0);
|
||||
|
||||
#
|
||||
# Test types from + INTERVAL
|
||||
|
|
|
|||
|
|
@ -32,6 +32,23 @@ show grants for mysqltest_1@localhost;
|
|||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
|
||||
#
|
||||
# Test of GRANTS specifying user limits
|
||||
#
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
show grants for mysqltest_1@localhost;
|
||||
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
show grants for mysqltest_1@localhost;
|
||||
# This is just to double check that one won't ignore results of selects
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
|
||||
#
|
||||
# Test that the new db privileges are stored/retrieved correctly
|
||||
#
|
||||
|
|
|
|||
|
|
@ -50,10 +50,9 @@ flush privileges;
|
|||
use mysqltest;
|
||||
create table t1 (id int primary key, data varchar(255));
|
||||
|
||||
connect (mrbad, localhost, mysqltest_1,,);
|
||||
connect (mrbad, localhost, mysqltest_1,,mysqltest);
|
||||
connection mrbad;
|
||||
show grants for current_user();
|
||||
use mysqltest;
|
||||
insert into t1 values (1, 'I can''t change it!');
|
||||
--error 1044
|
||||
update t1 set data='I can change it!' where id = 1;
|
||||
|
|
@ -61,11 +60,32 @@ update t1 set data='I can change it!' where id = 1;
|
|||
--error 1044
|
||||
insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
|
||||
select * from t1;
|
||||
disconnect mrbad;
|
||||
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
|
||||
create table t1 (a int, b int);
|
||||
grant select (a) on t1 to mysqltest_1@localhost with grant option;
|
||||
connect (mrugly, localhost, mysqltest_1,,mysqltest);
|
||||
connection mrugly;
|
||||
--error 1143
|
||||
grant select (a,b) on t1 to mysqltest_2@localhost;
|
||||
--error 1142
|
||||
grant select on t1 to mysqltest_3@localhost;
|
||||
disconnect mrugly;
|
||||
|
||||
connection default;
|
||||
drop table t1;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
|
||||
|
|
|
|||
|
|
@ -301,5 +301,8 @@ select a,b,c from t3 force index (a) where a=1 order by a,b,c;
|
|||
explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
|
||||
select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
|
||||
|
||||
# BUG#7377 SHOW index on MERGE table crashes debug server
|
||||
show index from t3;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2
|
|||
drop table t1,t2;
|
||||
|
||||
# Test for BUG#5837 - delete with outer join and const tables
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
aclid bigint not null primary key,
|
||||
status tinyint(1) not null
|
||||
|
|
@ -442,6 +443,7 @@ create table t2 (
|
|||
refid bigint not null primary key,
|
||||
aclid bigint, index idx_acl(aclid)
|
||||
) engine = innodb;
|
||||
--enable_warnings
|
||||
insert into t2 values(1,null);
|
||||
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
|
||||
drop table t1, t2;
|
||||
|
|
|
|||
|
|
@ -147,9 +147,21 @@ drop database mysqldump_test_db;
|
|||
|
||||
CREATE TABLE t1 (a CHAR(10));
|
||||
INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# WL #2319: Exclude Tables from dump
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t2 VALUES (4),(5),(6);
|
||||
--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
|||
|
|
@ -889,7 +889,7 @@ drop table t1;
|
|||
#
|
||||
# IN optimisation test results
|
||||
#
|
||||
create table t1 (s1 char(5), index s1(s1));
|
||||
create table t1 (s1 char(5) not null, index s1(s1));
|
||||
create table t2 (s1 char(5), index s1(s1));
|
||||
insert into t1 values ('a1'),('a2'),('a3');
|
||||
insert into t2 values ('a1'),('a2');
|
||||
|
|
@ -1386,3 +1386,29 @@ INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','M
|
|||
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
|
||||
SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test cases for bug #7351:
|
||||
# quantified predicate with subquery returning empty result set
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( f1 BIGINT );
|
||||
INSERT INTO t1 SET f1= NULL;
|
||||
INSERT INTO t1 SET f1= 1;
|
||||
CREATE TABLE t2 ( f1 BIGINT );
|
||||
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 );
|
||||
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 WHERE f1 > 2 );
|
||||
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT f1 FROM t2 WHERE f1 > 2
|
||||
UNION
|
||||
SELECT f1 FROM t2 WHERE f1 > 3);
|
||||
|
||||
SELECT f1 FROM t1
|
||||
WHERE f1 <> ALL ( SELECT SUM(f1) AS sf1 FROM t2 HAVING sf1 > 10000);
|
||||
|
|
|
|||
|
|
@ -89,3 +89,15 @@ delete from t1;
|
|||
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #7297 "Two digit year should be interpreted correctly even
|
||||
# with zero month and day"
|
||||
#
|
||||
create table t1 (dt datetime);
|
||||
# These dates should be treated as dates in 21st century
|
||||
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
|
||||
# Zero dates are still special :/
|
||||
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ show variables like 'concurrent_insert';
|
|||
set global concurrent_insert=DEFAULT;
|
||||
show variables like 'concurrent_insert';
|
||||
|
||||
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
|
||||
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
|
||||
show local variables like 'storage_engine';
|
||||
show global variables like 'storage_engine';
|
||||
set GLOBAL query_cache_size=100000;
|
||||
|
|
@ -128,7 +128,7 @@ set max_join_size="hello";
|
|||
--error 1286
|
||||
set storage_engine=UNKNOWN_TABLE_TYPE;
|
||||
--error 1231
|
||||
set storage_engine=INNODB, big_tables=2;
|
||||
set storage_engine=MERGE, big_tables=2;
|
||||
show local variables like 'storage_engine';
|
||||
--error 1229
|
||||
set SESSION query_cache_size=10000;
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const byte *key, uint length,
|
|||
if (my_hash_insert(&hash->hash, (byte*) entry))
|
||||
{
|
||||
/* This can only happen if hash got out of memory */
|
||||
my_delete((char*) entry, MYF(0));
|
||||
my_free((char*) entry, MYF(0));
|
||||
error= 1;
|
||||
goto end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,48 @@
|
|||
#define HAVE_STRCASECMP
|
||||
#define strcasecmp _strcmpi
|
||||
#pragma warning(disable: 4503 4786)
|
||||
typedef unsigned __int64 Uint64;
|
||||
typedef signed __int64 Int64;
|
||||
#else
|
||||
#undef NDB_WIN32
|
||||
#define DIR_SEPARATOR "/"
|
||||
typedef unsigned long long Uint64;
|
||||
typedef signed long long Int64;
|
||||
#endif
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char Uint8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short Uint16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int Uint32;
|
||||
|
||||
typedef unsigned int UintR;
|
||||
|
||||
#ifdef __SIZE_TYPE__
|
||||
typedef __SIZE_TYPE__ UintPtr;
|
||||
#elif SIZEOF_CHARP == 4
|
||||
typedef Uint32 UintPtr;
|
||||
#elif SIZEOF_CHARP == 8
|
||||
typedef Uint64 UintPtr;
|
||||
#else
|
||||
#error "Unknown size of (char *)"
|
||||
#endif
|
||||
|
||||
#if ! (SIZEOF_CHAR == 1)
|
||||
#error "Invalid define for Uint8"
|
||||
#endif
|
||||
|
||||
#if ! (SIZEOF_INT == 4)
|
||||
#error "Invalid define for Uint32"
|
||||
#endif
|
||||
|
||||
#if ! (SIZEOF_LONG_LONG == 8)
|
||||
#error "Invalid define for Uint64"
|
||||
#endif
|
||||
|
||||
#include <my_alarm.h>
|
||||
|
||||
#ifdef _AIX
|
||||
|
|
|
|||
|
|
@ -21,40 +21,6 @@
|
|||
#ifndef NDB_TYPES_H
|
||||
#define NDB_TYPES_H
|
||||
|
||||
typedef signed char Int8;
|
||||
typedef unsigned char Uint8;
|
||||
typedef signed short Int16;
|
||||
typedef unsigned short Uint16;
|
||||
typedef signed int Int32;
|
||||
typedef unsigned int Uint32;
|
||||
|
||||
typedef unsigned int UintR;
|
||||
|
||||
#ifdef __SIZE_TYPE__
|
||||
typedef __SIZE_TYPE__ UintPtr;
|
||||
#else
|
||||
#include <ndb_global.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#if defined(WIN32) || defined(NDB_WIN32)
|
||||
typedef Uint32 UintPtr;
|
||||
#else
|
||||
typedef uintptr_t UintPtr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(NDB_WIN32)
|
||||
typedef unsigned __int64 Uint64;
|
||||
typedef signed __int64 Int64;
|
||||
typedef UintPtr ssize_t;
|
||||
#else
|
||||
typedef unsigned long long Uint64;
|
||||
typedef signed long long Int64;
|
||||
#endif
|
||||
|
||||
#include "ndb_global.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3471,10 +3471,10 @@ SumaParticipant::completeSubRemoveReq(Signal* signal, SubscriptionPtr subPtr) {
|
|||
*/
|
||||
#if 0
|
||||
ndbout_c("c_subscriptionPool.getSize() %d c_subscriptionPool.getNoOfFree()%d",
|
||||
c_subscriptionPool.getSize(),c_subscriptionPool.getNoOfFree()+1);
|
||||
c_subscriptionPool.getSize(),c_subscriptionPool.getNoOfFree());
|
||||
#endif
|
||||
|
||||
if(c_subscriptionPool.getSize() == c_subscriptionPool.getNoOfFree()+1) {
|
||||
if(c_subscriptionPool.getSize() == c_subscriptionPool.getNoOfFree()) {
|
||||
jam();
|
||||
#if 0
|
||||
ndbout_c("SUB_REMOVE_REQ:Clearing c_tables");
|
||||
|
|
|
|||
|
|
@ -322,13 +322,13 @@ do
|
|||
# but should work for the rest of the servers.
|
||||
# The only thing is ps x => redhat 5 gives warnings when using ps -x.
|
||||
# kill -9 is used or the process won't react on the kill.
|
||||
numofproces=`ps xa | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
|
||||
numofproces=`ps xaww | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c "pid-file=$pid_file"`
|
||||
|
||||
echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
|
||||
I=1
|
||||
while test "$I" -le "$numofproces"
|
||||
do
|
||||
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'`
|
||||
PROC=`ps xaww | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n '$p'`
|
||||
|
||||
for T in $PROC
|
||||
do
|
||||
|
|
|
|||
|
|
@ -1039,7 +1039,7 @@ try_and_report("Automatic row id", "automatic_rowid",
|
|||
["MATCH UNIQUE","match_unique",
|
||||
"1 match unique (select a from crash_me)",1,0],
|
||||
["MATCH","match","1 match (select a from crash_me)",1,0],
|
||||
["MATCHES","matches","b matcjhes 'a*'",1,0],
|
||||
["MATCHES","matches","b matches 'a*'",1,0],
|
||||
["NOT BETWEEN","not_between","7 not between 4 and 6",1,0],
|
||||
["NOT EXISTS","not_exists",
|
||||
"not exists (select * from crash_me where a = 2)",1,0],
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
|
|||
HANDLE event_server_read = NULL;
|
||||
HANDLE event_client_wrote = NULL;
|
||||
HANDLE event_client_read = NULL;
|
||||
HANDLE event_conn_closed = NULL;
|
||||
HANDLE handle_file_map = NULL;
|
||||
ulong connect_number;
|
||||
char connect_number_char[22], *p;
|
||||
|
|
@ -508,6 +509,13 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
|
|||
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
|
||||
goto err2;
|
||||
}
|
||||
|
||||
strmov(suffix_pos, "CONNECTION_CLOSED");
|
||||
if ((event_conn_closed = OpenEvent(EVENT_ALL_ACCESS,FALSE,tmp)) == NULL)
|
||||
{
|
||||
error_allow = CR_SHARED_MEMORY_EVENT_ERROR;
|
||||
goto err2;
|
||||
}
|
||||
/*
|
||||
Set event that server should send data
|
||||
*/
|
||||
|
|
@ -517,9 +525,9 @@ err2:
|
|||
if (error_allow == 0)
|
||||
{
|
||||
net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map,
|
||||
event_server_wrote,
|
||||
event_server_wrote,
|
||||
event_server_read,event_client_wrote,
|
||||
event_client_read);
|
||||
event_client_read,event_conn_closed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -532,6 +540,8 @@ err2:
|
|||
CloseHandle(event_client_read);
|
||||
if (event_client_wrote)
|
||||
CloseHandle(event_client_wrote);
|
||||
if (event_conn_closed)
|
||||
CloseHandle(event_conn_closed);
|
||||
if (handle_map)
|
||||
UnmapViewOfFile(handle_map);
|
||||
if (handle_file_map)
|
||||
|
|
@ -872,7 +882,7 @@ static const char *default_options[]=
|
|||
"connect-timeout", "local-infile", "disable-local-infile",
|
||||
"replication-probe", "enable-reads-from-master", "repl-parse-query",
|
||||
"ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name",
|
||||
"multi-results", "multi-queries", "secure-auth",
|
||||
"multi-results", "multi-statements", "multi-queries", "secure-auth",
|
||||
NullS
|
||||
};
|
||||
|
||||
|
|
@ -1078,9 +1088,10 @@ void mysql_read_default_options(struct st_mysql_options *options,
|
|||
options->client_flag|= CLIENT_MULTI_RESULTS;
|
||||
break;
|
||||
case 31:
|
||||
case 32:
|
||||
options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
|
||||
break;
|
||||
case 32: /* secure-auth */
|
||||
case 33: /* secure-auth */
|
||||
options->secure_auth= TRUE;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -339,8 +339,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
|||
}
|
||||
l_time->neg= 0;
|
||||
|
||||
if (year_length == 2 && i >= format_position[1] && i >=format_position[2] &&
|
||||
(l_time->month || l_time->day))
|
||||
if (year_length == 2 && not_zero_date)
|
||||
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
|
||||
|
||||
if (number_of_fields < 3 ||
|
||||
|
|
|
|||
|
|
@ -278,15 +278,15 @@ convert_error_code_to_mysql(
|
|||
|
||||
} else if (error == (int) DB_LOCK_WAIT_TIMEOUT) {
|
||||
|
||||
/* Since we rolled back the whole transaction, we must
|
||||
tell it also to MySQL so that MySQL knows to empty the
|
||||
cached binlog for this transaction */
|
||||
/* Since we rolled back the whole transaction, we must
|
||||
tell it also to MySQL so that MySQL knows to empty the
|
||||
cached binlog for this transaction */
|
||||
|
||||
if (thd) {
|
||||
ha_rollback(thd);
|
||||
}
|
||||
if (thd) {
|
||||
ha_rollback(thd);
|
||||
}
|
||||
|
||||
return(HA_ERR_LOCK_WAIT_TIMEOUT);
|
||||
return(HA_ERR_LOCK_WAIT_TIMEOUT);
|
||||
|
||||
} else if (error == (int) DB_NO_REFERENCED_ROW) {
|
||||
|
||||
|
|
@ -3955,11 +3955,9 @@ ha_innobase::discard_or_import_tablespace(
|
|||
err = row_import_tablespace_for_mysql(dict_table->name, trx);
|
||||
}
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
err = convert_error_code_to_mysql(err, NULL);
|
||||
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(err);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
@ -4990,19 +4988,6 @@ ha_innobase::external_lock(
|
|||
|
||||
update_thd(thd);
|
||||
|
||||
if (prebuilt->table->ibd_file_missing && !current_thd->tablespace_op) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB error:\n"
|
||||
"MySQL is trying to use a table handle but the .ibd file for\n"
|
||||
"table %s does not exist.\n"
|
||||
"Have you deleted the .ibd file from the database directory under\n"
|
||||
"the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
|
||||
"Look from section 15.1 of http://www.innodb.com/ibman.html\n"
|
||||
"how you can resolve the problem.\n",
|
||||
prebuilt->table->name);
|
||||
DBUG_RETURN(HA_ERR_CRASHED);
|
||||
}
|
||||
|
||||
trx = prebuilt->trx;
|
||||
|
||||
prebuilt->sql_stat_start = TRUE;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,17 @@
|
|||
const char **ha_myisammrg::bas_ext() const
|
||||
{ static const char *ext[]= { ".MRG", NullS }; return ext; }
|
||||
|
||||
const char *ha_myisammrg::index_type(uint key_number)
|
||||
{
|
||||
return ((table->key_info[key_number].flags & HA_FULLTEXT) ?
|
||||
"FULLTEXT" :
|
||||
(table->key_info[key_number].flags & HA_SPATIAL) ?
|
||||
"SPATIAL" :
|
||||
(table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ?
|
||||
"RTREE" :
|
||||
"BTREE");
|
||||
}
|
||||
|
||||
|
||||
int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class ha_myisammrg: public handler
|
|||
~ha_myisammrg() {}
|
||||
const char *table_type() const { return "MRG_MyISAM"; }
|
||||
const char **bas_ext() const;
|
||||
const char *index_type(uint key_number);
|
||||
ulong table_flags() const
|
||||
{
|
||||
return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME |
|
||||
|
|
|
|||
|
|
@ -212,6 +212,13 @@ Thd_ndb::~Thd_ndb()
|
|||
{
|
||||
if (ndb)
|
||||
delete ndb;
|
||||
ndb= 0;
|
||||
}
|
||||
|
||||
inline
|
||||
Ndb *ha_ndbcluster::get_ndb()
|
||||
{
|
||||
return ((Thd_ndb*)current_thd->transaction.thd_ndb)->ndb;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -245,8 +252,9 @@ void ha_ndbcluster::records_update()
|
|||
info->no_uncommitted_rows_count));
|
||||
// if (info->records == ~(ha_rows)0)
|
||||
{
|
||||
Ndb *ndb= get_ndb();
|
||||
Uint64 rows;
|
||||
if(ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0) == 0){
|
||||
if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0) == 0){
|
||||
info->records= rows;
|
||||
}
|
||||
}
|
||||
|
|
@ -331,7 +339,8 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
|
|||
switch (err.classification) {
|
||||
case NdbError::SchemaError:
|
||||
{
|
||||
NDBDICT *dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NDBDICT *dict= ndb->getDictionary();
|
||||
DBUG_PRINT("info", ("invalidateTable %s", m_tabname));
|
||||
dict->invalidateTable(m_tabname);
|
||||
table->version=0L; /* Free when thread is ready */
|
||||
|
|
@ -361,7 +370,7 @@ bool ha_ndbcluster::get_error_message(int error,
|
|||
DBUG_ENTER("ha_ndbcluster::get_error_message");
|
||||
DBUG_PRINT("enter", ("error: %d", error));
|
||||
|
||||
Ndb *ndb= ((Thd_ndb*)current_thd->transaction.thd_ndb)->ndb;
|
||||
Ndb *ndb= get_ndb();
|
||||
if (!ndb)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
|
|
@ -690,7 +699,8 @@ bool ha_ndbcluster::uses_blob_value(bool all_fields)
|
|||
|
||||
int ha_ndbcluster::get_metadata(const char *path)
|
||||
{
|
||||
NDBDICT *dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NDBDICT *dict= ndb->getDictionary();
|
||||
const NDBTAB *tab;
|
||||
int error;
|
||||
bool invalidating_ndb_table= FALSE;
|
||||
|
|
@ -765,7 +775,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
|
|||
static const char* unique_suffix= "$unique";
|
||||
KEY* key_info= tab->key_info;
|
||||
const char **key_name= tab->keynames.type_names;
|
||||
NdbDictionary::Dictionary *dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NdbDictionary::Dictionary *dict= ndb->getDictionary();
|
||||
DBUG_ENTER("build_index_list");
|
||||
|
||||
// Save information about all known indexes
|
||||
|
|
@ -1735,7 +1746,8 @@ int ha_ndbcluster::write_row(byte *record)
|
|||
if (table->primary_key == MAX_KEY)
|
||||
{
|
||||
// Table has hidden primary key
|
||||
Uint64 auto_value= m_ndb->getAutoIncrementValue((const NDBTAB *) m_table);
|
||||
Ndb *ndb= get_ndb();
|
||||
Uint64 auto_value= ndb->getAutoIncrementValue((const NDBTAB *) m_table);
|
||||
if (set_hidden_key(op, table->fields, (const byte*)&auto_value))
|
||||
ERR_RETURN(op->getNdbError());
|
||||
}
|
||||
|
|
@ -1812,11 +1824,12 @@ int ha_ndbcluster::write_row(byte *record)
|
|||
}
|
||||
if ((has_auto_increment) && (m_skip_auto_increment))
|
||||
{
|
||||
Ndb *ndb= get_ndb();
|
||||
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
|
||||
DBUG_PRINT("info",
|
||||
("Trying to set next auto increment value to %lu",
|
||||
(ulong) next_val));
|
||||
if (m_ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE))
|
||||
if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE))
|
||||
DBUG_PRINT("info",
|
||||
("Setting next auto increment value to %u", next_val));
|
||||
}
|
||||
|
|
@ -2657,9 +2670,12 @@ void ha_ndbcluster::info(uint flag)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((my_errno= check_ndb_connection()))
|
||||
DBUG_VOID_RETURN;
|
||||
Ndb *ndb= get_ndb();
|
||||
Uint64 rows= 100;
|
||||
if (current_thd->variables.ndb_use_exact_count)
|
||||
ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0);
|
||||
ndb_get_table_statistics(ndb, m_tabname, &rows, 0);
|
||||
records= rows;
|
||||
}
|
||||
}
|
||||
|
|
@ -2986,6 +3002,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
DBUG_RETURN(1);
|
||||
|
||||
Thd_ndb *thd_ndb= (Thd_ndb*)thd->transaction.thd_ndb;
|
||||
Ndb *ndb= thd_ndb->ndb;
|
||||
|
||||
DBUG_PRINT("enter", ("transaction.thd_ndb->lock_count: %d",
|
||||
thd_ndb->lock_count));
|
||||
|
|
@ -3003,9 +3020,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
DBUG_ASSERT(!thd->transaction.stmt.ndb_tid);
|
||||
DBUG_PRINT("trans",("Starting transaction stmt"));
|
||||
|
||||
trans= m_ndb->startTransaction();
|
||||
trans= ndb->startTransaction();
|
||||
if (trans == NULL)
|
||||
ERR_RETURN(m_ndb->getNdbError());
|
||||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
thd->transaction.stmt.ndb_tid= trans;
|
||||
}
|
||||
|
|
@ -3017,9 +3034,9 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
// A "master" transaction ha not been started yet
|
||||
DBUG_PRINT("trans",("starting transaction, all"));
|
||||
|
||||
trans= m_ndb->startTransaction();
|
||||
trans= ndb->startTransaction();
|
||||
if (trans == NULL)
|
||||
ERR_RETURN(m_ndb->getNdbError());
|
||||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
|
||||
/*
|
||||
|
|
@ -3068,7 +3085,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
m_retrieve_primary_key= FALSE;
|
||||
m_ops_pending= 0;
|
||||
{
|
||||
NDBDICT *dict= m_ndb->getDictionary();
|
||||
NDBDICT *dict= ndb->getDictionary();
|
||||
const NDBTAB *tab;
|
||||
void *tab_info;
|
||||
if (!(tab= dict->getTable(m_tabname, &tab_info)))
|
||||
|
|
@ -3095,7 +3112,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||
We must in this case close the transaction to release resources
|
||||
*/
|
||||
DBUG_PRINT("trans",("ending non-updating transaction"));
|
||||
m_ndb->closeTransaction(m_active_trans);
|
||||
ndb->closeTransaction(m_active_trans);
|
||||
thd->transaction.stmt.ndb_tid= 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -3141,16 +3158,17 @@ int ha_ndbcluster::start_stmt(THD *thd)
|
|||
|
||||
NdbConnection *trans= (NdbConnection*)thd->transaction.stmt.ndb_tid;
|
||||
if (!trans){
|
||||
Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
|
||||
DBUG_PRINT("trans",("Starting transaction stmt"));
|
||||
|
||||
NdbConnection *tablock_trans=
|
||||
(NdbConnection*)thd->transaction.all.ndb_tid;
|
||||
DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans));
|
||||
DBUG_ASSERT(tablock_trans);
|
||||
// trans= m_ndb->hupp(tablock_trans);
|
||||
trans= m_ndb->startTransaction();
|
||||
// trans= ndb->hupp(tablock_trans);
|
||||
trans= ndb->startTransaction();
|
||||
if (trans == NULL)
|
||||
ERR_RETURN(m_ndb->getNdbError());
|
||||
ERR_RETURN(ndb->getNdbError());
|
||||
no_uncommitted_rows_reset(thd);
|
||||
thd->transaction.stmt.ndb_tid= trans;
|
||||
}
|
||||
|
|
@ -3537,7 +3555,8 @@ int ha_ndbcluster::create(const char *name,
|
|||
DBUG_RETURN(my_errno);
|
||||
|
||||
// Create the table in NDB
|
||||
NDBDICT *dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NDBDICT *dict= ndb->getDictionary();
|
||||
if (dict->createTable(tab) != 0)
|
||||
{
|
||||
const NdbError err= dict->getNdbError();
|
||||
|
|
@ -3582,7 +3601,8 @@ int ha_ndbcluster::create_index(const char *name,
|
|||
KEY *key_info,
|
||||
bool unique)
|
||||
{
|
||||
NdbDictionary::Dictionary *dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NdbDictionary::Dictionary *dict= ndb->getDictionary();
|
||||
KEY_PART_INFO *key_part= key_info->key_part;
|
||||
KEY_PART_INFO *end= key_part + key_info->key_parts;
|
||||
|
||||
|
|
@ -3640,15 +3660,16 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
|
|||
|
||||
if (check_ndb_connection())
|
||||
DBUG_RETURN(my_errno= HA_ERR_NO_CONNECTION);
|
||||
|
||||
dict= m_ndb->getDictionary();
|
||||
|
||||
Ndb *ndb= get_ndb();
|
||||
dict= ndb->getDictionary();
|
||||
if (!(orig_tab= dict->getTable(m_tabname)))
|
||||
ERR_RETURN(dict->getNdbError());
|
||||
|
||||
m_table= (void *)orig_tab;
|
||||
// Change current database to that of target table
|
||||
set_dbname(to);
|
||||
m_ndb->setDatabaseName(m_dbname);
|
||||
ndb->setDatabaseName(m_dbname);
|
||||
if (!(result= alter_table_name(new_tabname)))
|
||||
{
|
||||
// Rename .ndb file
|
||||
|
|
@ -3665,7 +3686,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
|
|||
|
||||
int ha_ndbcluster::alter_table_name(const char *to)
|
||||
{
|
||||
NDBDICT * dict= m_ndb->getDictionary();
|
||||
Ndb *ndb= get_ndb();
|
||||
NDBDICT *dict= ndb->getDictionary();
|
||||
const NDBTAB *orig_tab= (const NDBTAB *) m_table;
|
||||
int ret;
|
||||
DBUG_ENTER("alter_table_name_table");
|
||||
|
|
@ -3707,8 +3729,9 @@ int ha_ndbcluster::delete_table(const char *name)
|
|||
|
||||
int ha_ndbcluster::drop_table()
|
||||
{
|
||||
NdbDictionary::Dictionary *dict= m_ndb->getDictionary();
|
||||
|
||||
Ndb *ndb= get_ndb();
|
||||
NdbDictionary::Dictionary *dict= ndb->getDictionary();
|
||||
|
||||
DBUG_ENTER("drop_table");
|
||||
DBUG_PRINT("enter", ("Deleting %s", m_tabname));
|
||||
|
||||
|
|
@ -3741,6 +3764,7 @@ longlong ha_ndbcluster::get_auto_increment()
|
|||
{
|
||||
DBUG_ENTER("get_auto_increment");
|
||||
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
|
||||
Ndb *ndb= get_ndb();
|
||||
int cache_size=
|
||||
(m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
|
||||
m_rows_to_insert - m_rows_inserted
|
||||
|
|
@ -3749,8 +3773,8 @@ longlong ha_ndbcluster::get_auto_increment()
|
|||
: m_autoincrement_prefetch;
|
||||
Uint64 auto_value=
|
||||
(m_skip_auto_increment) ?
|
||||
m_ndb->readAutoIncrementValue((const NDBTAB *) m_table)
|
||||
: m_ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
|
||||
ndb->readAutoIncrementValue((const NDBTAB *) m_table)
|
||||
: ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
|
||||
DBUG_RETURN((longlong)auto_value);
|
||||
}
|
||||
|
||||
|
|
@ -3763,7 +3787,6 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
|
|||
handler(table_arg),
|
||||
m_active_trans(NULL),
|
||||
m_active_cursor(NULL),
|
||||
m_ndb(NULL),
|
||||
m_table(NULL),
|
||||
m_table_info(NULL),
|
||||
m_table_flags(HA_REC_NOT_IN_SEQ |
|
||||
|
|
@ -3892,7 +3915,6 @@ int ha_ndbcluster::close(void)
|
|||
DBUG_ENTER("close");
|
||||
free_share(m_share); m_share= 0;
|
||||
release_metadata();
|
||||
m_ndb= NULL;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
@ -3954,11 +3976,12 @@ Ndb* check_ndb_in_thd(THD* thd)
|
|||
int ha_ndbcluster::check_ndb_connection()
|
||||
{
|
||||
THD* thd= current_thd;
|
||||
Ndb *ndb;
|
||||
DBUG_ENTER("check_ndb_connection");
|
||||
|
||||
if (!(m_ndb= check_ndb_in_thd(thd)))
|
||||
if (!(ndb= check_ndb_in_thd(thd)))
|
||||
DBUG_RETURN(HA_ERR_NO_CONNECTION);
|
||||
m_ndb->setDatabaseName(m_dbname);
|
||||
ndb->setDatabaseName(m_dbname);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,6 @@ class ha_ndbcluster: public handler
|
|||
|
||||
NdbConnection *m_active_trans;
|
||||
NdbResultSet *m_active_cursor;
|
||||
Ndb *m_ndb;
|
||||
void *m_table;
|
||||
void *m_table_info;
|
||||
char m_dbname[FN_HEADLEN];
|
||||
|
|
@ -248,6 +247,7 @@ class ha_ndbcluster: public handler
|
|||
ha_rows m_autoincrement_prefetch;
|
||||
bool m_transaction_on;
|
||||
|
||||
Ndb *get_ndb();
|
||||
void set_rec_per_key();
|
||||
void records_update();
|
||||
void no_uncommitted_rows_execute_failure();
|
||||
|
|
|
|||
|
|
@ -636,12 +636,13 @@ longlong Item_in_optimizer::val_int()
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
cache->store(args[0]);
|
||||
longlong tmp= args[1]->val_int_result();
|
||||
if (cache->null_value)
|
||||
{
|
||||
null_value= 1;
|
||||
if (tmp)
|
||||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
longlong tmp= args[1]->val_int_result();
|
||||
null_value= args[1]->null_value;
|
||||
return tmp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1302,9 +1302,18 @@ String *Item_func_trim::val_str(String *str)
|
|||
return 0; /* purecov: inspected */
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),res->charset());
|
||||
String *remove_str= (arg_count==2) ? args[1]->val_str(&tmp) : &remove;
|
||||
uint remove_length;
|
||||
LINT_INIT(remove_length);
|
||||
String *remove_str; /* The string to remove from res. */
|
||||
|
||||
if (arg_count == 2)
|
||||
{
|
||||
remove_str= args[1]->val_str(&tmp);
|
||||
if ((null_value= args[1]->null_value))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
remove_str= &remove; /* Default value. */
|
||||
|
||||
if (!remove_str || (remove_length=remove_str->length()) == 0 ||
|
||||
remove_length > res->length())
|
||||
|
|
@ -2596,16 +2605,16 @@ String *Item_func_quote::val_str(String *str)
|
|||
|
||||
/*
|
||||
We have to use realloc() instead of alloc() as we want to keep the
|
||||
old result in str
|
||||
old result in arg
|
||||
*/
|
||||
if (str->realloc(new_length))
|
||||
if (arg->realloc(new_length))
|
||||
goto null;
|
||||
|
||||
/*
|
||||
As 'arg' and 'str' may be the same string, we must replace characters
|
||||
from the end to the beginning
|
||||
*/
|
||||
to= (char*) str->ptr() + new_length - 1;
|
||||
to= (char*) arg->ptr() + new_length - 1;
|
||||
*to--= '\'';
|
||||
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
|
||||
{
|
||||
|
|
@ -2633,10 +2642,10 @@ String *Item_func_quote::val_str(String *str)
|
|||
}
|
||||
}
|
||||
*to= '\'';
|
||||
str->length(new_length);
|
||||
arg->length(new_length);
|
||||
str->set_charset(collation.collation);
|
||||
null_value= 0;
|
||||
return str;
|
||||
return arg;
|
||||
|
||||
null:
|
||||
null_value= 1;
|
||||
|
|
|
|||
|
|
@ -824,6 +824,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||
select_lex->ref_pointer_array,
|
||||
(char *)"<ref>",
|
||||
this->full_name()));
|
||||
if (!abort_on_null && left_expr->maybe_null)
|
||||
item= new Item_cond_or(new Item_func_isnull(left_expr), item);
|
||||
/*
|
||||
AND and comparison functions can't be changed during fix_fields()
|
||||
we can assign select_lex->having here, and pass 0 as last
|
||||
|
|
@ -869,6 +871,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||
select_lex->having_fix_field= 0;
|
||||
item= new Item_cond_or(item,
|
||||
new Item_func_isnull(orig_item));
|
||||
if (left_expr->maybe_null)
|
||||
item= new Item_cond_or(new Item_func_isnull(left_expr), item);
|
||||
}
|
||||
item->name= (char *)in_additional_cond;
|
||||
/*
|
||||
|
|
@ -889,12 +893,13 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||
we can assign select_lex->having here, and pass 0 as last
|
||||
argument (reference) to fix_fields()
|
||||
*/
|
||||
select_lex->having=
|
||||
join->having=
|
||||
func->create(expr,
|
||||
new Item_null_helper(this, item,
|
||||
item= func->create(expr,
|
||||
new Item_null_helper(this, item,
|
||||
(char *)"<no matter>",
|
||||
(char *)"<result>"));
|
||||
if (!abort_on_null && left_expr->maybe_null)
|
||||
item= new Item_cond_or(new Item_func_isnull(left_expr), item);
|
||||
select_lex->having= join->having= item;
|
||||
select_lex->having_fix_field= 1;
|
||||
if (join->having->fix_fields(thd, join->tables_list,
|
||||
0))
|
||||
|
|
|
|||
|
|
@ -1597,6 +1597,7 @@ void Item_func_from_unixtime::fix_length_and_dec()
|
|||
collation.set(&my_charset_bin);
|
||||
decimals=0;
|
||||
max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
maybe_null= 1;
|
||||
thd->time_zone_used= 1;
|
||||
}
|
||||
|
||||
|
|
@ -1636,11 +1637,12 @@ longlong Item_func_from_unixtime::val_int()
|
|||
bool Item_func_from_unixtime::get_date(TIME *ltime,
|
||||
uint fuzzy_date __attribute__((unused)))
|
||||
{
|
||||
longlong tmp= args[0]->val_int();
|
||||
|
||||
if ((null_value= (args[0]->null_value ||
|
||||
tmp < TIMESTAMP_MIN_VALUE ||
|
||||
tmp > TIMESTAMP_MAX_VALUE)))
|
||||
ulonglong tmp= (ulonglong)(args[0]->val_int());
|
||||
/*
|
||||
"tmp > TIMESTAMP_MAX_VALUE" check also covers case of negative
|
||||
from_unixtime() argument since tmp is unsigned.
|
||||
*/
|
||||
if ((null_value= (args[0]->null_value || tmp > TIMESTAMP_MAX_VALUE)))
|
||||
return 1;
|
||||
|
||||
thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp);
|
||||
|
|
@ -2183,6 +2185,12 @@ String *Item_datetime_typecast::val_str(String *str)
|
|||
bool Item_time_typecast::get_time(TIME *ltime)
|
||||
{
|
||||
bool res= get_arg0_time(ltime);
|
||||
/*
|
||||
For MYSQL_TIMESTAMP_TIME value we can have non-zero day part,
|
||||
which we should not lose.
|
||||
*/
|
||||
if (ltime->time_type == MYSQL_TIMESTAMP_DATETIME)
|
||||
ltime->year= ltime->month= ltime->day= 0;
|
||||
ltime->time_type= MYSQL_TIMESTAMP_TIME;
|
||||
return res;
|
||||
}
|
||||
|
|
@ -2206,6 +2214,7 @@ String *Item_time_typecast::val_str(String *str)
|
|||
bool Item_date_typecast::get_date(TIME *ltime, uint fuzzy_date)
|
||||
{
|
||||
bool res= get_arg0_date(ltime,1);
|
||||
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
|
||||
ltime->time_type= MYSQL_TIMESTAMP_DATE;
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2036,6 +2036,7 @@ bool flush_error_log()
|
|||
char err_renamed[FN_REFLEN], *end;
|
||||
end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
|
||||
strmov(end, "-old");
|
||||
VOID(pthread_mutex_lock(&LOCK_error_log));
|
||||
#ifdef __WIN__
|
||||
char err_temp[FN_REFLEN+4];
|
||||
/*
|
||||
|
|
@ -2056,7 +2057,7 @@ bool flush_error_log()
|
|||
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
|
||||
{
|
||||
while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0)
|
||||
my_fwrite(stderr, (byte*) buf, (uint) strlen(buf),MYF(0));
|
||||
my_fwrite(stderr, (byte*) buf, bytes, MYF(0));
|
||||
my_close(fd, MYF(0));
|
||||
}
|
||||
(void) my_delete(err_temp, MYF(0));
|
||||
|
|
@ -2070,6 +2071,7 @@ bool flush_error_log()
|
|||
else
|
||||
result= 1;
|
||||
#endif
|
||||
VOID(pthread_mutex_unlock(&LOCK_error_log));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,15 +141,6 @@ extern "C" { // Because of SCO 3.2V4.2
|
|||
int allow_severity = LOG_INFO;
|
||||
int deny_severity = LOG_WARNING;
|
||||
|
||||
#ifdef __STDC__
|
||||
#define my_fromhost(A) fromhost(A)
|
||||
#define my_hosts_access(A) hosts_access(A)
|
||||
#define my_eval_client(A) eval_client(A)
|
||||
#else
|
||||
#define my_fromhost(A) fromhost()
|
||||
#define my_hosts_access(A) hosts_access()
|
||||
#define my_eval_client(A) eval_client()
|
||||
#endif /* __STDC__ */
|
||||
#endif /* HAVE_LIBWRAP */
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
|
|
@ -3574,8 +3565,8 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
|
|||
struct request_info req;
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
|
||||
my_fromhost(&req);
|
||||
if (!my_hosts_access(&req))
|
||||
fromhost(&req);
|
||||
if (!hosts_access(&req))
|
||||
{
|
||||
/*
|
||||
This may be stupid but refuse() includes an exit(0)
|
||||
|
|
@ -3583,7 +3574,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets,
|
|||
clean_exit() - same stupid thing ...
|
||||
*/
|
||||
syslog(deny_severity, "refused connect from %s",
|
||||
my_eval_client(&req));
|
||||
eval_client(&req));
|
||||
|
||||
/*
|
||||
C++ sucks (the gibberish in front just translates the supplied
|
||||
|
|
@ -3822,6 +3813,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
|
|||
HANDLE event_client_read= 0; // for transfer data server <-> client
|
||||
HANDLE event_server_wrote= 0;
|
||||
HANDLE event_server_read= 0;
|
||||
HANDLE event_conn_closed= 0;
|
||||
THD *thd= 0;
|
||||
|
||||
p= int10_to_str(connect_number, connect_number_char, 10);
|
||||
|
|
@ -3852,29 +3844,35 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
|
|||
goto errorconn;
|
||||
}
|
||||
strmov(suffix_pos, "CLIENT_WROTE");
|
||||
if ((event_client_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
|
||||
if ((event_client_wrote= CreateEvent(0, FALSE, FALSE, tmp)) == 0)
|
||||
{
|
||||
errmsg= "Could not create client write event";
|
||||
goto errorconn;
|
||||
}
|
||||
strmov(suffix_pos, "CLIENT_READ");
|
||||
if ((event_client_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
|
||||
if ((event_client_read= CreateEvent(0, FALSE, FALSE, tmp)) == 0)
|
||||
{
|
||||
errmsg= "Could not create client read event";
|
||||
goto errorconn;
|
||||
}
|
||||
strmov(suffix_pos, "SERVER_READ");
|
||||
if ((event_server_read= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
|
||||
if ((event_server_read= CreateEvent(0, FALSE, FALSE, tmp)) == 0)
|
||||
{
|
||||
errmsg= "Could not create server read event";
|
||||
goto errorconn;
|
||||
}
|
||||
strmov(suffix_pos, "SERVER_WROTE");
|
||||
if ((event_server_wrote= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
|
||||
if ((event_server_wrote= CreateEvent(0, FALSE, FALSE, tmp)) == 0)
|
||||
{
|
||||
errmsg= "Could not create server write event";
|
||||
goto errorconn;
|
||||
}
|
||||
strmov(suffix_pos, "CONNECTION_CLOSED");
|
||||
if ((event_conn_closed= CreateEvent(0, TRUE , FALSE, tmp)) == 0)
|
||||
{
|
||||
errmsg= "Could not create closed connection event";
|
||||
goto errorconn;
|
||||
}
|
||||
if (abort_loop)
|
||||
goto errorconn;
|
||||
if (!(thd= new THD))
|
||||
|
|
@ -3893,13 +3891,14 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
|
|||
goto errorconn;
|
||||
}
|
||||
if (!(thd->net.vio= vio_new_win32shared_memory(&thd->net,
|
||||
handle_client_file_map,
|
||||
handle_client_map,
|
||||
event_client_wrote,
|
||||
event_client_read,
|
||||
event_server_wrote,
|
||||
event_server_read)) ||
|
||||
my_net_init(&thd->net, thd->net.vio))
|
||||
handle_client_file_map,
|
||||
handle_client_map,
|
||||
event_client_wrote,
|
||||
event_client_read,
|
||||
event_server_wrote,
|
||||
event_server_read,
|
||||
event_conn_closed)) ||
|
||||
my_net_init(&thd->net, thd->net.vio))
|
||||
{
|
||||
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
|
||||
errmsg= 0;
|
||||
|
|
@ -3919,12 +3918,20 @@ errorconn:
|
|||
NullS);
|
||||
sql_perror(buff);
|
||||
}
|
||||
if (handle_client_file_map) CloseHandle(handle_client_file_map);
|
||||
if (handle_client_map) UnmapViewOfFile(handle_client_map);
|
||||
if (event_server_wrote) CloseHandle(event_server_wrote);
|
||||
if (event_server_read) CloseHandle(event_server_read);
|
||||
if (event_client_wrote) CloseHandle(event_client_wrote);
|
||||
if (event_client_read) CloseHandle(event_client_read);
|
||||
if (handle_client_file_map)
|
||||
CloseHandle(handle_client_file_map);
|
||||
if (handle_client_map)
|
||||
UnmapViewOfFile(handle_client_map);
|
||||
if (event_server_wrote)
|
||||
CloseHandle(event_server_wrote);
|
||||
if (event_server_read)
|
||||
CloseHandle(event_server_read);
|
||||
if (event_client_wrote)
|
||||
CloseHandle(event_client_wrote);
|
||||
if (event_client_read)
|
||||
CloseHandle(event_client_read);
|
||||
if (event_conn_closed)
|
||||
CloseHandle(event_conn_closed);
|
||||
delete thd;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2948,7 +2948,7 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
|
|||
enum db_type db_type;
|
||||
if (!(res=var->value->val_str(&str)) ||
|
||||
!(var->save_result.ulong_value=
|
||||
(ulong) db_type= ha_resolve_by_name(res->ptr(), res->length())) ||
|
||||
(ulong) (db_type= ha_resolve_by_name(res->ptr(), res->length()))) ||
|
||||
ha_checktype(db_type) != db_type)
|
||||
{
|
||||
value= res ? res->c_ptr() : "NULL";
|
||||
|
|
|
|||
163
sql/sql_acl.cc
163
sql/sql_acl.cc
|
|
@ -964,9 +964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
|
|||
ulong acl_get(const char *host, const char *ip,
|
||||
const char *user, const char *db, my_bool db_is_pattern)
|
||||
{
|
||||
ulong host_access,db_access;
|
||||
ulong host_access= ~0,db_access= 0;
|
||||
uint i,key_length;
|
||||
db_access=0; host_access= ~0;
|
||||
char key[ACL_KEY_LENGTH],*tmp_db,*end;
|
||||
acl_entry *entry;
|
||||
DBUG_ENTER("acl_get");
|
||||
|
|
@ -1505,6 +1504,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||
|
||||
Field **tmp_field;
|
||||
ulong priv;
|
||||
uint next_field;
|
||||
for (tmp_field= table->field+3, priv = SELECT_ACL;
|
||||
*tmp_field && (*tmp_field)->real_type() == FIELD_TYPE_ENUM &&
|
||||
((Field_enum*) (*tmp_field))->typelib->count == 2 ;
|
||||
|
|
@ -1513,56 +1513,62 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||
if (priv & rights) // set requested privileges
|
||||
(*tmp_field)->store(&what, 1, &my_charset_latin1);
|
||||
}
|
||||
rights=get_access(table,3);
|
||||
rights= get_access(table, 3, &next_field);
|
||||
DBUG_PRINT("info",("table->fields: %d",table->fields));
|
||||
if (table->fields >= 31) /* From 4.0.0 we have more fields */
|
||||
{
|
||||
/* We write down SSL related ACL stuff */
|
||||
switch (thd->lex->ssl_type) {
|
||||
case SSL_TYPE_ANY:
|
||||
table->field[24]->store("ANY",3, &my_charset_latin1);
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
table->field[26]->store("", 0, &my_charset_latin1);
|
||||
table->field[27]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field]->store("ANY", 3, &my_charset_latin1);
|
||||
table->field[next_field+1]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+2]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+3]->store("", 0, &my_charset_latin1);
|
||||
break;
|
||||
case SSL_TYPE_X509:
|
||||
table->field[24]->store("X509",4, &my_charset_latin1);
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
table->field[26]->store("", 0, &my_charset_latin1);
|
||||
table->field[27]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field]->store("X509", 4, &my_charset_latin1);
|
||||
table->field[next_field+1]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+2]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+3]->store("", 0, &my_charset_latin1);
|
||||
break;
|
||||
case SSL_TYPE_SPECIFIED:
|
||||
table->field[24]->store("SPECIFIED",9, &my_charset_latin1);
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
table->field[26]->store("", 0, &my_charset_latin1);
|
||||
table->field[27]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field]->store("SPECIFIED", 9, &my_charset_latin1);
|
||||
table->field[next_field+1]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+2]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+3]->store("", 0, &my_charset_latin1);
|
||||
if (thd->lex->ssl_cipher)
|
||||
table->field[25]->store(thd->lex->ssl_cipher,
|
||||
strlen(thd->lex->ssl_cipher), &my_charset_latin1);
|
||||
table->field[next_field+1]->store(thd->lex->ssl_cipher,
|
||||
strlen(thd->lex->ssl_cipher),
|
||||
&my_charset_latin1);
|
||||
if (thd->lex->x509_issuer)
|
||||
table->field[26]->store(thd->lex->x509_issuer,
|
||||
strlen(thd->lex->x509_issuer), &my_charset_latin1);
|
||||
table->field[next_field+2]->store(thd->lex->x509_issuer,
|
||||
strlen(thd->lex->x509_issuer),
|
||||
&my_charset_latin1);
|
||||
if (thd->lex->x509_subject)
|
||||
table->field[27]->store(thd->lex->x509_subject,
|
||||
strlen(thd->lex->x509_subject), &my_charset_latin1);
|
||||
table->field[next_field+3]->store(thd->lex->x509_subject,
|
||||
strlen(thd->lex->x509_subject),
|
||||
&my_charset_latin1);
|
||||
break;
|
||||
case SSL_TYPE_NOT_SPECIFIED:
|
||||
break;
|
||||
case SSL_TYPE_NONE:
|
||||
table->field[24]->store("", 0, &my_charset_latin1);
|
||||
table->field[25]->store("", 0, &my_charset_latin1);
|
||||
table->field[26]->store("", 0, &my_charset_latin1);
|
||||
table->field[27]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+1]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+2]->store("", 0, &my_charset_latin1);
|
||||
table->field[next_field+3]->store("", 0, &my_charset_latin1);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Skip over SSL related fields to first user limits related field */
|
||||
next_field+= 4;
|
||||
|
||||
USER_RESOURCES mqh= thd->lex->mqh;
|
||||
if (mqh.bits & 1)
|
||||
table->field[28]->store((longlong) mqh.questions);
|
||||
table->field[next_field]->store((longlong) mqh.questions);
|
||||
if (mqh.bits & 2)
|
||||
table->field[29]->store((longlong) mqh.updates);
|
||||
table->field[next_field+1]->store((longlong) mqh.updates);
|
||||
if (mqh.bits & 4)
|
||||
table->field[30]->store((longlong) mqh.connections);
|
||||
table->field[next_field+2]->store((longlong) mqh.connections);
|
||||
mqh_used = mqh_used || mqh.questions || mqh.updates || mqh.connections;
|
||||
}
|
||||
if (old_row_exists)
|
||||
|
|
@ -2249,39 +2255,58 @@ 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 (columns.elements && !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++))
|
||||
{
|
||||
uint unused_field_idx= NO_CACHED_FIELD_INDEX;
|
||||
if (!find_field_in_table(thd,table,column->column.ptr(),
|
||||
column->column.length(),0,0,
|
||||
&unused_field_idx))
|
||||
if (!(table=open_ltable(thd,table_list,TL_READ)))
|
||||
DBUG_RETURN(-1);
|
||||
while ((column = column_iter++))
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR, MYF(0),
|
||||
column->column.c_ptr(), table_list->alias);
|
||||
DBUG_RETURN(-1);
|
||||
uint unused_field_idx= NO_CACHED_FIELD_INDEX;
|
||||
Field *f= find_field_in_table(thd,table,column->column.ptr(),
|
||||
column->column.length(),1,0,&unused_field_idx);
|
||||
if (!f)
|
||||
{
|
||||
my_error(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2766,25 +2791,8 @@ err:
|
|||
rw_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,ER_TABLEACCESS_DENIED_ERROR,
|
||||
command,
|
||||
thd->priv_user,
|
||||
|
|
@ -2899,11 +2907,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
|
|||
err:
|
||||
rw_unlock(&LOCK_grant);
|
||||
err2:
|
||||
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),
|
||||
|
|
|
|||
|
|
@ -427,6 +427,7 @@ abort:
|
|||
thd - thread handler
|
||||
table_list - global table list
|
||||
insert_table_list - local table list of INSERT SELECT_LEX
|
||||
values - values to insert. NULL for INSERT ... SELECT
|
||||
|
||||
RETURN VALUE
|
||||
0 - OK
|
||||
|
|
@ -442,7 +443,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
|
|||
if (duplic == DUP_UPDATE && !table->insert_values)
|
||||
{
|
||||
/* it should be allocated before Item::fix_fields() */
|
||||
table->insert_values=
|
||||
table->insert_values=
|
||||
(byte *)alloc_root(thd->mem_root, table->rec_buff_length);
|
||||
if (!table->insert_values)
|
||||
DBUG_RETURN(-1);
|
||||
|
|
@ -454,10 +455,8 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
|
|||
(setup_fields(thd, 0, insert_table_list, update_fields, 1, 0, 0) ||
|
||||
setup_fields(thd, 0, insert_table_list, update_values, 1, 0, 0))))
|
||||
DBUG_RETURN(-1);
|
||||
if ((thd->lex->sql_command==SQLCOM_INSERT ||
|
||||
thd->lex->sql_command==SQLCOM_REPLACE) &&
|
||||
find_real_table_in_list(table_list->next,
|
||||
table_list->db, table_list->real_name))
|
||||
if (values && find_real_table_in_list(table_list->next, table_list->db,
|
||||
table_list->real_name))
|
||||
{
|
||||
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
|
||||
DBUG_RETURN(-1);
|
||||
|
|
|
|||
|
|
@ -908,14 +908,15 @@ static int mysql_test_insert(Prepared_statement *stmt,
|
|||
uint value_count;
|
||||
ulong counter= 0;
|
||||
|
||||
table_list->table->insert_values=(byte *)1; // don't allocate insert_values
|
||||
if ((res= mysql_prepare_insert(thd, table_list, insert_table_list,
|
||||
table_list->table, fields, values,
|
||||
update_fields, update_values, duplic)))
|
||||
goto error;
|
||||
|
||||
|
||||
value_count= values->elements;
|
||||
its.rewind();
|
||||
|
||||
|
||||
while ((values= its++))
|
||||
{
|
||||
counter++;
|
||||
|
|
@ -934,6 +935,7 @@ static int mysql_test_insert(Prepared_statement *stmt,
|
|||
res= 0;
|
||||
error:
|
||||
lex->unit.cleanup();
|
||||
table_list->table->insert_values=0;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
|
@ -1513,28 +1515,6 @@ static bool init_param_array(Prepared_statement *stmt)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Init statement before execution */
|
||||
|
||||
static void cleanup_stmt_for_execute(Prepared_statement *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
LEX *lex= stmt->lex;
|
||||
SELECT_LEX *sl= lex->all_selects_list;
|
||||
|
||||
for (; sl; sl= sl->next_select_in_list())
|
||||
{
|
||||
for (TABLE_LIST *tables= (TABLE_LIST*) sl->table_list.first;
|
||||
tables;
|
||||
tables= tables->next)
|
||||
{
|
||||
if (tables->table)
|
||||
tables->table->insert_values= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Given a query string with parameter markers, create a Prepared Statement
|
||||
from it and send PS info back to the client.
|
||||
|
|
@ -1635,7 +1615,6 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
|||
|
||||
if (!error)
|
||||
error= send_prepare_results(stmt, test(name));
|
||||
cleanup_stmt_for_execute(stmt);
|
||||
|
||||
/* restore to WAIT_PRIOR: QUERY_PRIOR is set inside alloc_query */
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
|
|
@ -1926,7 +1905,6 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
|
|||
reset_stmt_params(stmt);
|
||||
close_thread_tables(thd); // to close derived tables
|
||||
thd->set_statement(&thd->stmt_backup);
|
||||
cleanup_stmt_for_execute(stmt);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2465,7 +2465,11 @@ err:
|
|||
send_ok(thd);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
|
||||
if (error == HA_ERR_ROW_IS_REFERENCED)
|
||||
my_error(ER_ROW_IS_REFERENCED, MYF(0));
|
||||
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -152,15 +152,22 @@ languages and applications need to dynamically load and use MySQL.
|
|||
|
||||
%package Max
|
||||
Release: %{release}
|
||||
Summary: MySQL - server with Berkeley DB, RAID and UDF support
|
||||
Summary: MySQL - server with extended functionality
|
||||
Group: Applications/Databases
|
||||
Provides: mysql-Max
|
||||
Obsoletes: mysql-Max
|
||||
Requires: MySQL-server >= 4.0
|
||||
|
||||
%description Max
|
||||
Optional MySQL server binary that supports additional features like
|
||||
Berkeley DB, RAID and User Defined Functions (UDFs).
|
||||
Optional MySQL server binary that supports additional features like:
|
||||
|
||||
- Berkeley DB Storage Engine
|
||||
- Archive Storage Engine
|
||||
- CSV Storage Engine
|
||||
- Example Storage Engine
|
||||
- MyISAM RAID
|
||||
- User Defined Functions (UDFs).
|
||||
|
||||
To activate this binary, just install this package in addition to
|
||||
the standard MySQL package.
|
||||
|
||||
|
|
@ -273,6 +280,9 @@ BuildMySQL "--enable-shared \
|
|||
--with-berkeley-db \
|
||||
--with-innodb \
|
||||
--with-raid \
|
||||
--with-archive \
|
||||
--with-csv-storage-engine \
|
||||
--with-example-storage-engine \
|
||||
--with-embedded-server \
|
||||
--with-server-suffix='-Max'"
|
||||
|
||||
|
|
@ -597,6 +607,12 @@ fi
|
|||
# itself - note that they must be ordered by date (important when
|
||||
# merging BK trees)
|
||||
%changelog
|
||||
* Thu Dec 31 2004 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- enabled the "Archive" storage engine for the max binary
|
||||
- enabled the "CSV" storage engine for the max binary
|
||||
- enabled the "Example" storage engine for the max binary
|
||||
|
||||
* Thu Aug 26 2004 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860)
|
||||
|
|
|
|||
22
vio/vio.c
22
vio/vio.c
|
|
@ -171,22 +171,24 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
|
|||
#ifdef HAVE_SMEM
|
||||
Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map,
|
||||
HANDLE event_server_wrote, HANDLE event_server_read,
|
||||
HANDLE event_client_wrote, HANDLE event_client_read)
|
||||
HANDLE event_client_wrote, HANDLE event_client_read,
|
||||
HANDLE event_conn_closed)
|
||||
{
|
||||
Vio *vio;
|
||||
DBUG_ENTER("vio_new_win32shared_memory");
|
||||
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
|
||||
{
|
||||
vio_reset(vio, VIO_TYPE_SHARED_MEMORY, 0, 0, TRUE);
|
||||
vio->handle_file_map = handle_file_map;
|
||||
vio->handle_map = handle_map;
|
||||
vio->event_server_wrote = event_server_wrote;
|
||||
vio->event_server_read = event_server_read;
|
||||
vio->event_client_wrote = event_client_wrote;
|
||||
vio->event_client_read = event_client_read;
|
||||
vio->shared_memory_remain = 0;
|
||||
vio->shared_memory_pos = handle_map;
|
||||
vio->net = net;
|
||||
vio->handle_file_map= handle_file_map;
|
||||
vio->handle_map= handle_map;
|
||||
vio->event_server_wrote= event_server_wrote;
|
||||
vio->event_server_read= event_server_read;
|
||||
vio->event_client_wrote= event_client_wrote;
|
||||
vio->event_client_read= event_client_read;
|
||||
vio->event_conn_closed= event_conn_closed;
|
||||
vio->shared_memory_remain= 0;
|
||||
vio->shared_memory_pos= handle_map;
|
||||
vio->net= net;
|
||||
strmov(vio->desc, "shared memory");
|
||||
}
|
||||
DBUG_RETURN(vio);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue