mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1
into zim.(none):/home/brian/mysql/partition-5.1
This commit is contained in:
commit
557c2d31e5
120 changed files with 2991 additions and 1209 deletions
|
@ -8,29 +8,16 @@ path=`dirname $0`
|
|||
CC=icc
|
||||
CXX=icpc
|
||||
CXXLD="$CXX -static-libcxa"
|
||||
export CC CXX
|
||||
|
||||
|
||||
extra_flags="$pentium_cflags $debug_cflags $max_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
||||
|
||||
# Disable following warnings as these are generated by header files:
|
||||
# 161 unrecognized pragma
|
||||
# 444 destructor for base class xxx is not virtual
|
||||
# 279 controlling expression is constant
|
||||
# 810 conversion from ulonglong to ulong with cast
|
||||
# 981 operands are evaluated in unspecified order
|
||||
# 1292 warning for unknown 'attribute' options
|
||||
# 1469 "xxx" clobber ignored
|
||||
# 1572 floating-point equality and inequality comparisons are unreliable
|
||||
|
||||
# In C++
|
||||
# 869 parameter "xxx" was never referenced
|
||||
# (Problem with virtual functions)
|
||||
# 874 support for placement delete is disabled
|
||||
export CC CXX CXXLD
|
||||
|
||||
c_warnings=""
|
||||
cxx_warnings=""
|
||||
extra_flags="-O3 -unroll2 -ip -mp -no-gcc -restrict"
|
||||
extra_flags="$fast_cflags -unroll2 -ip -mp -restrict"
|
||||
|
||||
# Use -no-ipo if you get this error
|
||||
# IPO link: can not find "-lstdc++_shared"
|
||||
# icpc: error: problem during multi-file optimization compilation (code 1)
|
||||
extra_flags="$extra_flags -no-ipo"
|
||||
base_cxxflags="-fno-exceptions -fno-rtti"
|
||||
extra_configs="$pentium_configs $static_link"
|
||||
|
||||
|
|
24
BUILD/compile-pentium-icc-yassl
Normal file
24
BUILD/compile-pentium-icc-yassl
Normal file
|
@ -0,0 +1,24 @@
|
|||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
# Note that we can't use ccache with icc as the generated .deps file will
|
||||
# then contain wrong information
|
||||
CC=icc
|
||||
CXX=icpc
|
||||
CXXLD="$CXX -static-libcxa"
|
||||
export CC CXX CXXLD
|
||||
|
||||
c_warnings=""
|
||||
cxx_warnings=""
|
||||
extra_flags="$fast_cflags -unroll2 -ip -mp -restrict"
|
||||
|
||||
# Use -no-ipo if you get this error
|
||||
# IPO link: can not find "-lstdc++_shared"
|
||||
# icpc: error: problem during multi-file optimization compilation (code 1)
|
||||
extra_flags="$extra_flags -no-ipo"
|
||||
base_cxxflags="-fno-exceptions -fno-rtti"
|
||||
extra_configs="$pentium_configs $static_link --with-yassl"
|
||||
|
||||
. "$path/FINISH.sh"
|
|
@ -317,6 +317,10 @@ SOURCE=.\mf_tempfile.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mf_unixpath.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mf_wcomp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1958,6 +1958,13 @@ AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
|
|||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
# Test whether madvise() is declared in C++ code -- it is not on some
|
||||
# systems, such as Solaris
|
||||
AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#endif])
|
||||
|
||||
# Do not treat warnings as errors if we are linking against other libc
|
||||
# this is to work around gcc not being permissive on non-system includes
|
||||
# with respect to ANSI C++
|
||||
|
|
|
@ -93,11 +93,15 @@ void Socket::closeSocket()
|
|||
|
||||
uint Socket::get_ready() const
|
||||
{
|
||||
unsigned long ready = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
unsigned long ready = 0;
|
||||
ioctlsocket(socket_, FIONREAD, &ready);
|
||||
#else
|
||||
/*
|
||||
64-bit Solaris requires the variable passed to
|
||||
FIONREAD be a 32-bit value.
|
||||
*/
|
||||
int ready = 0;
|
||||
ioctl(socket_, FIONREAD, &ready);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -96,6 +96,13 @@ public:
|
|||
#endif
|
||||
|
||||
|
||||
// Disable assmebler when compiling with icc
|
||||
// Temporary workaround for bug12717
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define TAOCRYPT_DISABLE_X86ASM
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// CodeWarrior defines _MSC_VER
|
||||
#if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct st_mem_root
|
|||
unsigned int block_num; /* allocated blocks counter */
|
||||
/*
|
||||
first free block in queue test counter (if it exceed
|
||||
MAX_BLOCK_USAGE_BEFORE_DROP block will be droped in 'used' list)
|
||||
MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
|
||||
*/
|
||||
unsigned int first_block_usage;
|
||||
|
||||
|
|
|
@ -419,6 +419,10 @@ C_MODE_END
|
|||
#undef setrlimit
|
||||
#define setrlimit cma_setrlimit64
|
||||
#endif
|
||||
/* Declare madvise where it is not declared for C++, like Solaris */
|
||||
#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus)
|
||||
extern "C" int madvise(void *addr, size_t len, int behav);
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
/* This has to be after include limits.h */
|
||||
|
|
|
@ -98,6 +98,7 @@ extern int NEAR my_errno; /* Last error in mysys */
|
|||
#define MY_RETURN_REAL_PATH 32 /* return full path for file */
|
||||
#define MY_SAFE_PATH 64 /* Return NULL if too long path */
|
||||
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
|
||||
#define MY_UNIX_PATH 256 /* convert path to UNIX format */
|
||||
|
||||
/* My seek flags */
|
||||
#define MY_SEEK_SET 0
|
||||
|
|
|
@ -50,6 +50,7 @@ dist-hook:
|
|||
$(distdir)/std_data $(distdir)/lib
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
|
||||
|
@ -73,6 +74,7 @@ install-data-local:
|
|||
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(DESTDIR)$(testdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
|
||||
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
|
||||
$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
|
||||
|
|
137
mysql-test/include/mysqltest_while.inc
Normal file
137
mysql-test/include/mysqltest_while.inc
Normal file
|
@ -0,0 +1,137 @@
|
|||
let $1 = 10;
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
while ($1)
|
||||
{
|
||||
echo $1;
|
||||
dec $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4
mysql-test/include/windows.inc
Normal file
4
mysql-test/include/windows.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
--require r/true.require
|
||||
disable_query_log;
|
||||
select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE";
|
||||
enable_query_log;
|
|
@ -8,7 +8,7 @@ use File::Basename;
|
|||
use strict;
|
||||
|
||||
sub collect_test_cases ($);
|
||||
sub collect_one_test_case ($$$$$$);
|
||||
sub collect_one_test_case ($$$$$$$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -40,13 +40,84 @@ sub collect_test_cases ($) {
|
|||
if ( @::opt_cases )
|
||||
{
|
||||
foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort
|
||||
$tname= basename($tname, ".test");
|
||||
my $elem= "$tname.test";
|
||||
if ( ! -f "$testdir/$elem")
|
||||
my $elem= undef;
|
||||
my $component_id= undef;
|
||||
|
||||
# Get rid of directory part (path). Leave the extension since it is used
|
||||
# to understand type of the test.
|
||||
|
||||
$tname = basename($tname);
|
||||
|
||||
# Check if the extenstion has been specified.
|
||||
|
||||
if ( mtr_match_extension($tname, "test") )
|
||||
{
|
||||
mtr_error("Test case $tname ($testdir/$elem) is not found");
|
||||
$elem= $tname;
|
||||
$tname=~ s/\.test$//;
|
||||
$component_id= 'mysqld';
|
||||
}
|
||||
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{});
|
||||
elsif ( mtr_match_extension($tname, "imtest") )
|
||||
{
|
||||
$elem= $tname;
|
||||
$tname =~ s/\.imtest$//;
|
||||
$component_id= 'im';
|
||||
|
||||
if ( $::glob_use_embedded_server )
|
||||
{
|
||||
mtr_report(
|
||||
"Instance Manager's tests are not available in embedded mode." .
|
||||
"Test case '$tname' is skipped.");
|
||||
next;
|
||||
}
|
||||
|
||||
unless ( $::exe_im )
|
||||
{
|
||||
mtr_report(
|
||||
"Instance Manager executable is unavailable. " .
|
||||
"Test case '$tname' is skipped.");
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# If target component is known, check that the specified test case
|
||||
# exists.
|
||||
#
|
||||
# Otherwise, try to guess the target component.
|
||||
|
||||
if ( defined $component_id )
|
||||
{
|
||||
if ( ! -f "$testdir/$elem")
|
||||
{
|
||||
mtr_error("Test case $tname ($testdir/$elem) is not found");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my $mysqld_test_exists = -f "$testdir/$tname.test";
|
||||
my $im_test_exists = -f "$testdir/$tname.imtest";
|
||||
|
||||
if ( $mysqld_test_exists && $im_test_exists )
|
||||
{
|
||||
mtr_error("Ambiguos test case name ($tname)");
|
||||
}
|
||||
elsif ( ! $mysqld_test_exists && !$im_test_exists )
|
||||
{
|
||||
mtr_error("Test case $tname is not found");
|
||||
}
|
||||
elsif ( $mysqld_test_exists )
|
||||
{
|
||||
$elem= "$tname.test";
|
||||
$component_id= 'mysqld';
|
||||
}
|
||||
elsif ( $im_test_exists )
|
||||
{
|
||||
$elem= "$tname.imtest";
|
||||
$component_id= 'im';
|
||||
}
|
||||
}
|
||||
|
||||
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{},
|
||||
$component_id);
|
||||
}
|
||||
closedir TESTDIR;
|
||||
}
|
||||
|
@ -70,11 +141,26 @@ sub collect_test_cases ($) {
|
|||
}
|
||||
|
||||
foreach my $elem ( sort readdir(TESTDIR) ) {
|
||||
my $tname= mtr_match_extension($elem,"test");
|
||||
next if ! defined $tname;
|
||||
my $component_id= undef;
|
||||
my $tname= undef;
|
||||
|
||||
if ($tname= mtr_match_extension($elem, 'test'))
|
||||
{
|
||||
$component_id = 'mysqld';
|
||||
}
|
||||
elsif ($tname= mtr_match_extension($elem, 'imtest'))
|
||||
{
|
||||
$component_id = 'im';
|
||||
}
|
||||
else
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test);
|
||||
|
||||
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled);
|
||||
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled,
|
||||
$component_id);
|
||||
}
|
||||
closedir TESTDIR;
|
||||
}
|
||||
|
@ -112,13 +198,14 @@ sub collect_test_cases ($) {
|
|||
##############################################################################
|
||||
|
||||
|
||||
sub collect_one_test_case($$$$$$) {
|
||||
sub collect_one_test_case($$$$$$$) {
|
||||
my $testdir= shift;
|
||||
my $resdir= shift;
|
||||
my $tname= shift;
|
||||
my $elem= shift;
|
||||
my $cases= shift;
|
||||
my $disabled=shift;
|
||||
my $component_id= shift;
|
||||
|
||||
my $path= "$testdir/$elem";
|
||||
|
||||
|
@ -138,6 +225,7 @@ sub collect_one_test_case($$$$$$) {
|
|||
my $tinfo= {};
|
||||
$tinfo->{'name'}= $tname;
|
||||
$tinfo->{'result_file'}= "$resdir/$tname.result";
|
||||
$tinfo->{'component_id'} = $component_id;
|
||||
push(@$cases, $tinfo);
|
||||
|
||||
if ( $::opt_skip_test and defined mtr_match_prefix($tname,$::opt_skip_test) )
|
||||
|
@ -188,6 +276,7 @@ sub collect_one_test_case($$$$$$) {
|
|||
my $master_sh= "$testdir/$tname-master.sh";
|
||||
my $slave_sh= "$testdir/$tname-slave.sh";
|
||||
my $disabled_file= "$testdir/$tname.disabled";
|
||||
my $im_opt_file= "$testdir/$tname-im.opt";
|
||||
|
||||
$tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
|
||||
$tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
|
||||
|
@ -290,6 +379,15 @@ sub collect_one_test_case($$$$$$) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( -f $im_opt_file )
|
||||
{
|
||||
$tinfo->{'im_opts'} = mtr_get_opts_from_file($im_opt_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tinfo->{'im_opts'} = [];
|
||||
}
|
||||
|
||||
# FIXME why this late?
|
||||
if ( $disabled->{$tname} )
|
||||
{
|
||||
|
|
|
@ -12,16 +12,17 @@ use strict;
|
|||
#use POSIX ":sys_wait_h";
|
||||
use POSIX 'WNOHANG';
|
||||
|
||||
sub mtr_run ($$$$$$);
|
||||
sub mtr_spawn ($$$$$$);
|
||||
sub mtr_run ($$$$$$;$);
|
||||
sub mtr_spawn ($$$$$$;$);
|
||||
sub mtr_stop_mysqld_servers ($);
|
||||
sub mtr_kill_leftovers ();
|
||||
sub mtr_record_dead_children ();
|
||||
sub mtr_exit ($);
|
||||
sub sleep_until_file_created ($$$);
|
||||
sub mtr_kill_processes ($);
|
||||
|
||||
# static in C
|
||||
sub spawn_impl ($$$$$$$);
|
||||
sub spawn_impl ($$$$$$$$);
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -32,37 +33,43 @@ sub spawn_impl ($$$$$$$);
|
|||
# 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 ($$$$$$) {
|
||||
sub mtr_run ($$$$$$;$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $spawn_opts= shift;
|
||||
|
||||
return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file);
|
||||
return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file,
|
||||
$spawn_opts);
|
||||
}
|
||||
|
||||
sub mtr_run_test ($$$$$$) {
|
||||
sub mtr_run_test ($$$$$$;$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $spawn_opts= shift;
|
||||
|
||||
return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file);
|
||||
return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file,
|
||||
$spawn_opts);
|
||||
}
|
||||
|
||||
sub mtr_spawn ($$$$$$) {
|
||||
sub mtr_spawn ($$$$$$;$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $input= shift;
|
||||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift;
|
||||
my $spawn_opts= shift;
|
||||
|
||||
return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file);
|
||||
return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file,
|
||||
$spawn_opts);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +79,7 @@ sub mtr_spawn ($$$$$$) {
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
sub spawn_impl ($$$$$$$) {
|
||||
sub spawn_impl ($$$$$$$$) {
|
||||
my $path= shift;
|
||||
my $arg_list_t= shift;
|
||||
my $mode= shift;
|
||||
|
@ -80,6 +87,7 @@ sub spawn_impl ($$$$$$$) {
|
|||
my $output= shift;
|
||||
my $error= shift;
|
||||
my $pid_file= shift; # FIXME
|
||||
my $spawn_opts= shift;
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
|
@ -89,6 +97,18 @@ sub spawn_impl ($$$$$$$) {
|
|||
print STDERR "#### ", "STDOUT $output\n" if $output;
|
||||
print STDERR "#### ", "STDERR $error\n" if $error;
|
||||
print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
|
||||
print STDERR "#### ", "spawn options:\n";
|
||||
if ($spawn_opts)
|
||||
{
|
||||
foreach my $key (sort keys %{$spawn_opts})
|
||||
{
|
||||
print STDERR "#### ", " - $key: $spawn_opts->{$key}\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "#### ", " none\n";
|
||||
}
|
||||
print STDERR "#### ", "-" x 78, "\n";
|
||||
}
|
||||
|
||||
|
@ -135,9 +155,16 @@ sub spawn_impl ($$$$$$$) {
|
|||
# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
|
||||
}
|
||||
|
||||
my $log_file_open_mode = '>';
|
||||
|
||||
if ($spawn_opts and $spawn_opts->{'append_log_file'})
|
||||
{
|
||||
$log_file_open_mode = '>>';
|
||||
}
|
||||
|
||||
if ( $output )
|
||||
{
|
||||
if ( ! open(STDOUT,">",$output) )
|
||||
if ( ! open(STDOUT,$log_file_open_mode,$output) )
|
||||
{
|
||||
mtr_error("can't redirect STDOUT to \"$output\": $!");
|
||||
}
|
||||
|
@ -154,9 +181,9 @@ sub spawn_impl ($$$$$$$) {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( ! open(STDERR,">",$error) )
|
||||
if ( ! open(STDERR,$log_file_open_mode,$error) )
|
||||
{
|
||||
mtr_error("can't redirect STDERR to \"$output\": $!");
|
||||
mtr_error("can't redirect STDERR to \"$error\": $!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -533,17 +560,8 @@ sub mtr_stop_mysqld_servers ($) {
|
|||
|
||||
start_reap_all(); # Avoid zombies
|
||||
|
||||
SIGNAL:
|
||||
foreach my $sig (15,9)
|
||||
{
|
||||
my $retries= 20; # FIXME 20 seconds, this is silly!
|
||||
kill($sig, keys %mysqld_pids);
|
||||
while ( $retries-- and kill(0, keys %mysqld_pids) )
|
||||
{
|
||||
mtr_debug("Sleep 1 second waiting for processes to die");
|
||||
sleep(1) # Wait one second
|
||||
}
|
||||
}
|
||||
my @mysqld_pids= keys %mysqld_pids;
|
||||
mtr_kill_processes(\@mysqld_pids);
|
||||
|
||||
stop_reap_all(); # Get into control again
|
||||
|
||||
|
@ -805,7 +823,7 @@ sub sleep_until_file_created ($$$) {
|
|||
}
|
||||
|
||||
# Check if it died after the fork() was successful
|
||||
if ( waitpid($pid,&WNOHANG) == $pid )
|
||||
if ( $pid > 0 && waitpid($pid,&WNOHANG) == $pid )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -826,6 +844,21 @@ sub sleep_until_file_created ($$$) {
|
|||
}
|
||||
|
||||
|
||||
sub mtr_kill_processes ($) {
|
||||
my $pids = shift;
|
||||
|
||||
foreach my $sig (15,9)
|
||||
{
|
||||
my $retries= 20; # FIXME 20 seconds, this is silly!
|
||||
kill($sig, @{$pids});
|
||||
while ( $retries-- and kill(0, @{$pids}) )
|
||||
{
|
||||
mtr_debug("Sleep 1 second waiting for processes to die");
|
||||
sleep(1) # Wait one second
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# When we exit, we kill off all children
|
||||
|
|
|
@ -178,6 +178,7 @@ our $exe_mysqlshow; # Called from test case
|
|||
our $exe_mysql_fix_system_tables;
|
||||
our $exe_mysqltest;
|
||||
our $exe_slave_mysqld;
|
||||
our $exe_im;
|
||||
|
||||
our $opt_bench= 0;
|
||||
our $opt_small_bench= 0;
|
||||
|
@ -216,6 +217,8 @@ our $opt_local_master;
|
|||
our $master; # Will be struct in C
|
||||
our $slave;
|
||||
|
||||
our $instance_manager;
|
||||
|
||||
our $opt_ndbcluster_port;
|
||||
our $opt_ndbconnectstring;
|
||||
|
||||
|
@ -309,6 +312,8 @@ sub mysqld_arguments ($$$$$);
|
|||
sub stop_masters_slaves ();
|
||||
sub stop_masters ();
|
||||
sub stop_slaves ();
|
||||
sub im_start ($$);
|
||||
sub im_stop ($);
|
||||
sub run_mysqltest ($);
|
||||
sub usage ($);
|
||||
|
||||
|
@ -460,6 +465,9 @@ sub command_line_setup () {
|
|||
my $opt_master_myport= 9306;
|
||||
my $opt_slave_myport= 9308;
|
||||
$opt_ndbcluster_port= 9350;
|
||||
my $im_port= 9310;
|
||||
my $im_mysqld1_port= 9312;
|
||||
my $im_mysqld2_port= 9314;
|
||||
|
||||
# Read the command line
|
||||
# Note: Keep list, and the order, in sync with usage at end of this file
|
||||
|
@ -486,6 +494,9 @@ sub command_line_setup () {
|
|||
'slave_port=i' => \$opt_slave_myport,
|
||||
'ndbcluster_port=i' => \$opt_ndbcluster_port,
|
||||
'manager-port=i' => \$opt_manager_port, # Currently not used
|
||||
'im-port=i' => \$im_port, # Instance Manager port.
|
||||
'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
|
||||
'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
|
||||
|
||||
# Test case authoring
|
||||
'record' => \$opt_record,
|
||||
|
@ -768,6 +779,37 @@ sub command_line_setup () {
|
|||
$slave->[2]->{'path_myport'}= $opt_slave_myport + 2;
|
||||
$slave->[2]->{'start_timeout'}= 300;
|
||||
|
||||
$instance_manager->{'path_err'}= "$opt_vardir/log/im.err";
|
||||
$instance_manager->{'path_log'}= "$opt_vardir/log/im.log";
|
||||
$instance_manager->{'path_pid'}= "$opt_vardir/run/im.pid";
|
||||
$instance_manager->{'path_sock'}= "$opt_tmpdir/im.sock";
|
||||
$instance_manager->{'port'}= $im_port;
|
||||
$instance_manager->{'start_timeout'}= $master->[0]->{'start_timeout'};
|
||||
$instance_manager->{'admin_login'}= 'im_admin';
|
||||
$instance_manager->{'admin_password'}= 'im_admin_secret';
|
||||
$instance_manager->{'admin_sha1'}= '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295';
|
||||
$instance_manager->{'password_file'}= "$opt_vardir/im.passwd";
|
||||
$instance_manager->{'defaults_file'}= "$opt_vardir/im.cnf";
|
||||
|
||||
$instance_manager->{'instances'}->[0]->{'server_id'}= 1;
|
||||
$instance_manager->{'instances'}->[0]->{'port'}= $im_mysqld1_port;
|
||||
$instance_manager->{'instances'}->[0]->{'path_datadir'}=
|
||||
"$opt_vardir/im_mysqld_1.data";
|
||||
$instance_manager->{'instances'}->[0]->{'path_sock'}=
|
||||
"$opt_vardir/mysqld_1.sock";
|
||||
$instance_manager->{'instances'}->[0]->{'path_pid'}=
|
||||
"$opt_vardir/mysqld_1.pid";
|
||||
|
||||
$instance_manager->{'instances'}->[1]->{'server_id'}= 2;
|
||||
$instance_manager->{'instances'}->[1]->{'port'}= $im_mysqld2_port;
|
||||
$instance_manager->{'instances'}->[1]->{'path_datadir'}=
|
||||
"$opt_vardir/im_mysqld_2.data";
|
||||
$instance_manager->{'instances'}->[1]->{'path_sock'}=
|
||||
"$opt_vardir/mysqld_2.sock";
|
||||
$instance_manager->{'instances'}->[1]->{'path_pid'}=
|
||||
"$opt_vardir/mysqld_2.pid";
|
||||
$instance_manager->{'instances'}->[1]->{'nonguarded'}= 1;
|
||||
|
||||
if ( $opt_extern )
|
||||
{
|
||||
$glob_use_running_server= 1;
|
||||
|
@ -803,6 +845,9 @@ sub executable_setup () {
|
|||
$exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld");
|
||||
$path_language= mtr_path_exists("$glob_basedir/sql/share/english/");
|
||||
$path_charsetsdir= mtr_path_exists("$glob_basedir/sql/share/charsets");
|
||||
|
||||
$exe_im= mtr_exe_exists(
|
||||
"$glob_basedir/server-tools/instance-manager/mysqlmanager");
|
||||
}
|
||||
|
||||
if ( $glob_use_embedded_server )
|
||||
|
@ -850,6 +895,8 @@ sub executable_setup () {
|
|||
$exe_mysqld= mtr_exe_exists ("$glob_basedir/libexec/mysqld",
|
||||
"$glob_basedir/bin/mysqld");
|
||||
|
||||
$exe_im= mtr_exe_exists("$glob_basedir/libexec/mysqlmanager",
|
||||
"$glob_basedir/bin/mysqlmanager");
|
||||
if ( $glob_use_embedded_server )
|
||||
{
|
||||
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest_embedded");
|
||||
|
@ -923,6 +970,11 @@ sub environment_setup () {
|
|||
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
|
||||
$ENV{'MYSQL_TCP_PORT'}= 3306;
|
||||
|
||||
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
|
||||
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
|
||||
$ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
|
||||
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
|
||||
|
||||
if ( $glob_cygwin_perl )
|
||||
{
|
||||
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
|
||||
|
@ -1006,25 +1058,24 @@ sub kill_and_cleanup () {
|
|||
# FIXME do we really need to create these all, or are they
|
||||
# created for us when tables are created?
|
||||
|
||||
rmtree("$master->[0]->{'path_myddir'}");
|
||||
mkpath("$master->[0]->{'path_myddir'}/mysql");
|
||||
mkpath("$master->[0]->{'path_myddir'}/test");
|
||||
my @data_dir_lst = (
|
||||
$master->[0]->{'path_myddir'},
|
||||
$master->[1]->{'path_myddir'},
|
||||
$slave->[0]->{'path_myddir'},
|
||||
$slave->[1]->{'path_myddir'},
|
||||
$slave->[2]->{'path_myddir'});
|
||||
|
||||
foreach my $instance (@{$instance_manager->{'instances'}})
|
||||
{
|
||||
push (@data_dir_lst, $instance->{'path_datadir'});
|
||||
}
|
||||
|
||||
rmtree("$master->[1]->{'path_myddir'}");
|
||||
mkpath("$master->[1]->{'path_myddir'}/mysql");
|
||||
mkpath("$master->[1]->{'path_myddir'}/test");
|
||||
|
||||
rmtree("$slave->[0]->{'path_myddir'}");
|
||||
mkpath("$slave->[0]->{'path_myddir'}/mysql");
|
||||
mkpath("$slave->[0]->{'path_myddir'}/test");
|
||||
|
||||
rmtree("$slave->[1]->{'path_myddir'}");
|
||||
mkpath("$slave->[1]->{'path_myddir'}/mysql");
|
||||
mkpath("$slave->[1]->{'path_myddir'}/test");
|
||||
|
||||
rmtree("$slave->[2]->{'path_myddir'}");
|
||||
mkpath("$slave->[2]->{'path_myddir'}/mysql");
|
||||
mkpath("$slave->[2]->{'path_myddir'}/test");
|
||||
foreach my $data_dir (@data_dir_lst)
|
||||
{
|
||||
rmtree("$data_dir");
|
||||
mkpath("$data_dir/mysql");
|
||||
mkpath("$data_dir/test");
|
||||
}
|
||||
|
||||
# To make some old test cases work, we create a soft
|
||||
# link from the old "var" location to the new one
|
||||
|
@ -1262,6 +1313,11 @@ sub mysql_install_db () {
|
|||
install_db('slave', $slave->[1]->{'path_myddir'});
|
||||
install_db('slave', $slave->[2]->{'path_myddir'});
|
||||
|
||||
if ( defined $exe_im)
|
||||
{
|
||||
im_prepare_env($instance_manager);
|
||||
}
|
||||
|
||||
if ( ndbcluster_install() )
|
||||
{
|
||||
# failed to install, disable usage but flag that its no ok
|
||||
|
@ -1336,6 +1392,101 @@ sub install_db ($$) {
|
|||
}
|
||||
|
||||
|
||||
sub im_prepare_env($) {
|
||||
my $instance_manager = shift;
|
||||
|
||||
im_create_passwd_file($instance_manager);
|
||||
im_prepare_data_dir($instance_manager);
|
||||
}
|
||||
|
||||
|
||||
sub im_create_passwd_file($) {
|
||||
my $instance_manager = shift;
|
||||
|
||||
my $pwd_file_path = $instance_manager->{'password_file'};
|
||||
|
||||
mtr_report("Creating IM password file ($pwd_file_path)");
|
||||
|
||||
open(OUT, ">", $pwd_file_path)
|
||||
or mtr_error("Can't write to $pwd_file_path: $!");
|
||||
|
||||
print OUT $instance_manager->{'admin_login'}, ":",
|
||||
$instance_manager->{'admin_sha1'}, "\n";
|
||||
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
|
||||
sub im_create_defaults_file($) {
|
||||
my $instance_manager = shift;
|
||||
|
||||
my $defaults_file = $instance_manager->{'defaults_file'};
|
||||
|
||||
open(OUT, ">", $defaults_file)
|
||||
or mtr_error("Can't write to $defaults_file: $!");
|
||||
|
||||
print OUT <<EOF
|
||||
[mysql]
|
||||
|
||||
[manager]
|
||||
pid-file = $instance_manager->{path_pid}
|
||||
socket = $instance_manager->{path_sock}
|
||||
port = $instance_manager->{port}
|
||||
password-file = $instance_manager->{password_file}
|
||||
default-mysqld-path = $exe_mysqld
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
foreach my $instance (@{$instance_manager->{'instances'}})
|
||||
{
|
||||
my $server_id = $instance->{'server_id'};
|
||||
|
||||
print OUT <<EOF
|
||||
[mysqld$server_id]
|
||||
socket = $instance->{path_sock}
|
||||
pid-file = $instance->{path_pid}
|
||||
port = $instance->{port}
|
||||
datadir = $instance->{path_datadir}
|
||||
log = $instance->{path_datadir}/mysqld$server_id.log
|
||||
log-error = $instance->{path_datadir}/mysqld$server_id.err.log
|
||||
log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
|
||||
language = $path_language
|
||||
character-sets-dir = $path_charsetsdir
|
||||
basedir = $path_my_basedir
|
||||
server_id =$server_id
|
||||
skip-stack-trace
|
||||
skip-innodb
|
||||
skip-bdb
|
||||
skip-ndbcluster
|
||||
EOF
|
||||
;
|
||||
|
||||
if ( exists $instance->{nonguarded} and
|
||||
defined $instance->{nonguarded} )
|
||||
{
|
||||
print OUT "nonguarded\n";
|
||||
}
|
||||
|
||||
print OUT "\n";
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
|
||||
sub im_prepare_data_dir($) {
|
||||
my $instance_manager = shift;
|
||||
|
||||
foreach my $instance (@{$instance_manager->{'instances'}})
|
||||
{
|
||||
install_db(
|
||||
'im_mysqld_' . $instance->{'server_id'},
|
||||
$instance->{'path_datadir'});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Run a single test case
|
||||
|
@ -1437,7 +1588,7 @@ sub run_testcase ($) {
|
|||
# FIXME split up start and check that started so that can do
|
||||
# starts in parallel, masters and slaves at the same time.
|
||||
|
||||
if ( ! $opt_local_master )
|
||||
if ( $tinfo->{'component_id'} eq 'mysqld' and ! $opt_local_master )
|
||||
{
|
||||
if ( $master->[0]->{'ndbcluster'} )
|
||||
{
|
||||
|
@ -1476,6 +1627,17 @@ sub run_testcase ($) {
|
|||
$master->[0]->{'running_master_is_special'}= 1;
|
||||
}
|
||||
}
|
||||
elsif ( $tinfo->{'component_id'} eq 'im')
|
||||
{
|
||||
# We have to create defaults file every time, in order to ensure that it
|
||||
# will be the same for each test. The problem is that test can change the
|
||||
# file (by SET/UNSET commands), so w/o recreating the file, execution of
|
||||
# one test can affect the other.
|
||||
|
||||
im_create_defaults_file($instance_manager);
|
||||
|
||||
im_start($instance_manager, $tinfo->{im_opts});
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Start slaves - if needed
|
||||
|
@ -1558,6 +1720,15 @@ sub run_testcase ($) {
|
|||
report_failure_and_restart($tinfo);
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Stop Instance Manager if we are processing an IM-test case.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
|
||||
{
|
||||
im_stop($instance_manager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1988,6 +2159,13 @@ sub mysqld_start ($$$$) {
|
|||
sub stop_masters_slaves () {
|
||||
|
||||
print "Ending Tests\n";
|
||||
|
||||
if (defined $instance_manager->{'pid'})
|
||||
{
|
||||
print "Shutting-down Instance Manager\n";
|
||||
im_stop($instance_manager);
|
||||
}
|
||||
|
||||
print "Shutting-down MySQL daemon\n\n";
|
||||
stop_masters();
|
||||
print "Master(s) shutdown finished\n";
|
||||
|
@ -2046,6 +2224,97 @@ sub stop_slaves () {
|
|||
mtr_stop_mysqld_servers(\@args);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Instance Manager management routines.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub im_start($$) {
|
||||
my $instance_manager = shift;
|
||||
my $opts = shift;
|
||||
|
||||
if ( ! defined $exe_im)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
mtr_add_arg($args, "--defaults-file=" . $instance_manager->{'defaults_file'});
|
||||
|
||||
foreach my $opt (@{$opts})
|
||||
{
|
||||
mtr_add_arg($args, $opt);
|
||||
}
|
||||
|
||||
$instance_manager->{'pid'} =
|
||||
mtr_spawn(
|
||||
$exe_im, # path to the executable
|
||||
$args, # cmd-line args
|
||||
'', # stdin
|
||||
$instance_manager->{'path_log'}, # stdout
|
||||
$instance_manager->{'path_err'}, # stderr
|
||||
'', # pid file path (not used)
|
||||
{ append_log_file => 1 } # append log files
|
||||
);
|
||||
|
||||
if ( ! defined $instance_manager->{'pid'} )
|
||||
{
|
||||
mtr_report('Could not start Instance Manager');
|
||||
return;
|
||||
}
|
||||
|
||||
# Instance Manager can be run in daemon mode. In this case, it creates
|
||||
# several processes and the parent process, created by mtr_spawn(), exits just
|
||||
# after start. So, we have to obtain Instance Manager PID from the PID file.
|
||||
|
||||
sleep_until_file_created(
|
||||
$instance_manager->{'path_pid'},
|
||||
$instance_manager->{'start_timeout'},
|
||||
-1); # real PID is still unknown
|
||||
|
||||
$instance_manager->{'pid'} =
|
||||
mtr_get_pid_from_file($instance_manager->{'path_pid'});
|
||||
}
|
||||
|
||||
sub im_stop($) {
|
||||
my $instance_manager = shift;
|
||||
|
||||
if (! defined $instance_manager->{'pid'})
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
# Inspired from mtr_stop_mysqld_servers().
|
||||
|
||||
start_reap_all();
|
||||
|
||||
# Create list of pids. We should stop Instance Manager and all started
|
||||
# mysqld-instances. Some of them may be nonguarded, so IM will not stop them
|
||||
# on shutdown.
|
||||
|
||||
my @pids = ( $instance_manager->{'pid'} );
|
||||
my $instances = $instance_manager->{'instances'};
|
||||
|
||||
if ( -r $instances->[0]->{'path_pid'} )
|
||||
{
|
||||
push @pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'});
|
||||
}
|
||||
|
||||
if ( -r $instances->[1]->{'path_pid'} )
|
||||
{
|
||||
push @pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'});
|
||||
}
|
||||
|
||||
# Kill processes.
|
||||
|
||||
mtr_kill_processes(\@pids);
|
||||
|
||||
stop_reap_all();
|
||||
|
||||
$instance_manager->{'pid'} = undef;
|
||||
}
|
||||
|
||||
sub run_mysqltest ($) {
|
||||
my $tinfo= shift;
|
||||
|
@ -2069,7 +2338,9 @@ sub run_mysqltest ($) {
|
|||
}
|
||||
|
||||
my $cmdline_mysqlbinlog=
|
||||
"$exe_mysqlbinlog --no-defaults --local-load=$opt_tmpdir --character-sets-dir=$path_charsetsdir";
|
||||
"$exe_mysqlbinlog" .
|
||||
" --no-defaults --local-load=$opt_tmpdir" .
|
||||
" --character-sets-dir=$path_charsetsdir";
|
||||
|
||||
if ( $opt_debug )
|
||||
{
|
||||
|
@ -2127,15 +2398,26 @@ sub run_mysqltest ($) {
|
|||
mtr_init_args(\$args);
|
||||
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
|
||||
mtr_add_arg($args, "--database=test");
|
||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||
mtr_add_arg($args, "--password=");
|
||||
mtr_add_arg($args, "--silent");
|
||||
mtr_add_arg($args, "-v");
|
||||
mtr_add_arg($args, "--skip-safemalloc");
|
||||
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
|
||||
mtr_add_arg($args, "--port=%d", $master->[0]->{'path_myport'});
|
||||
|
||||
if ($tinfo->{'component_id'} eq 'im')
|
||||
{
|
||||
mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
|
||||
mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
|
||||
mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
|
||||
mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
|
||||
}
|
||||
else # component_id == mysqld
|
||||
{
|
||||
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
|
||||
mtr_add_arg($args, "--port=%d", $master->[0]->{'path_myport'});
|
||||
mtr_add_arg($args, "--database=test");
|
||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||
mtr_add_arg($args, "--password=");
|
||||
}
|
||||
|
||||
if ( $opt_ps_protocol )
|
||||
{
|
||||
|
@ -2202,6 +2484,11 @@ sub run_mysqltest ($) {
|
|||
mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# export MYSQL_TEST variable containing <path>/mysqltest <args>
|
||||
# ----------------------------------------------------------------------
|
||||
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
|
||||
|
||||
return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
|
||||
}
|
||||
|
||||
|
@ -2224,7 +2511,6 @@ Options to control what engine/variation to run
|
|||
ps-protocol Use the binary protocol between client and server
|
||||
bench Run the benchmark suite FIXME
|
||||
small-bench FIXME
|
||||
no-manager Use the istanse manager (currently disabled)
|
||||
|
||||
Options to control what test suites or cases to run
|
||||
|
||||
|
@ -2241,7 +2527,6 @@ Options that specify ports
|
|||
master_port=PORT Specify the port number used by the first master
|
||||
slave_port=PORT Specify the port number used by the first slave
|
||||
ndbcluster_port=PORT Specify the port number used by cluster
|
||||
manager-port=PORT Specify the port number used by manager (currently not used)
|
||||
|
||||
Options for test case authoring
|
||||
|
||||
|
|
|
@ -733,6 +733,7 @@ if [ x$USE_TIMER = x1 ] ; then
|
|||
fi
|
||||
MYSQL_TEST_BIN=$MYSQL_TEST
|
||||
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
|
||||
export MYSQL_TEST
|
||||
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
|
||||
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
|
||||
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
|
||||
|
|
|
@ -595,3 +595,4 @@ alter table t1 add unique key (i, v);
|
|||
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
|
||||
i v
|
||||
4 3r4f
|
||||
drop table t1;
|
||||
|
|
|
@ -596,6 +596,12 @@ ERROR 42000: Incorrect database name 'xyz'
|
|||
create table t1(t1.name int);
|
||||
create table t2(test.t2.name int);
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
|
||||
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
|
||||
DESC t2;
|
||||
Field Type Null Key Default Extra
|
||||
f2 varchar(171) YES NULL
|
||||
DROP TABLE t1,t2;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
drop database mysqltest;
|
||||
|
|
|
@ -555,3 +555,6 @@ FROM t1 JOIN t2 ON t1.bID = t2.bID;
|
|||
COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
|
||||
2 test
|
||||
DROP TABLE t1,t2;
|
||||
select * from (select group_concat('c') from DUAL) t;
|
||||
group_concat('c')
|
||||
NULL
|
||||
|
|
|
@ -312,3 +312,12 @@ flush privileges;
|
|||
drop database mysqltest_1;
|
||||
set password = password("changed");
|
||||
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
|
||||
lock table mysql.user write;
|
||||
flush privileges;
|
||||
grant all on *.* to 'mysqltest_1'@'localhost';
|
||||
unlock tables;
|
||||
lock table mysql.user write;
|
||||
set password for 'mysqltest_1'@'localhost' = password('');
|
||||
revoke all on *.* from 'mysqltest_1'@'localhost';
|
||||
unlock tables;
|
||||
drop user 'mysqltest_1'@'localhost';
|
||||
|
|
|
@ -1984,7 +1984,7 @@ Table Op Msg_type Msg_text
|
|||
test.t1 analyze status Table is already up to date
|
||||
explain select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE bug12672 range PRIMARY PRIMARY 4 NULL 93 Using where; Using temporary
|
||||
1 SIMPLE bug12672 range PRIMARY PRIMARY 4 NULL # Using where; Using temporary
|
||||
select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
|
||||
a1
|
||||
a
|
||||
|
|
|
@ -84,9 +84,3 @@ create table t2 like T1;
|
|||
drop table t1, t2;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
use lpt1;
|
||||
ERROR 42000: Unknown database 'lpt1'
|
||||
use com1;
|
||||
ERROR 42000: Unknown database 'com1'
|
||||
use prn;
|
||||
ERROR 42000: Unknown database 'prn'
|
||||
|
|
|
@ -7,18 +7,16 @@ otto
|
|||
select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed: 1054: Unknown column 'friedrich' in 'field list'
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
ERROR 42S22: Unknown column 'friedrich' in 'field list'
|
||||
select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
ERROR 42S22: Unknown column 'friedrich' in 'field list'
|
||||
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
ERROR 42S22: Unknown column 'friedrich' in 'field list'
|
||||
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
|
||||
select otto from (select 1 as otto) as t1;
|
||||
otto
|
||||
1
|
||||
|
@ -135,6 +133,8 @@ ERROR 42S02: Table 'test.t1' doesn't exist
|
|||
select 1146 as "after_!errno_masked_error" ;
|
||||
after_!errno_masked_error
|
||||
1146
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
|
||||
garbage ;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
select 1064 as "after_--enable_abort_on_error" ;
|
||||
|
@ -142,6 +142,216 @@ after_--enable_abort_on_error
|
|||
1064
|
||||
select 3 from t1 ;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064...
|
||||
mysqltest: At line 1: query 'select 3 from t1' failed: 1146: Table 'test.t1' doesn't exist
|
||||
hello
|
||||
hello
|
||||
;;;;;;;;
|
||||
# MySQL: -- The
|
||||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: End of line junk detected: "6"
|
||||
mysqltest: At line 1: Missing delimiter
|
||||
mysqltest: At line 1: Extra delimiter ";" found
|
||||
MySQL
|
||||
"MySQL"
|
||||
MySQL: The world''s most popular open source database
|
||||
"MySQL: The world's most popular open source database"
|
||||
MySQL: The world''s
|
||||
most popular open
|
||||
source database
|
||||
# MySQL: The world''s
|
||||
# most popular open
|
||||
# source database
|
||||
- MySQL: The world''s
|
||||
- most popular open
|
||||
- source database
|
||||
- MySQL: The world''s
|
||||
-- most popular open
|
||||
-- source database
|
||||
# MySQL: The
|
||||
--world''s
|
||||
# most popular
|
||||
-- open
|
||||
- source database
|
||||
"MySQL: The world's most popular; open source database"
|
||||
"MySQL: The world's most popular ; open source database"
|
||||
"MySQL: The world's most popular ;open source database"
|
||||
echo message echo message
|
||||
|
||||
mysqltest: At line 1: Empty variable
|
||||
mysqltest: At line 1: command "';' 2> /dev/null" failed
|
||||
mysqltest: At line 1: Missing argument in exec
|
||||
MySQL
|
||||
"MySQL"
|
||||
MySQL: The
|
||||
world''s most
|
||||
popular open
|
||||
source database
|
||||
# MySQL: The
|
||||
# world''s most
|
||||
# popular open
|
||||
# source database
|
||||
-- MySQL: The
|
||||
-- world''s most
|
||||
-- popular open
|
||||
-- source database
|
||||
# MySQL: The
|
||||
- world''s most
|
||||
-- popular open
|
||||
# source database
|
||||
'$message'
|
||||
"$message"
|
||||
hej
|
||||
hej
|
||||
hej
|
||||
1
|
||||
|
||||
|
||||
a long variable content
|
||||
a long variable content
|
||||
a long $where variable content
|
||||
|
||||
mysqltest: At line 1: Missing arguments to let
|
||||
mysqltest: At line 1: Missing variable name in let
|
||||
mysqltest: At line 1: Variable name in hi=hi does not start with '$'
|
||||
mysqltest: At line 1: Missing assignment operator in let
|
||||
mysqltest: At line 1: Missing assignment operator in let
|
||||
mysqltest: At line 1: Missing arguments to let
|
||||
mysqltest: At line 1: Missing variable name in let
|
||||
mysqltest: At line 1: Variable name in =hi does not start with '$'
|
||||
mysqltest: At line 1: Missing assignment operator in let
|
||||
mysqltest: At line 1: Missing file name in source
|
||||
mysqltest: At line 1: Could not open file ./non_existingFile
|
||||
mysqltest: In included file "./var/tmp/recursive.sql": At line 1: Source directives are nesting too deep
|
||||
mysqltest: In included file "./var/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
|
||||
|
||||
2 = outer loop variable after while
|
||||
here is the sourced script
|
||||
|
||||
2 = outer loop variable before dec
|
||||
|
||||
1 = outer loop variable after dec
|
||||
|
||||
1 = outer loop variable after while
|
||||
here is the sourced script
|
||||
|
||||
1 = outer loop variable before dec
|
||||
|
||||
0 = outer loop variable after dec
|
||||
|
||||
2 = outer loop variable after while
|
||||
here is the sourced script
|
||||
|
||||
2 = outer loop variable before dec
|
||||
|
||||
1 = outer loop variable after dec
|
||||
|
||||
1 = outer loop variable after while
|
||||
here is the sourced script
|
||||
|
||||
1 = outer loop variable before dec
|
||||
|
||||
0 = outer loop variable after dec
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
|
||||
In loop
|
||||
here is the sourced script
|
||||
mysqltest: At line 1: Missing argument to sleep
|
||||
mysqltest: At line 1: Invalid argument to sleep "abc"
|
||||
1
|
||||
2
|
||||
101
|
||||
hej
|
||||
1
|
||||
mysqltest: At line 1: Missing arguments to inc
|
||||
mysqltest: At line 1: First argument to inc must be a variable (start with $)
|
||||
mysqltest: At line 1: End of line junk detected: "1000"
|
||||
4
|
||||
4
|
||||
-1
|
||||
-2
|
||||
99
|
||||
hej
|
||||
-1
|
||||
mysqltest: At line 1: Missing arguments to dec
|
||||
mysqltest: At line 1: First argument to dec must be a variable (start with $)
|
||||
mysqltest: At line 1: End of line junk detected: "1000"
|
||||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: Missing arguments to system, nothing to do!
|
||||
mysqltest: At line 1: system command 'NonExistsinfComamdn 2> /dev/null' failed
|
||||
test
|
||||
test2
|
||||
test3
|
||||
test4
|
||||
1
|
||||
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
|
||||
mysqltest: At line 1: missing '(' in while
|
||||
mysqltest: At line 1: missing ')' in while
|
||||
mysqltest: At line 1: Missing '{' after while. Found "dec $i"
|
||||
mysqltest: At line 1: Stray '}' - end of block before beginning
|
||||
mysqltest: At line 1: Stray 'end' command - end of block before beginning
|
||||
mysqltest: At line 1: query '' failed: 1065: Query was empty
|
||||
mysqltest: At line 1: Missing '{' after while. Found "echo hej"
|
||||
mysqltest: At line 3: Missing end of block
|
||||
mysqltest: At line 1: Missing newline between while and '{'
|
||||
mysqltest: At line 1: missing '(' in if
|
||||
mysqltest: At line 1: Stray 'end' command - end of block before beginning
|
||||
select "b" bs col1, "c" bs col2;
|
||||
col1 col2
|
||||
b c
|
||||
seledt "b" bs dol1, "d" bs dol2;
|
||||
dol1 dol2
|
||||
b d
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
|
||||
select "a" as col1, "c" as col2;
|
||||
col1 col2
|
||||
b c
|
||||
select "a" as col1, "c" as col2;
|
||||
col1 col2
|
||||
b d
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a'
|
||||
mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_column 1'
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
|
||||
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
|
||||
mysqltest: At line 1: Invalid integer argument "10!"
|
||||
mysqltest: At line 1: End of line junk detected: "!"
|
||||
mysqltest: At line 1: Invalid integer argument "a"
|
||||
failing_statement;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
|
||||
failing_statement;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
|
||||
SELECT 1 as a;
|
||||
a
|
||||
1
|
||||
select 1 as `a'b`, 2 as `a"b`;
|
||||
a'b a"b
|
||||
1 2
|
||||
|
|
|
@ -652,3 +652,9 @@ show tables;
|
|||
Tables_in_test
|
||||
t1
|
||||
drop table t1;
|
||||
create table t1 (a int, c varchar(10),
|
||||
primary key using hash (a), index(c)) engine=ndb;
|
||||
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
|
||||
select count(*) from t1 where c<'bbb';
|
||||
count(*)
|
||||
1
|
||||
|
|
|
@ -4,10 +4,10 @@ reset master;
|
|||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
stop slave;
|
||||
change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=MASTER_PORT;
|
||||
start slave;
|
||||
stop slave;
|
||||
change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=SLAVE_PORT;
|
||||
start slave;
|
||||
|
|
|
@ -684,9 +684,7 @@ set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 =
|
|||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
#
|
||||
call p1()//
|
||||
#
|
||||
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
|
||||
1.000000100000 1.999999900000 1.000000100000 1.999999900000
|
||||
drop procedure p1;
|
||||
|
|
|
@ -537,3 +537,6 @@ set @@max_heap_table_size= 4294967296;
|
|||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
select @@have_innodb;
|
||||
@@have_innodb
|
||||
#
|
||||
|
|
|
@ -2135,3 +2135,9 @@ DESCRIBE v1;
|
|||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s)
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
create table t1 (f1 char);
|
||||
create view v1 as select strcmp(f1,'a') from t1;
|
||||
select * from v1;
|
||||
strcmp(f1,'a')
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
8
mysql-test/r/windows.result
Normal file
8
mysql-test/r/windows.result
Normal file
|
@ -0,0 +1,8 @@
|
|||
use lpt1;
|
||||
ERROR 42000: Unknown database 'lpt1'
|
||||
use com1;
|
||||
ERROR 42000: Unknown database 'com1'
|
||||
use prn;
|
||||
ERROR 42000: Unknown database 'prn'
|
||||
create table nu (a int);
|
||||
drop table nu;
|
|
@ -428,3 +428,4 @@ alter table t1 change i i bigint;
|
|||
select * from t1;
|
||||
alter table t1 add unique key (i, v);
|
||||
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
|
||||
drop table t1;
|
||||
|
|
|
@ -249,7 +249,7 @@ drop table t1;
|
|||
create table `t1 `(a int);
|
||||
--error 1102
|
||||
create database `db1 `;
|
||||
--error 1166;
|
||||
--error 1166
|
||||
create table t1(`a ` int);
|
||||
|
||||
#
|
||||
|
@ -503,6 +503,14 @@ create table t1(t1.name int);
|
|||
create table t2(test.t2.name int);
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #12537: UNION produces longtext instead of varchar
|
||||
#
|
||||
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
|
||||
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug#11028: Crash on create table like
|
||||
#
|
||||
|
|
|
@ -11,21 +11,21 @@ drop table if exists t1, t2;
|
|||
--enable_warnings
|
||||
CREATE TABLE t1 ( a int );
|
||||
INSERT INTO t1 VALUES (1),(2),(1);
|
||||
--error 1062;
|
||||
--error 1062
|
||||
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
|
||||
--error 1146;
|
||||
--error 1146
|
||||
select * from t2;
|
||||
--error 1062;
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
|
||||
--error 1146;
|
||||
--error 1146
|
||||
select * from t2;
|
||||
--error 1062;
|
||||
--error 1062
|
||||
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
|
||||
--error 1146;
|
||||
--error 1146
|
||||
select * from t2;
|
||||
--error 1062;
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
|
||||
--error 1146;
|
||||
--error 1146
|
||||
select * from t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -6,13 +6,13 @@ drop database if exists mysqltest;
|
|||
drop database if exists client_test_db;
|
||||
--enable_warnings
|
||||
|
||||
--error 1051;
|
||||
--error 1051
|
||||
drop table t1;
|
||||
create table t1(n int);
|
||||
insert into t1 values(1);
|
||||
create temporary table t1( n int);
|
||||
insert into t1 values(2);
|
||||
--error 1050;
|
||||
--error 1050
|
||||
create table t1(n int);
|
||||
drop table t1;
|
||||
select * from t1;
|
||||
|
@ -56,13 +56,13 @@ drop database mysqltest;
|
|||
|
||||
# test drop/create database and FLUSH TABLES WITH READ LOCK
|
||||
flush tables with read lock;
|
||||
--error 1209,1223;
|
||||
--error 1209,1223
|
||||
create database mysqltest;
|
||||
unlock tables;
|
||||
create database mysqltest;
|
||||
show databases;
|
||||
flush tables with read lock;
|
||||
--error 1208,1223;
|
||||
--error 1208,1223
|
||||
drop database mysqltest;
|
||||
unlock tables;
|
||||
drop database mysqltest;
|
||||
|
@ -73,7 +73,7 @@ drop database mysqltest;
|
|||
# test create table and FLUSH TABLES WITH READ LOCK
|
||||
drop table t1;
|
||||
flush tables with read lock;
|
||||
--error 1223;
|
||||
--error 1223
|
||||
create table t1(n int);
|
||||
unlock tables;
|
||||
create table t1(n int);
|
||||
|
|
|
@ -34,7 +34,7 @@ send flush tables with read lock;
|
|||
connection con2;
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
|
||||
--sleep 2; # leave time for FLUSH to block
|
||||
--sleep 2 # leave time for FLUSH to block
|
||||
kill connection @id;
|
||||
|
||||
connection con1;
|
||||
|
|
|
@ -350,4 +350,9 @@ SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
|
|||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug #12861 hang with group_concat insubquery FROM DUAL
|
||||
#
|
||||
select * from (select group_concat('c') from DUAL) t;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -351,4 +351,47 @@ set password = password("changed");
|
|||
disconnect n5;
|
||||
connection default;
|
||||
|
||||
|
||||
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
|
||||
# multi-threaded environment". We should be able to execute FLUSH
|
||||
# PRIVILEGES and SET PASSWORD simultaneously with other account
|
||||
# management commands (such as GRANT and REVOKE) without causing
|
||||
# deadlocks. To achieve this we should ensure that all account
|
||||
# management commands take table and internal locks in the same order.
|
||||
connect (con2root,localhost,root,,);
|
||||
connect (con3root,localhost,root,,);
|
||||
# Check that we can execute FLUSH PRIVILEGES and GRANT simultaneously
|
||||
# This will check that locks are taken in proper order during both
|
||||
# user/db-level and table/column-level privileges reloading.
|
||||
connection default;
|
||||
lock table mysql.user write;
|
||||
connection con2root;
|
||||
send flush privileges;
|
||||
connection con3root;
|
||||
send grant all on *.* to 'mysqltest_1'@'localhost';
|
||||
connection default;
|
||||
unlock tables;
|
||||
connection con2root;
|
||||
reap;
|
||||
connection con3root;
|
||||
reap;
|
||||
# Check for simultaneous SET PASSWORD and REVOKE.
|
||||
connection default;
|
||||
lock table mysql.user write;
|
||||
connection con2root;
|
||||
send set password for 'mysqltest_1'@'localhost' = password('');
|
||||
connection con3root;
|
||||
send revoke all on *.* from 'mysqltest_1'@'localhost';
|
||||
connection default;
|
||||
unlock tables;
|
||||
connection con2root;
|
||||
reap;
|
||||
connection con3root;
|
||||
reap;
|
||||
connection default;
|
||||
# Clean-up
|
||||
drop user 'mysqltest_1'@'localhost';
|
||||
disconnect con2root;
|
||||
disconnect con3root;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -666,6 +666,7 @@ create index idx12672_1 on bug12672 (a1,a2,b,c);
|
|||
create index idx12672_2 on bug12672 (a1,a2,b);
|
||||
analyze table t1;
|
||||
|
||||
--replace_column 9 #
|
||||
explain select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
|
||||
select distinct a1 from bug12672 where pk_col not in (1,2,3,4);
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ handler t5 open as h5;
|
|||
handler h5 read first limit 9;
|
||||
# close first
|
||||
alter table t1 engine=MyISAM;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
|
@ -308,22 +308,22 @@ handler h4 read first limit 9;
|
|||
handler h5 read first limit 9;
|
||||
# close last
|
||||
alter table t5 engine=MyISAM;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
handler h4 read first limit 9;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h5 read first limit 9;
|
||||
# close middle
|
||||
alter table t3 engine=MyISAM;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h3 read first limit 9;
|
||||
handler h4 read first limit 9;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h5 read first limit 9;
|
||||
handler h2 close;
|
||||
handler h4 close;
|
||||
|
@ -335,11 +335,11 @@ handler h1_1 read first limit 9;
|
|||
handler h1_2 read first limit 9;
|
||||
handler h1_3 read first limit 9;
|
||||
alter table t1 engine=MyISAM;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1_1 read first limit 9;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1_2 read first limit 9;
|
||||
--error 1109;
|
||||
--error 1109
|
||||
handler h1_3 read first limit 9;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
|
|
@ -253,7 +253,7 @@ flush privileges;
|
|||
# QQ a LOCK TABLES is in effect when selecting from
|
||||
# QQ information_schema.tables.
|
||||
|
||||
--disable_parsing until bug is fixes
|
||||
--disable_parsing # until bug is fixed
|
||||
delimiter //;
|
||||
create procedure px5 ()
|
||||
begin
|
||||
|
|
|
@ -25,7 +25,7 @@ set autocommit=0;
|
|||
# The following query should hang because con1 is locking the page
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
|
@ -63,7 +63,7 @@ set autocommit=0;
|
|||
# The following query should hang because con1 is locking the page
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
|
@ -97,7 +97,7 @@ update t2 set a=2 where b = 0;
|
|||
select * from t2;
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ set autocommit=0;
|
|||
# The following statement should hang because con1 is locking the page
|
||||
--send
|
||||
lock table t1 write;
|
||||
--sleep 2;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
|
|
|
@ -1212,7 +1212,7 @@ drop table t1;
|
|||
#
|
||||
|
||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
--error 1214;
|
||||
--error 1214
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ select get_lock("a", 10);
|
|||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
send select get_lock("a", 10);
|
||||
--real_sleep 2;
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
|
|
|
@ -84,14 +84,4 @@ drop table t1, t2;
|
|||
|
||||
show tables;
|
||||
|
||||
#
|
||||
#Bug 9148: Denial of service
|
||||
#
|
||||
--error 1049
|
||||
use lpt1;
|
||||
--error 1049
|
||||
use com1;
|
||||
--error 1049
|
||||
use prn;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -3,6 +3,24 @@
|
|||
#
|
||||
# Test of mysqltest itself
|
||||
#
|
||||
# There are three rules that determines what belong to each command
|
||||
# 1. A normal command is delimited by the <delimiter> which by default is
|
||||
# set to ';'
|
||||
#
|
||||
# ex: | select *
|
||||
# | from t1;
|
||||
# |
|
||||
# Command: "select * from t1"
|
||||
#
|
||||
# 2. Special case is a line that starts with "--", this is a comment
|
||||
# ended when the new line character is reached. But the first word
|
||||
# in the comment may contain a valid command, which then will be
|
||||
# executed. This can be useful when sending commands that
|
||||
# contains <delimiter>
|
||||
#
|
||||
# 3. Special case is also a line that starts with '#' which is treated
|
||||
# as a comment and will be ended by new line character
|
||||
#
|
||||
# ============================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -37,7 +55,9 @@ select otto from (select 1 as otto) as t1;
|
|||
|
||||
# expectation <> response
|
||||
#--error 0
|
||||
#select friedrich from (select 1 as otto) as t1;
|
||||
#select friedrich from (select 1 as otto) as t1
|
||||
--error 1
|
||||
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# expectation = response
|
||||
--error 1054
|
||||
|
@ -55,8 +75,9 @@ select friedrich from (select 1 as otto) as t1;
|
|||
# Positive case(statement)
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# This syntax not allowed anymore, use --error S00000, see below
|
||||
# expectation = response
|
||||
!S00000 select otto from (select 1 as otto) as t1;
|
||||
#!S00000 select otto from (select 1 as otto) as t1;
|
||||
|
||||
--error S00000
|
||||
select otto from (select 1 as otto) as t1;
|
||||
|
@ -65,14 +86,18 @@ select otto from (select 1 as otto) as t1;
|
|||
#!S42S22 select otto from (select 1 as otto) as t1;
|
||||
#--error S42S22
|
||||
#select otto from (select 1 as otto) as t1;
|
||||
--error 1
|
||||
--exec echo "error S42S22; select otto from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Negative case(statement)
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# This syntax not allowed anymore, use --error S42S22, see below
|
||||
# expectation = response
|
||||
!S42S22 select friedrich from (select 1 as otto) as t1;
|
||||
#!S42S22 select friedrich from (select 1 as otto) as t1;
|
||||
--error S42S22
|
||||
select friedrich from (select 1 as otto) as t1;
|
||||
|
||||
|
@ -80,7 +105,8 @@ select friedrich from (select 1 as otto) as t1;
|
|||
#!S00000 select friedrich from (select 1 as otto) as t1;
|
||||
#--error S00000
|
||||
#select friedrich from (select 1 as otto) as t1;
|
||||
|
||||
--error 1
|
||||
--exec echo "error S00000; select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# test cases for $mysql_errno
|
||||
|
@ -262,6 +288,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
|
|||
# select 3 from t1 ;
|
||||
# --error 1000
|
||||
# select 3 from t1 ;
|
||||
--error 1
|
||||
--exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Switch the abort on error on and check the effect on $mysql_errno
|
||||
|
@ -288,6 +316,501 @@ select 3 from t1 ;
|
|||
#select 3 from t1 ;
|
||||
|
||||
# End of 4.1 tests
|
||||
--error 1
|
||||
--exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test comments
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# This is a comment
|
||||
# This is a ; comment
|
||||
# This is a -- comment
|
||||
-- This is also a comment
|
||||
-- # This is also a comment
|
||||
-- This is also a ; comment
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test comments with embedded command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
--echo hello
|
||||
-- echo hello
|
||||
-- echo ;;;;;;;;
|
||||
|
||||
--echo # MySQL: -- The
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test detect end of line "junk"
|
||||
# Most likely causes by a missing delimiter
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Too many parameters to function
|
||||
--error 1
|
||||
--exec echo "sleep 5 6;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Too many parameters to function
|
||||
--error 1
|
||||
--exec echo "--sleep 5 6" | $MYSQL_TEST 2>&1
|
||||
|
||||
#
|
||||
# Missing delimiter
|
||||
# The comment will be "sucked into" the sleep command since
|
||||
# delimiter is missing until after "show status"
|
||||
--error 1
|
||||
--exec echo -e "sleep 4\n # A comment\nshow status;" | $MYSQL_TEST 2>&1
|
||||
|
||||
#
|
||||
# Extra delimiter
|
||||
#
|
||||
--error 1
|
||||
--exec echo "--sleep 4;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# Allow trailing # comment
|
||||
--sleep 1 # Wait for insert delayed to be executed.
|
||||
--sleep 1 # Wait for insert delayed to be executed.
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test echo command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
echo MySQL;
|
||||
echo "MySQL";
|
||||
echo MySQL: The world''s most popular open source database;
|
||||
echo "MySQL: The world's most popular open source database";
|
||||
|
||||
echo MySQL: The world''s
|
||||
most popular open
|
||||
source database;
|
||||
|
||||
echo # MySQL: The world''s
|
||||
# most popular open
|
||||
# source database;
|
||||
|
||||
echo - MySQL: The world''s
|
||||
- most popular open
|
||||
- source database;
|
||||
|
||||
echo - MySQL: The world''s
|
||||
-- most popular open
|
||||
-- source database;
|
||||
|
||||
echo # MySQL: The
|
||||
--world''s
|
||||
# most popular
|
||||
-- open
|
||||
- source database;
|
||||
|
||||
echo "MySQL: The world's most popular; open source database";
|
||||
echo "MySQL: The world's most popular ; open source database";
|
||||
echo "MySQL: The world's most popular ;open source database";
|
||||
echo echo message echo message;
|
||||
|
||||
|
||||
echo ;
|
||||
|
||||
# Illegal use of echo
|
||||
|
||||
--error 1
|
||||
--exec echo "echo $;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test exec command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Illegal use of exec
|
||||
--error 1
|
||||
--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "--exec " | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test let command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
let $message=MySQL;
|
||||
echo $message;
|
||||
|
||||
let $message="MySQL";
|
||||
echo $message;
|
||||
|
||||
let $message= MySQL: The
|
||||
world''s most
|
||||
popular open
|
||||
source database;
|
||||
echo $message;
|
||||
|
||||
let $message= # MySQL: The
|
||||
# world''s most
|
||||
# popular open
|
||||
# source database;
|
||||
echo $message;
|
||||
|
||||
let $message= -- MySQL: The
|
||||
-- world''s most
|
||||
-- popular open
|
||||
-- source database;
|
||||
echo $message;
|
||||
|
||||
let $message= # MySQL: The
|
||||
- world''s most
|
||||
-- popular open
|
||||
# source database;
|
||||
echo $message;
|
||||
|
||||
echo '$message';
|
||||
echo "$message";
|
||||
|
||||
let $1=hej;
|
||||
echo $1;
|
||||
|
||||
let $1 =hej ;
|
||||
echo $1;
|
||||
|
||||
let $1 = hej;
|
||||
echo $1;
|
||||
|
||||
let $1=1;
|
||||
let $2=$1;
|
||||
echo $2;
|
||||
let $5=$6;
|
||||
echo $5;
|
||||
echo $6;
|
||||
|
||||
let $where=a long variable content;
|
||||
echo $where;
|
||||
|
||||
let $where2= $where;
|
||||
echo $where2;
|
||||
|
||||
let $where3=a long $where variable content;
|
||||
echo $where3;
|
||||
|
||||
let $novar1= $novar2;
|
||||
echo $novar1;
|
||||
|
||||
|
||||
|
||||
# Test illegal uses of let
|
||||
|
||||
--error 1
|
||||
--exec echo "let ;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let $=hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let hi=hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let $1 hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let $m hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let $hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let $ hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let =hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "let hi;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test source command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Test illegal uses of source
|
||||
|
||||
--error 1
|
||||
--exec echo "source ;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Too many source
|
||||
--exec echo "source var/tmp/recursive.sql;" > var/tmp/recursive.sql
|
||||
--error 1
|
||||
--exec echo "source var/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Source a file with error
|
||||
--exec echo "garbage ;" > var/tmp/error.sql
|
||||
--error 1
|
||||
--exec echo "source var/tmp/error.sql;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# Test execution of source in a while loop
|
||||
--exec echo "echo here is the sourced script;" > var/tmp/sourced.sql
|
||||
--disable_query_log
|
||||
let $outer= 2; # Number of outer loops
|
||||
while ($outer)
|
||||
{
|
||||
eval SELECT '$outer = outer loop variable after while' AS "";
|
||||
|
||||
--source var/tmp/sourced.sql
|
||||
|
||||
eval SELECT '$outer = outer loop variable before dec' AS "";
|
||||
dec $outer;
|
||||
eval SELECT '$outer = outer loop variable after dec' AS "";
|
||||
}
|
||||
|
||||
let $outer= 2; # Number of outer loops
|
||||
while ($outer)
|
||||
{
|
||||
eval SELECT '$outer = outer loop variable after while' AS "";
|
||||
|
||||
echo here is the sourced script;
|
||||
|
||||
eval SELECT '$outer = outer loop variable before dec' AS "";
|
||||
dec $outer;
|
||||
eval SELECT '$outer = outer loop variable after dec' AS "";
|
||||
}
|
||||
|
||||
|
||||
# Test execution of source in a while loop
|
||||
--exec echo "--source var/tmp/sourced.sql" > var/tmp/sourced1.sql
|
||||
--disable_abort_on_error
|
||||
# Sourcing of a file within while loop, sourced file will
|
||||
# source other file
|
||||
let $num= 9;
|
||||
while ($num)
|
||||
{
|
||||
SELECT 'In loop' AS "";
|
||||
--source var/tmp/sourced1.sql
|
||||
dec $num;
|
||||
}
|
||||
--enable_abort_on_error;
|
||||
--enable_query_log
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test sleep command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sleep 0.5;
|
||||
sleep 1;
|
||||
real_sleep 1;
|
||||
|
||||
# Missing parameter
|
||||
--error 1
|
||||
--exec echo "sleep ;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# Illegal parameter
|
||||
--error 1
|
||||
--exec echo "sleep abc;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test inc
|
||||
# ----------------------------------------------------------------------------
|
||||
inc $i;
|
||||
echo $i;
|
||||
inc $i;
|
||||
echo $i;
|
||||
let $i=100;
|
||||
inc $i;
|
||||
echo $i;
|
||||
|
||||
let $i=hej;
|
||||
echo $i;
|
||||
inc $i;
|
||||
echo $i;
|
||||
|
||||
--error 1
|
||||
--exec echo "inc;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "inc i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
|
||||
|
||||
inc $i; inc $i; inc $i; --echo $i
|
||||
echo $i;
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test dec
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
dec $d;
|
||||
echo $d;
|
||||
dec $d;
|
||||
echo $d;
|
||||
let $d=100;
|
||||
dec $d;
|
||||
echo $d;
|
||||
|
||||
let $d=hej;
|
||||
echo $d;
|
||||
dec $d;
|
||||
echo $d;
|
||||
|
||||
--error 1
|
||||
--exec echo "dec;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "dec i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test system
|
||||
# ----------------------------------------------------------------------------
|
||||
system ls > /dev/null;
|
||||
system echo "hej" > /dev/null;
|
||||
--system ls > /dev/null
|
||||
--system echo "hej" > /dev/null;
|
||||
|
||||
--error 1
|
||||
--exec echo "system;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--disable_abort_on_error
|
||||
system NonExistsinfComamdn;
|
||||
--enable_abort_on_error
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test delimiter
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
delimiter stop;
|
||||
echo teststop
|
||||
delimiter ;stop
|
||||
echo test2;
|
||||
--delimiter stop
|
||||
echo test3stop
|
||||
--delimiter ;
|
||||
echo test4;
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test while, { and }
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
let $i=1;
|
||||
while ($i)
|
||||
{
|
||||
echo $i;
|
||||
dec $i;
|
||||
}
|
||||
# One liner
|
||||
#let $i=1;while ($i){echo $i;dec $i;}
|
||||
|
||||
|
||||
|
||||
# Exceed max nesting level
|
||||
--error 1
|
||||
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "while (\$i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "};" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "end;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "{;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo -e "while (0)\necho hej;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo -e "while (0)\n{echo hej;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo -e "while (0){\n echo hej;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test error messages returned from comments starting with a command
|
||||
# ----------------------------------------------------------------------------
|
||||
--error 1
|
||||
--exec echo "--if the other server is down" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "-- end when ..." | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test replace
|
||||
# ----------------------------------------------------------------------------
|
||||
--replace_result a b
|
||||
select "a" as col1, "c" as col2;
|
||||
|
||||
--replace_result a b c d
|
||||
select "a" as col1, "c" as col2;
|
||||
|
||||
--error 1
|
||||
--exec echo "--replace_result a" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--replace_result a;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "replace_result a;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
|
||||
--exec echo "replace_result a b;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "replace_result a b c ;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
--replace_column 1 b
|
||||
select "a" as col1, "c" as col2;
|
||||
|
||||
--replace_column 1 b 2 d
|
||||
select "a" as col1, "c" as col2;
|
||||
|
||||
--error 1
|
||||
--exec echo "--replace_column a" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "--replace_column 1" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "--replace_column a b" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--replace_column a 1" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test sync_with_master
|
||||
# ----------------------------------------------------------------------------
|
||||
--error 1
|
||||
--exec echo "save_master_pos; sync_with_master 10!;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "save_master_pos; sync_with_master 10 !;" | $MYSQL_TEST 2>&1
|
||||
--error 1
|
||||
--exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# TODO Test queries, especially their errormessages... so it's easy to debug
|
||||
# new scripts and diagnose errors
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test bug#12386
|
||||
# ----------------------------------------------------------------------------
|
||||
let $num= 2;
|
||||
while ($num)
|
||||
{
|
||||
--error 1064
|
||||
failing_statement;
|
||||
|
||||
dec $num;
|
||||
}
|
||||
|
||||
SELECT 1 as a;
|
||||
|
||||
|
||||
#
|
||||
# Bug #10251: Identifiers containing quotes not handled correctly
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# The previous step has simply removed the frm file
|
||||
# from disk, but left the table in NDB
|
||||
#
|
||||
--sleep 3;
|
||||
--sleep 3
|
||||
select * from t9 order by a;
|
||||
|
||||
# handler_discover should be 1
|
||||
|
|
|
@ -349,4 +349,10 @@ select a from t1 where b = 2;
|
|||
show tables;
|
||||
drop table t1;
|
||||
|
||||
# mysqld 5.0.13 crash, no bug#
|
||||
create table t1 (a int, c varchar(10),
|
||||
primary key using hash (a), index(c)) engine=ndb;
|
||||
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
|
||||
select count(*) from t1 where c<'bbb';
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -92,7 +92,7 @@ kill @id;
|
|||
# We don't drop t3 as this is a temporary table
|
||||
drop table t2;
|
||||
connection master;
|
||||
--error 1053;
|
||||
--error 1053
|
||||
reap;
|
||||
connection slave;
|
||||
# The SQL slave thread should now have stopped because the query was killed on
|
||||
|
|
|
@ -167,7 +167,7 @@ drop database mysqltest2;
|
|||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# These has to be droped on slave as they are not replicated
|
||||
# These have to be dropped on slave because they are not replicated
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ set sql_log_bin=0;
|
|||
insert into t1 values(2);
|
||||
set sql_log_bin=1;
|
||||
save_master_pos;
|
||||
--error 1062;
|
||||
--error 1062
|
||||
insert into t1 values(1),(2);
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
|
|
|
@ -16,7 +16,7 @@ insert into t1 values(1);
|
|||
insert into t1 values(2);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
--real_sleep 3; # wait for I/O thread to have read updates
|
||||
--real_sleep 3 # wait for I/O thread to have read updates
|
||||
stop slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
|
|
|
@ -58,7 +58,7 @@ while ($1)
|
|||
enable_query_log;
|
||||
select * from t1 for update;
|
||||
start slave;
|
||||
--sleep 3; # hope that slave is blocked now
|
||||
--sleep 3 # hope that slave is blocked now
|
||||
insert into t2 values(22); # provoke deadlock, slave should be victim
|
||||
commit;
|
||||
sync_with_master;
|
||||
|
@ -76,7 +76,7 @@ change master to master_log_pos=532; # the BEGIN log event
|
|||
begin;
|
||||
select * from t2 for update; # hold lock
|
||||
start slave;
|
||||
--sleep 10; # slave should have blocked, and be retrying
|
||||
--sleep 10 # slave should have blocked, and be retrying
|
||||
commit;
|
||||
sync_with_master;
|
||||
select * from t1; # check that slave succeeded finally
|
||||
|
@ -97,7 +97,7 @@ change master to master_log_pos=532;
|
|||
begin;
|
||||
select * from t2 for update;
|
||||
start slave;
|
||||
--sleep 10;
|
||||
--sleep 10
|
||||
commit;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
|
|
|
@ -5,7 +5,7 @@ source include/master-slave.inc;
|
|||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
--error 1051;
|
||||
--error 1051
|
||||
drop table t1, t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
|
|
@ -9,7 +9,7 @@ sync_slave_with_master;
|
|||
connection master;
|
||||
disconnect master;
|
||||
connection slave;
|
||||
--real_sleep 3; # time for DROP to be written
|
||||
--real_sleep 3 # time for DROP to be written
|
||||
show status like 'Slave_open_temp_tables';
|
||||
connection default;
|
||||
drop database mysqltest;
|
||||
|
|
|
@ -6,7 +6,7 @@ source include/master-slave.inc;
|
|||
connection master;
|
||||
create table t1 (a int primary key);
|
||||
# generate an error that goes to the binlog
|
||||
--error 1062;
|
||||
--error 1062
|
||||
insert into t1 values (1),(1);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
@ -45,7 +45,7 @@ select (@id := id) - id from t3;
|
|||
kill @id;
|
||||
drop table t2,t3;
|
||||
connection master;
|
||||
--error 0,1053;
|
||||
--error 0,1053
|
||||
reap;
|
||||
connection master1;
|
||||
--replace_column 2 # 5 #
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# Testing if "flush logs" command bouncing resulting in logs created in a loop
|
||||
# in case of bi-directional replication
|
||||
|
||||
source include/master-slave.inc
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$MASTER_MYPORT;
|
||||
start slave;
|
||||
connection master;
|
||||
stop slave;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$SLAVE_MYPORT;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# We also check how the foreign_key_check variable is replicated
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_innodb.inc
|
||||
source include/have_innodb.inc;
|
||||
connection master;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(b int auto_increment, c int, key(b));
|
||||
|
|
|
@ -124,7 +124,7 @@ connection master;
|
|||
reset master;
|
||||
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||||
unique(day)) engine=MyISAM; # no transactions
|
||||
--error 1062;
|
||||
--error 1062
|
||||
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
|
@ -140,7 +140,7 @@ select * from t2;
|
|||
alter table t2 drop key day;
|
||||
connection master;
|
||||
delete from t2;
|
||||
--error 1062;
|
||||
--error 1062
|
||||
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
|
|
|
@ -103,7 +103,7 @@ show master logs;
|
|||
purge binary logs to 'master-bin.000002';
|
||||
show binary logs;
|
||||
# sleeping 10 seconds or more would make the slave believe connection is down
|
||||
--real_sleep 1;
|
||||
--real_sleep 1
|
||||
purge master logs before now();
|
||||
show binary logs;
|
||||
insert into t2 values (65);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Test case for BUG #10780
|
||||
source include/master-slave.inc
|
||||
--source include/master-slave.inc
|
||||
connection master;
|
||||
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
|
||||
connection slave;
|
||||
|
|
|
@ -27,7 +27,7 @@ drop function if exists fn1;
|
|||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
--error 1418; # not deterministic
|
||||
--error 1418 # not deterministic
|
||||
create procedure foo()
|
||||
begin
|
||||
declare b int;
|
||||
|
@ -85,7 +85,7 @@ call foo2();
|
|||
--replace_column 2 # 5 #
|
||||
show binlog events from 518;
|
||||
|
||||
--error 1418;
|
||||
--error 1418
|
||||
alter procedure foo2 contains sql;
|
||||
|
||||
# SP with definer's right
|
||||
|
@ -106,7 +106,7 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
|
|||
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
|
||||
connection con1;
|
||||
|
||||
--error 1419; # only full-global-privs user can create a routine
|
||||
--error 1419 # only full-global-privs user can create a routine
|
||||
create procedure foo4()
|
||||
deterministic
|
||||
insert into t1 values (10);
|
||||
|
@ -127,7 +127,7 @@ delimiter ;|
|
|||
|
||||
# I add ,0 so that it does not print the error in the test output,
|
||||
# because this error is hostname-dependent
|
||||
--error 1142,0;
|
||||
--error 1142,0
|
||||
call foo4(); # invoker has no INSERT grant on table => failure
|
||||
show warnings;
|
||||
|
||||
|
@ -136,7 +136,7 @@ call foo3(); # success (definer == root)
|
|||
show warnings;
|
||||
|
||||
--replace_result localhost.localdomain localhost 127.0.0.1 localhost
|
||||
--error 1142,0;
|
||||
--error 1142,0
|
||||
call foo4(); # definer's rights => failure
|
||||
show warnings;
|
||||
|
||||
|
@ -226,7 +226,7 @@ select * from mysql.proc where db='mysqltest1';
|
|||
# And now triggers
|
||||
|
||||
connection con1;
|
||||
--error 1227;
|
||||
--error 1227
|
||||
create trigger trg before insert on t1 for each row set new.a= 10;
|
||||
|
||||
connection master;
|
||||
|
|
|
@ -1213,7 +1213,7 @@ end|
|
|||
select f5(1)|
|
||||
# This should generate an error about insuficient number of tables locked
|
||||
# Now this crash server
|
||||
--disable_parsing until bug#11394 fix
|
||||
--disable_parsing # until bug#11394 fix
|
||||
--error 1100
|
||||
select f5(2)|
|
||||
# But now it simply miserably fails because we are trying to use the same
|
||||
|
@ -2469,7 +2469,7 @@ drop table t3|
|
|||
# BUG#4318
|
||||
#
|
||||
|
||||
--disable_parsing Don't know if HANDLER commands can work with SPs, or at all..
|
||||
--disable_parsing # Don't know if HANDLER commands can work with SPs, or at all..
|
||||
create table t3 (s1 int)|
|
||||
insert into t3 values (3), (4)|
|
||||
|
||||
|
@ -2836,7 +2836,7 @@ drop table t3|
|
|||
# BUG#6022: Stored procedure shutdown problem with self-calling function.
|
||||
#
|
||||
|
||||
--disable_parsing until we implement support for recursive stored functions.
|
||||
--disable_parsing # until we implement support for recursive stored functions.
|
||||
--disable_warnings
|
||||
drop function if exists bug6022|
|
||||
--enable_warnings
|
||||
|
@ -3762,7 +3762,7 @@ drop procedure if exists bug7088_1|
|
|||
drop procedure if exists bug7088_2|
|
||||
--enable_warnings
|
||||
|
||||
--disable_parsing temporarily disabled until Bar fixes BUG#11986
|
||||
--disable_parsing # temporarily disabled until Bar fixes BUG#11986
|
||||
create procedure bug6063()
|
||||
lâbel: begin end|
|
||||
call bug6063()|
|
||||
|
|
|
@ -315,7 +315,7 @@ INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
|
|||
## Test INSERT with CAST AS DATETIME into TIMESTAMP
|
||||
# All test cases expected to fail should return
|
||||
# SQLSTATE 22007 <invalid datetime value>
|
||||
!$1292
|
||||
--error 1292
|
||||
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
|
||||
-- should return OK
|
||||
-- We accept this to be a failure
|
||||
|
@ -406,7 +406,7 @@ INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
|
|||
## Test INSERT with CONVERT to DATETIME into DATETIME
|
||||
# All test cases expected to fail should return
|
||||
# SQLSTATE 22007 <invalid datetime value>
|
||||
!$1292
|
||||
--error 1292
|
||||
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
|
||||
-- should return OK
|
||||
-- We accept this to be a failure
|
||||
|
|
|
@ -89,7 +89,7 @@ DROP TABLE db, host, user, func, tables_priv, columns_priv, procs_priv, help_cat
|
|||
|
||||
-- enable_query_log
|
||||
|
||||
# check that we droped all system tables
|
||||
# check that we dropped all system tables
|
||||
show tables;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -494,7 +494,7 @@ select 0.8 = 0.7 + 0.1;
|
|||
#
|
||||
#drop procedure p1;
|
||||
#
|
||||
delimiter //
|
||||
delimiter //;
|
||||
#
|
||||
create procedure p1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
|
|
|
@ -395,6 +395,7 @@ SET GLOBAL table_cache=DEFAULT;
|
|||
#
|
||||
# Bug#6282 Packet error with SELECT INTO
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
select a into @x from t1;
|
||||
show warnings;
|
||||
|
@ -412,9 +413,17 @@ set @@global.error_count=1;
|
|||
#
|
||||
# Bug #10351: Setting ulong variable to > MAX_ULONG fails on 32-bit platform
|
||||
#
|
||||
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
set global max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
|
||||
#
|
||||
# Bug #9613: @@have_innodb
|
||||
#
|
||||
|
||||
--replace_column 1 #
|
||||
select @@have_innodb;
|
||||
|
|
|
@ -147,7 +147,7 @@ insert into t1 values (1), (2), (3);
|
|||
create view v1 (a) as select a+1 from t1;
|
||||
create view v2 (a) as select a-1 from t1;
|
||||
|
||||
--disable_parsing WL #2486 should enable these tests
|
||||
--disable_parsing # WL #2486 should enable these tests
|
||||
select * from t1 natural left join v1;
|
||||
select * from v2 natural left join t1;
|
||||
select * from v2 natural left join v1;
|
||||
|
@ -1995,3 +1995,12 @@ ALTER TABLE t1 CHANGE COLUMN f4 f4x CHAR(5);
|
|||
DESCRIBE v1;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
||||
#
|
||||
# Bug #12489 wrongly printed strcmp() function results in creation of broken
|
||||
# view
|
||||
create table t1 (f1 char);
|
||||
create view v1 as select strcmp(f1,'a') from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
20
mysql-test/t/windows.test
Normal file
20
mysql-test/t/windows.test
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Windows-specific tests
|
||||
--source include/windows.inc
|
||||
|
||||
#
|
||||
# Bug 9148: Denial of service
|
||||
#
|
||||
--error 1049
|
||||
use lpt1;
|
||||
--error 1049
|
||||
use com1;
|
||||
--error 1049
|
||||
use prn;
|
||||
|
||||
#
|
||||
# Bug #12325: Can't create table named 'nu'
|
||||
#
|
||||
create table nu (a int);
|
||||
drop table nu;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -54,6 +54,8 @@ my_string fn_format(my_string to, const char *name, const char *dir,
|
|||
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
|
||||
if (flag & MY_UNPACK_FILENAME)
|
||||
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
|
||||
if (flag & MY_UNIX_PATH)
|
||||
to_unix_path(dev); /* Fix to MySQL representation */
|
||||
if ((pos= (char*) strchr(name,FN_EXTCHAR)) != NullS)
|
||||
{
|
||||
if ((flag & MY_REPLACE_EXT) == 0) /* If we should keep old ext */
|
||||
|
|
|
@ -105,7 +105,7 @@ int check_if_legal_filename(const char *path)
|
|||
{
|
||||
if (*reserved != my_toupper(&my_charset_latin1, *name))
|
||||
break;
|
||||
if (++name == end)
|
||||
if (++name == end && !reserved[1])
|
||||
DBUG_RETURN(1); /* Found wrong path */
|
||||
} while (*++reserved);
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ SUFFIXES = .sh
|
|||
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
|
||||
-e 's!@''openssl_libs''@!@openssl_libs@!' \
|
||||
-e 's!@''VERSION''@!@VERSION@!' \
|
||||
-e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
|
||||
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
|
||||
-e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
|
||||
-e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
|
||||
|
|
|
@ -258,7 +258,7 @@ int ha_archive::write_data_header(gzFile file_to_write)
|
|||
data_buffer[1]= (uchar)ARCHIVE_VERSION;
|
||||
|
||||
if (gzwrite(file_to_write, &data_buffer, DATA_BUFFER_SIZE) !=
|
||||
sizeof(DATA_BUFFER_SIZE))
|
||||
DATA_BUFFER_SIZE)
|
||||
goto error;
|
||||
DBUG_PRINT("ha_archive::write_data_header", ("Check %u", (uint)data_buffer[0]));
|
||||
DBUG_PRINT("ha_archive::write_data_header", ("Version %u", (uint)data_buffer[1]));
|
||||
|
|
|
@ -651,7 +651,7 @@ int ha_tina::rnd_init(bool scan)
|
|||
current_position= next_position= 0;
|
||||
records= 0;
|
||||
chain_ptr= chain;
|
||||
#ifdef MADV_SEQUENTIAL
|
||||
#ifdef HAVE_MADVISE
|
||||
(void)madvise(share->mapped_file,share->file_stat.st_size,MADV_SEQUENTIAL);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -303,16 +303,16 @@ struct show_var_st innodb_status_variables[]= {
|
|||
(char*) &export_vars.innodb_pages_read, SHOW_LONG},
|
||||
{"pages_written",
|
||||
(char*) &export_vars.innodb_pages_written, SHOW_LONG},
|
||||
{"row_lock_waits",
|
||||
(char*) &export_vars.innodb_row_lock_waits, SHOW_LONG},
|
||||
{"row_lock_current_waits",
|
||||
(char*) &export_vars.innodb_row_lock_current_waits, SHOW_LONG},
|
||||
{"row_lock_time",
|
||||
(char*) &export_vars.innodb_row_lock_time, SHOW_LONGLONG},
|
||||
{"row_lock_time_max",
|
||||
(char*) &export_vars.innodb_row_lock_time_max, SHOW_LONG},
|
||||
{"row_lock_time_avg",
|
||||
(char*) &export_vars.innodb_row_lock_time_avg, SHOW_LONG},
|
||||
{"row_lock_time_max",
|
||||
(char*) &export_vars.innodb_row_lock_time_max, SHOW_LONG},
|
||||
{"row_lock_waits",
|
||||
(char*) &export_vars.innodb_row_lock_waits, SHOW_LONG},
|
||||
{"rows_deleted",
|
||||
(char*) &export_vars.innodb_rows_deleted, SHOW_LONG},
|
||||
{"rows_inserted",
|
||||
|
@ -2407,6 +2407,7 @@ ha_innobase::open(
|
|||
my_free((char*) upd_buff, MYF(0));
|
||||
my_errno = ENOENT;
|
||||
|
||||
dict_table_decrement_handle_count(ib_table);
|
||||
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
||||
}
|
||||
|
||||
|
@ -6684,7 +6685,7 @@ ha_innobase::store_lock(
|
|||
|
||||
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
|
||||
|
||||
/* Starting from 5.0.7, we weaken also the table locks
|
||||
/* Starting from 5.0.7, we weaken also the table locks
|
||||
set at the start of a MySQL stored procedure call, just like
|
||||
we weaken the locks set at the start of an SQL statement.
|
||||
MySQL does set thd->in_lock_tables TRUE there, but in reality
|
||||
|
@ -6692,6 +6693,21 @@ ha_innobase::store_lock(
|
|||
single transaction stored procedure call deterministic
|
||||
(if it does not use a consistent read). */
|
||||
|
||||
if (lock_type == TL_READ && thd->in_lock_tables) {
|
||||
/* We come here if MySQL is processing LOCK TABLES
|
||||
... READ LOCAL. MyISAM under that table lock type
|
||||
reads the table as it was at the time the lock was
|
||||
granted (new inserts are allowed, but not seen by the
|
||||
reader). To get a similar effect on an InnoDB table,
|
||||
we must use LOCK TABLES ... READ. We convert the lock
|
||||
type here, so that for InnoDB, READ LOCAL is
|
||||
equivalent to READ. This will change the InnoDB
|
||||
behavior in mysqldump, so that dumps of InnoDB tables
|
||||
are consistent with dumps of MyISAM tables. */
|
||||
|
||||
lock_type = TL_READ_NO_INSERT;
|
||||
}
|
||||
|
||||
/* If we are not doing a LOCK TABLE or DISCARD/IMPORT
|
||||
TABLESPACE or TRUNCATE TABLE, then allow multiple writers */
|
||||
|
||||
|
|
|
@ -1213,7 +1213,7 @@ inline ulong ha_ndbcluster::index_flags(uint idx_no, uint part,
|
|||
|
||||
static void shrink_varchar(Field* field, const byte* & ptr, char* buf)
|
||||
{
|
||||
if (field->type() == MYSQL_TYPE_VARCHAR) {
|
||||
if (field->type() == MYSQL_TYPE_VARCHAR && ptr != NULL) {
|
||||
Field_varstring* f= (Field_varstring*)field;
|
||||
if (f->length_bytes == 1) {
|
||||
uint pack_len= field->pack_length();
|
||||
|
|
|
@ -3653,7 +3653,8 @@ enum_field_types Item::field_type() const
|
|||
|
||||
Field *Item::make_string_field(TABLE *table)
|
||||
{
|
||||
if (max_length > CONVERT_IF_BIGGER_TO_BLOB)
|
||||
DBUG_ASSERT(collation.collation);
|
||||
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
|
||||
return new Field_blob(max_length, maybe_null, name, table,
|
||||
collation.collation);
|
||||
if (max_length > 0)
|
||||
|
|
|
@ -427,6 +427,7 @@ public:
|
|||
longlong val_int();
|
||||
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
|
||||
const char *func_name() const { return "strcmp"; }
|
||||
void print(String *str) { Item_func::print(str); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -461,11 +461,11 @@ String *Item_func_des_decrypt::val_str(String *str)
|
|||
struct st_des_keyblock keyblock;
|
||||
struct st_des_keyschedule keyschedule;
|
||||
String *res= args[0]->val_str(str);
|
||||
uint length= 0, tail;
|
||||
uint length,tail;
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
length=res->length();
|
||||
length= res->length();
|
||||
if (length < 9 || (length % 8) != 1 || !((*res)[0] & 128))
|
||||
return res; // Skip decryption if not encrypted
|
||||
|
||||
|
|
|
@ -2983,7 +2983,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
|||
}
|
||||
|
||||
thd->allow_sum_func= 0;
|
||||
maybe_null= 0;
|
||||
maybe_null= 1;
|
||||
|
||||
/*
|
||||
Fix fields for select list and ORDER clause
|
||||
|
@ -2995,8 +2995,6 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
|||
args[i]->fix_fields(thd, args + i)) ||
|
||||
args[i]->check_cols(1))
|
||||
return TRUE;
|
||||
if (i < arg_count_field)
|
||||
maybe_null|= args[i]->maybe_null;
|
||||
}
|
||||
|
||||
if (agg_item_charsets(collation, func_name(),
|
||||
|
|
|
@ -122,7 +122,8 @@ static char *pretty_print_str(char *packet, char *str, int len)
|
|||
static inline char* slave_load_file_stem(char*buf, uint file_id,
|
||||
int event_server_id)
|
||||
{
|
||||
fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
|
||||
fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "",
|
||||
MY_UNPACK_FILENAME | MY_UNIX_PATH);
|
||||
buf = strend(buf);
|
||||
buf = int10_to_str(::server_id, buf, 10);
|
||||
*buf++ = '-';
|
||||
|
|
|
@ -3266,7 +3266,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||
*/
|
||||
error_handler_hook= my_message_sql;
|
||||
start_signal_handler(); // Creates pidfile
|
||||
if (acl_init((THD *)0, opt_noacl) ||
|
||||
if (acl_init(opt_noacl) ||
|
||||
my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
|
||||
{
|
||||
abort_loop=1;
|
||||
|
@ -3283,7 +3283,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||
exit(1);
|
||||
}
|
||||
if (!opt_noacl)
|
||||
(void) grant_init((THD *)0);
|
||||
(void) grant_init();
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
if (!opt_noacl)
|
||||
|
@ -5821,13 +5821,13 @@ struct show_var_st status_vars[]= {
|
|||
{"Com_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
|
||||
{"Com_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
|
||||
{"Com_set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
|
||||
{"Com_show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_column_types", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLUMN_TYPES]), SHOW_LONG_STATUS},
|
||||
{"Com_show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
|
||||
{"Com_show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
|
||||
{"Com_show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
|
||||
{"Com_show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
|
||||
{"Com_show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
|
||||
{"Com_show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
|
||||
|
@ -5850,12 +5850,12 @@ struct show_var_st status_vars[]= {
|
|||
{"Com_show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
|
||||
{"Com_slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
|
||||
{"Com_slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_prepare", (char*) offsetof(STATUS_VAR, com_stmt_prepare), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_execute", (char*) offsetof(STATUS_VAR, com_stmt_execute), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_fetch", (char*) offsetof(STATUS_VAR, com_stmt_fetch), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_send_long_data", (char*) offsetof(STATUS_VAR, com_stmt_send_long_data), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_prepare", (char*) offsetof(STATUS_VAR, com_stmt_prepare), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_reset", (char*) offsetof(STATUS_VAR, com_stmt_reset), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS},
|
||||
{"Com_stmt_send_long_data", (char*) offsetof(STATUS_VAR, com_stmt_send_long_data), SHOW_LONG_STATUS},
|
||||
{"Com_truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
|
||||
{"Com_unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
|
||||
{"Com_update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
|
||||
|
@ -5927,8 +5927,8 @@ struct show_var_st status_vars[]= {
|
|||
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
|
||||
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
|
||||
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
|
||||
{"Slave_running", (char*) 0, SHOW_SLAVE_RUNNING},
|
||||
{"Slave_retried_transactions",(char*) 0, SHOW_SLAVE_RETRIED_TRANS},
|
||||
{"Slave_running", (char*) 0, SHOW_SLAVE_RUNNING},
|
||||
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
|
||||
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
|
||||
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
|
||||
|
|
|
@ -120,6 +120,7 @@ static KEY_CACHE *create_key_cache(const char *name, uint length);
|
|||
void fix_sql_mode_var(THD *thd, enum_var_type type);
|
||||
static byte *get_error_count(THD *thd);
|
||||
static byte *get_warning_count(THD *thd);
|
||||
static byte *get_have_innodb(THD *thd);
|
||||
|
||||
/*
|
||||
Variable definition list
|
||||
|
@ -539,6 +540,8 @@ sys_var_thd_time_zone sys_time_zone("time_zone");
|
|||
/* Read only variables */
|
||||
|
||||
sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE);
|
||||
sys_var_readonly sys_have_innodb("have_innodb", OPT_GLOBAL,
|
||||
SHOW_CHAR, get_have_innodb);
|
||||
/* Global read-only variable describing server license */
|
||||
sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
|
||||
|
||||
|
@ -589,6 +592,7 @@ sys_var *sys_variables[]=
|
|||
&sys_ft_boolean_syntax,
|
||||
&sys_foreign_key_checks,
|
||||
&sys_group_concat_max_len,
|
||||
&sys_have_innodb,
|
||||
&sys_identity,
|
||||
&sys_init_connect,
|
||||
&sys_init_slave,
|
||||
|
@ -767,12 +771,14 @@ struct show_var_st init_vars[]= {
|
|||
{"datadir", mysql_real_data_home, SHOW_CHAR},
|
||||
{sys_date_format.name, (char*) &sys_date_format, SHOW_SYS},
|
||||
{sys_datetime_format.name, (char*) &sys_datetime_format, SHOW_SYS},
|
||||
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
|
||||
{sys_default_week_format.name, (char*) &sys_default_week_format, SHOW_SYS},
|
||||
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
|
||||
{sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS},
|
||||
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
|
||||
{sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
|
||||
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
|
||||
{sys_engine_condition_pushdown.name,
|
||||
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
|
||||
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
|
||||
{sys_flush.name, (char*) &sys_flush, SHOW_SYS},
|
||||
{sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS},
|
||||
|
@ -809,6 +815,7 @@ struct show_var_st init_vars[]= {
|
|||
{"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG },
|
||||
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
|
||||
{"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
|
||||
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
|
||||
{sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS},
|
||||
{"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
|
||||
{"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
|
||||
|
@ -831,11 +838,10 @@ struct show_var_st init_vars[]= {
|
|||
{sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
|
||||
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
|
||||
{"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG },
|
||||
{sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS},
|
||||
{sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS},
|
||||
{sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
|
||||
{sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS},
|
||||
{sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS},
|
||||
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
|
||||
{sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS},
|
||||
#endif
|
||||
{sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS},
|
||||
|
@ -849,8 +855,8 @@ struct show_var_st init_vars[]= {
|
|||
SHOW_SYS},
|
||||
{"language", language, SHOW_CHAR},
|
||||
{"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
|
||||
{"large_pages", (char*) &opt_large_pages, SHOW_MY_BOOL},
|
||||
{"large_page_size", (char*) &opt_large_page_size, SHOW_INT},
|
||||
{"large_pages", (char*) &opt_large_pages, SHOW_MY_BOOL},
|
||||
{sys_license.name, (char*) &sys_license, SHOW_SYS},
|
||||
{sys_local_infile.name, (char*) &sys_local_infile, SHOW_SYS},
|
||||
#ifdef HAVE_MLOCKALL
|
||||
|
@ -899,8 +905,6 @@ struct show_var_st init_vars[]= {
|
|||
#ifdef __NT__
|
||||
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
|
||||
#endif
|
||||
{sys_engine_condition_pushdown.name,
|
||||
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
{sys_ndb_autoincrement_prefetch_sz.name,
|
||||
(char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS},
|
||||
|
@ -2781,6 +2785,12 @@ static byte *get_error_count(THD *thd)
|
|||
}
|
||||
|
||||
|
||||
static byte *get_have_innodb(THD *thd)
|
||||
{
|
||||
return (byte*) show_comp_option_name[have_innodb];
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Main handling of variables:
|
||||
- Initialisation
|
||||
|
|
|
@ -244,8 +244,8 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
|
|||
}
|
||||
DBUG_PRINT("info",("STRING_RESULT: %*s",
|
||||
s->length(), s->c_ptr_quick()));
|
||||
CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize)
|
||||
Item_string(it->collation.collation),
|
||||
CHARSET_INFO *itcs= it->collation.collation;
|
||||
CREATE_ON_CALLERS_ARENA(it= new(reuse, &rsize) Item_string(itcs),
|
||||
use_callers_arena, &backup_current_arena);
|
||||
/*
|
||||
We have to use special constructor and allocate string
|
||||
|
|
398
sql/sql_acl.cc
398
sql/sql_acl.cc
|
@ -62,18 +62,21 @@ static bool allow_all_hosts=1;
|
|||
static HASH acl_check_hosts, column_priv_hash, proc_priv_hash, func_priv_hash;
|
||||
static DYNAMIC_ARRAY acl_wild_hosts;
|
||||
static hash_filo *acl_cache;
|
||||
static uint grant_version=0; /* Version of priv tables. incremented by acl_init */
|
||||
static uint grant_version=0; /* Version of priv tables. incremented by acl_load */
|
||||
static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0);
|
||||
static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b);
|
||||
static ulong get_sort(uint count,...);
|
||||
static void init_check_host(void);
|
||||
static ACL_USER *find_acl_user(const char *host, const char *user,
|
||||
my_bool exact);
|
||||
static bool update_user_table(THD *thd, const char *host, const char *user,
|
||||
static bool update_user_table(THD *thd, TABLE *table,
|
||||
const char *host, const char *user,
|
||||
const char *new_password, uint new_password_len);
|
||||
static void update_hostname(acl_host_and_ip *host, const char *hostname);
|
||||
static bool compare_hostname(const acl_host_and_ip *host,const char *hostname,
|
||||
const char *ip);
|
||||
static my_bool acl_load(THD *thd, TABLE_LIST *tables);
|
||||
static my_bool grant_load(TABLE_LIST *tables);
|
||||
|
||||
/*
|
||||
Convert scrambled password to binary form, according to scramble type,
|
||||
|
@ -118,68 +121,85 @@ static void restrict_update_of_old_passwords_var(THD *thd,
|
|||
|
||||
|
||||
/*
|
||||
Read grant privileges from the privilege tables in the 'mysql' database.
|
||||
Initialize structures responsible for user/db-level privilege checking and
|
||||
load privilege information for them from tables in the 'mysql' database.
|
||||
|
||||
SYNOPSIS
|
||||
acl_init()
|
||||
thd Thread handler
|
||||
dont_read_acl_tables Set to 1 if run with --skip-grant
|
||||
dont_read_acl_tables TRUE if we want to skip loading data from
|
||||
privilege tables and disable privilege checking.
|
||||
|
||||
NOTES
|
||||
This function is mostly responsible for preparatory steps, main work
|
||||
on initialization and grants loading is done in acl_reload().
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 Could not initialize grant's
|
||||
*/
|
||||
|
||||
|
||||
my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
||||
my_bool acl_init(bool dont_read_acl_tables)
|
||||
{
|
||||
THD *thd;
|
||||
TABLE_LIST tables[3];
|
||||
TABLE *table;
|
||||
READ_RECORD read_record_info;
|
||||
my_bool return_val=1;
|
||||
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
|
||||
char tmp_name[NAME_LEN+1];
|
||||
|
||||
my_bool return_val;
|
||||
DBUG_ENTER("acl_init");
|
||||
|
||||
if (!acl_cache)
|
||||
acl_cache=new hash_filo(ACL_CACHE_SIZE,0,0,
|
||||
(hash_get_key) acl_entry_get_key,
|
||||
(hash_free_key) free, system_charset_info);
|
||||
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
|
||||
(hash_get_key) acl_entry_get_key,
|
||||
(hash_free_key) free, system_charset_info);
|
||||
if (dont_read_acl_tables)
|
||||
{
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
}
|
||||
|
||||
grant_version++; /* Privileges updated */
|
||||
mysql_proc_table_exists= 1; // Assume mysql.proc exists
|
||||
|
||||
/*
|
||||
To be able to run this from boot, we allocate a temporary THD
|
||||
*/
|
||||
if (!(thd=new THD))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
thd->store_globals();
|
||||
/*
|
||||
It is safe to call acl_reload() since acl_* arrays and hashes which
|
||||
will be freed there are global static objects and thus are initialized
|
||||
by zeros at startup.
|
||||
*/
|
||||
return_val= acl_reload(thd);
|
||||
delete thd;
|
||||
/* Remember that we don't have a THD */
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize structures responsible for user/db-level privilege checking
|
||||
and load information about grants from open privilege tables.
|
||||
|
||||
SYNOPSIS
|
||||
acl_load()
|
||||
thd Current thread
|
||||
tables List containing open "mysql.host", "mysql.user" and
|
||||
"mysql.db" tables.
|
||||
|
||||
RETURN VALUES
|
||||
FALSE Success
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
TABLE *table;
|
||||
READ_RECORD read_record_info;
|
||||
my_bool return_val= 1;
|
||||
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
|
||||
char tmp_name[NAME_LEN+1];
|
||||
DBUG_ENTER("acl_load");
|
||||
|
||||
grant_version++; /* Privileges updated */
|
||||
mysql_proc_table_exists= 1; // Assume mysql.proc exists
|
||||
|
||||
acl_cache->clear(1); // Clear locked hostname cache
|
||||
thd->db= my_strdup("mysql",MYF(0));
|
||||
thd->db_length=5; // Safety
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables[0].alias=tables[0].table_name=(char*) "host";
|
||||
tables[1].alias=tables[1].table_name=(char*) "user";
|
||||
tables[2].alias=tables[2].table_name=(char*) "db";
|
||||
tables[0].next_local= tables[0].next_global= tables+1;
|
||||
tables[1].next_local= tables[1].next_global= tables+2;
|
||||
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
|
||||
tables[0].db=tables[1].db=tables[2].db=thd->db;
|
||||
|
||||
if (simple_open_n_lock_tables(thd, tables))
|
||||
{
|
||||
sql_print_error("Fatal error: Can't open and lock privilege tables: %s",
|
||||
thd->net.last_error);
|
||||
goto end;
|
||||
}
|
||||
init_sql_alloc(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
|
||||
init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0);
|
||||
VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50));
|
||||
|
@ -453,19 +473,9 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
|||
init_check_host();
|
||||
|
||||
initialized=1;
|
||||
thd->version--; // Force close to free memory
|
||||
return_val=0;
|
||||
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
delete thd;
|
||||
if (org_thd)
|
||||
org_thd->store_globals(); /* purecov: inspected */
|
||||
else
|
||||
{
|
||||
/* Remember that we don't have a THD */
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
}
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
@ -489,27 +499,60 @@ void acl_free(bool end)
|
|||
|
||||
|
||||
/*
|
||||
Forget current privileges and read new privileges from the privilege tables
|
||||
Forget current user/db-level privileges and read new privileges
|
||||
from the privilege tables.
|
||||
|
||||
SYNOPSIS
|
||||
acl_reload()
|
||||
thd Thread handle. Note that this may be NULL if we refresh
|
||||
because we got a signal
|
||||
thd Current thread
|
||||
|
||||
NOTE
|
||||
All tables of calling thread which were open and locked by LOCK TABLES
|
||||
statement will be unlocked and closed.
|
||||
This function is also used for initialization of structures responsible
|
||||
for user/db-level privilege checking.
|
||||
|
||||
RETURN VALUE
|
||||
FALSE Success
|
||||
TRUE Failure
|
||||
*/
|
||||
|
||||
void acl_reload(THD *thd)
|
||||
my_bool acl_reload(THD *thd)
|
||||
{
|
||||
TABLE_LIST tables[3];
|
||||
DYNAMIC_ARRAY old_acl_hosts,old_acl_users,old_acl_dbs;
|
||||
MEM_ROOT old_mem;
|
||||
bool old_initialized;
|
||||
my_bool return_val= 1;
|
||||
DBUG_ENTER("acl_reload");
|
||||
|
||||
if (thd && thd->locked_tables)
|
||||
if (thd->locked_tables)
|
||||
{ // Can't have locked tables here
|
||||
thd->lock=thd->locked_tables;
|
||||
thd->locked_tables=0;
|
||||
close_thread_tables(thd);
|
||||
}
|
||||
|
||||
/*
|
||||
To avoid deadlocks we should obtain table locks before
|
||||
obtaining acl_cache->lock mutex.
|
||||
*/
|
||||
bzero((char*) tables, sizeof(tables));
|
||||
tables[0].alias= tables[0].table_name= (char*) "host";
|
||||
tables[1].alias= tables[1].table_name= (char*) "user";
|
||||
tables[2].alias= tables[2].table_name= (char*) "db";
|
||||
tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
|
||||
tables[0].next_local= tables[0].next_global= tables+1;
|
||||
tables[1].next_local= tables[1].next_global= tables+2;
|
||||
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
|
||||
|
||||
if (simple_open_n_lock_tables(thd, tables))
|
||||
{
|
||||
sql_print_error("Fatal error: Can't open and lock privilege tables: %s",
|
||||
thd->net.last_error);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((old_initialized=initialized))
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
|
||||
|
@ -520,7 +563,7 @@ void acl_reload(THD *thd)
|
|||
delete_dynamic(&acl_wild_hosts);
|
||||
hash_free(&acl_check_hosts);
|
||||
|
||||
if (acl_init(thd, 0))
|
||||
if ((return_val= acl_load(thd, tables)))
|
||||
{ // Error. Revert to old list
|
||||
DBUG_PRINT("error",("Reverting to old privileges"));
|
||||
acl_free(); /* purecov: inspected */
|
||||
|
@ -539,7 +582,9 @@ void acl_reload(THD *thd)
|
|||
}
|
||||
if (old_initialized)
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
DBUG_VOID_RETURN;
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1329,7 +1374,13 @@ bool check_change_password(THD *thd, const char *host, const char *user,
|
|||
bool change_password(THD *thd, const char *host, const char *user,
|
||||
char *new_password)
|
||||
{
|
||||
TABLE_LIST tables;
|
||||
TABLE *table;
|
||||
/* Buffer should be extended when password length is extended. */
|
||||
char buff[512];
|
||||
ulong query_length;
|
||||
uint new_password_len= strlen(new_password);
|
||||
bool result= 1;
|
||||
DBUG_ENTER("change_password");
|
||||
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
|
||||
host,user,new_password));
|
||||
|
@ -1338,40 +1389,69 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||
if (check_change_password(thd, host, user, new_password, new_password_len))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
bzero((char*) &tables, sizeof(tables));
|
||||
tables.alias= tables.table_name= (char*) "user";
|
||||
tables.db= (char*) "mysql";
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
GRANT and REVOKE are applied the slave in/exclusion rules as they are
|
||||
some kind of updates to the mysql.% tables.
|
||||
*/
|
||||
if (thd->slave_thread && rpl_filter->is_on())
|
||||
{
|
||||
/*
|
||||
The tables must be marked "updating" so that tables_ok() takes them into
|
||||
account in tests. It's ok to leave 'updating' set after tables_ok.
|
||||
*/
|
||||
tables.updating= 1;
|
||||
/* Thanks to bzero, tables.next==0 */
|
||||
if (!thd->spcont || rpl_filter->tables_ok(0, &tables))
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(table= open_ltable(thd, &tables, TL_WRITE)))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
ACL_USER *acl_user;
|
||||
if (!(acl_user= find_acl_user(host, user, TRUE)))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
goto end;
|
||||
}
|
||||
/* update loaded acl entry: */
|
||||
set_user_salt(acl_user, new_password, new_password_len);
|
||||
|
||||
if (update_user_table(thd,
|
||||
if (update_user_table(thd, table,
|
||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||
acl_user->user ? acl_user->user : "",
|
||||
new_password, new_password_len))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
goto end;
|
||||
}
|
||||
|
||||
acl_cache->clear(1); // Clear locked hostname cache
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
||||
char buff[512]; /* Extend with extended password length*/
|
||||
ulong query_length=
|
||||
my_sprintf(buff,
|
||||
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
|
||||
acl_user->user ? acl_user->user : "",
|
||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||
new_password));
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, buff, query_length, 0, FALSE);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
DBUG_RETURN(0);
|
||||
result= 0;
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
query_length=
|
||||
my_sprintf(buff,
|
||||
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
|
||||
acl_user->user ? acl_user->user : "",
|
||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||
new_password));
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, buff, query_length, 0, FALSE);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1485,44 +1565,29 @@ bool hostname_requires_resolving(const char *hostname)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Update grants in the user and database privilege tables
|
||||
Update record for user in mysql.user privilege table with new password.
|
||||
|
||||
SYNOPSIS
|
||||
update_user_table()
|
||||
thd Thread handle
|
||||
table Pointer to TABLE object for open mysql.user table
|
||||
host/user Hostname/username pair identifying user for which
|
||||
new password should be set
|
||||
new_password New password
|
||||
new_password_len Length of new password
|
||||
*/
|
||||
|
||||
static bool update_user_table(THD *thd, const char *host, const char *user,
|
||||
static bool update_user_table(THD *thd, TABLE *table,
|
||||
const char *host, const char *user,
|
||||
const char *new_password, uint new_password_len)
|
||||
{
|
||||
TABLE_LIST tables;
|
||||
TABLE *table;
|
||||
bool error=1;
|
||||
char user_key[MAX_KEY_LENGTH];
|
||||
int error;
|
||||
DBUG_ENTER("update_user_table");
|
||||
DBUG_PRINT("enter",("user: %s host: %s",user,host));
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.alias=tables.table_name=(char*) "user";
|
||||
tables.db=(char*) "mysql";
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
GRANT and REVOKE are applied the slave in/exclusion rules as they are
|
||||
some kind of updates to the mysql.% tables.
|
||||
*/
|
||||
if (thd->slave_thread && rpl_filter->is_on())
|
||||
{
|
||||
/*
|
||||
The tables must be marked "updating" so that tables_ok() takes them into
|
||||
account in tests. It's ok to leave 'updating' set after tables_ok.
|
||||
*/
|
||||
tables.updating= 1;
|
||||
/* Thanks to bzero, tables.next==0 */
|
||||
if (!(thd->spcont || rpl_filter->tables_ok(0, &tables)))
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
table->field[0]->store(host,(uint) strlen(host), system_charset_info);
|
||||
table->field[1]->store(user,(uint) strlen(user), system_charset_info);
|
||||
key_copy((byte *) user_key, table->record[0], table->key_info,
|
||||
|
@ -1542,13 +1607,9 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
|
|||
if ((error=table->file->update_row(table->record[1],table->record[0])))
|
||||
{
|
||||
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
|
||||
goto end; /* purecov: deadcode */
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
error=0; // Record updated
|
||||
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(error);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3125,17 +3186,59 @@ void grant_free(void)
|
|||
}
|
||||
|
||||
|
||||
/* Init grant array if possible */
|
||||
/*
|
||||
Initialize structures responsible for table/column-level privilege checking
|
||||
and load information for them from tables in the 'mysql' database.
|
||||
|
||||
my_bool grant_init(THD *org_thd)
|
||||
SYNOPSIS
|
||||
grant_init()
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 Could not initialize grant's
|
||||
*/
|
||||
|
||||
my_bool grant_init()
|
||||
{
|
||||
THD *thd;
|
||||
TABLE_LIST tables[3];
|
||||
my_bool return_val;
|
||||
DBUG_ENTER("grant_init");
|
||||
|
||||
if (!(thd= new THD))
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
thd->store_globals();
|
||||
return_val= grant_reload(thd);
|
||||
delete thd;
|
||||
/* Remember that we don't have a THD */
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize structures responsible for table/column-level privilege
|
||||
checking and load information about grants from open privilege tables.
|
||||
|
||||
SYNOPSIS
|
||||
grant_load()
|
||||
thd Current thread
|
||||
tables List containing open "mysql.tables_priv" and
|
||||
"mysql.columns_priv" tables.
|
||||
|
||||
RETURN VALUES
|
||||
FALSE - success
|
||||
TRUE - error
|
||||
*/
|
||||
|
||||
static my_bool grant_load(TABLE_LIST *tables)
|
||||
{
|
||||
MEM_ROOT *memex_ptr;
|
||||
my_bool return_val= 1;
|
||||
TABLE *t_table, *c_table, *p_table;
|
||||
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
|
||||
DBUG_ENTER("grant_init");
|
||||
MEM_ROOT **save_mem_root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,
|
||||
THR_MALLOC);
|
||||
DBUG_ENTER("grant_load");
|
||||
|
||||
grant_option = FALSE;
|
||||
(void) hash_init(&column_priv_hash,system_charset_info,
|
||||
|
@ -3149,34 +3252,12 @@ my_bool grant_init(THD *org_thd)
|
|||
0,0);
|
||||
init_sql_alloc(&memex, ACL_ALLOC_BLOCK_SIZE, 0);
|
||||
|
||||
/* Don't do anything if running with --skip-grant */
|
||||
if (!initialized)
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
|
||||
if (!(thd=new THD))
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
thd->store_globals();
|
||||
thd->db= my_strdup("mysql",MYF(0));
|
||||
thd->db_length=5; // Safety
|
||||
bzero((char*) &tables, sizeof(tables));
|
||||
tables[0].alias=tables[0].table_name= (char*) "tables_priv";
|
||||
tables[1].alias=tables[1].table_name= (char*) "columns_priv";
|
||||
tables[2].alias=tables[2].table_name= (char*) "procs_priv";
|
||||
tables[0].next_local= tables[0].next_global= tables+1;
|
||||
tables[1].next_local= tables[1].next_global= tables+2;
|
||||
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
|
||||
tables[0].db=tables[1].db=tables[2].db=thd->db;
|
||||
|
||||
if (simple_open_n_lock_tables(thd, tables))
|
||||
goto end;
|
||||
|
||||
t_table = tables[0].table; c_table = tables[1].table;
|
||||
p_table= tables[2].table;
|
||||
t_table->file->ha_index_init(0, 1);
|
||||
p_table->file->ha_index_init(0, 1);
|
||||
if (!t_table->file->index_first(t_table->record[0]))
|
||||
{
|
||||
/* Will be restored by org_thd->store_globals() */
|
||||
memex_ptr= &memex;
|
||||
my_pthread_setspecific_ptr(THR_MALLOC, &memex_ptr);
|
||||
do
|
||||
|
@ -3214,7 +3295,6 @@ my_bool grant_init(THD *org_thd)
|
|||
}
|
||||
if (!p_table->file->index_first(p_table->record[0]))
|
||||
{
|
||||
/* Will be restored by org_thd->store_globals() */
|
||||
memex_ptr= &memex;
|
||||
my_pthread_setspecific_ptr(THR_MALLOC, &memex_ptr);
|
||||
do
|
||||
|
@ -3274,40 +3354,58 @@ my_bool grant_init(THD *org_thd)
|
|||
end_unlock:
|
||||
t_table->file->ha_index_end();
|
||||
p_table->file->ha_index_end();
|
||||
thd->version--; // Force close to free memory
|
||||
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
delete thd;
|
||||
if (org_thd)
|
||||
org_thd->store_globals();
|
||||
else
|
||||
{
|
||||
/* Remember that we don't have a THD */
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
}
|
||||
my_pthread_setspecific_ptr(THR_MALLOC, save_mem_root_ptr);
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Reload grant array (table and column privileges) if possible
|
||||
Reload information about table and column level privileges if possible.
|
||||
|
||||
SYNOPSIS
|
||||
grant_reload()
|
||||
thd Thread handler (can be NULL)
|
||||
thd Current thread
|
||||
|
||||
NOTES
|
||||
Locked tables are checked by acl_init and doesn't have to be checked here
|
||||
Locked tables are checked by acl_reload() and doesn't have to be checked
|
||||
in this call.
|
||||
This function is also used for initialization of structures responsible
|
||||
for table/column-level privilege checking.
|
||||
|
||||
RETURN VALUE
|
||||
FALSE Success
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
void grant_reload(THD *thd)
|
||||
my_bool grant_reload(THD *thd)
|
||||
{
|
||||
TABLE_LIST tables[3];
|
||||
HASH old_column_priv_hash, old_proc_priv_hash, old_func_priv_hash;
|
||||
bool old_grant_option;
|
||||
MEM_ROOT old_mem;
|
||||
my_bool return_val= 1;
|
||||
DBUG_ENTER("grant_reload");
|
||||
|
||||
/* Don't do anything if running with --skip-grant-tables */
|
||||
if (!initialized)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
bzero((char*) tables, sizeof(tables));
|
||||
tables[0].alias= tables[0].table_name= (char*) "tables_priv";
|
||||
tables[1].alias= tables[1].table_name= (char*) "columns_priv";
|
||||
tables[2].alias= tables[2].table_name= (char*) "procs_priv";
|
||||
tables[0].db= tables[1].db= tables[2].db= (char *) "mysql";
|
||||
tables[0].next_local= tables[0].next_global= tables+1;
|
||||
tables[1].next_local= tables[1].next_global= tables+2;
|
||||
tables[0].lock_type= tables[1].lock_type= tables[2].lock_type= TL_READ;
|
||||
|
||||
/*
|
||||
To avoid deadlocks we should obtain table locks before
|
||||
obtaining LOCK_grant rwlock.
|
||||
*/
|
||||
if (simple_open_n_lock_tables(thd, tables))
|
||||
goto end;
|
||||
|
||||
rw_wrlock(&LOCK_grant);
|
||||
grant_version++;
|
||||
old_column_priv_hash= column_priv_hash;
|
||||
|
@ -3316,7 +3414,7 @@ void grant_reload(THD *thd)
|
|||
old_grant_option= grant_option;
|
||||
old_mem= memex;
|
||||
|
||||
if (grant_init(thd))
|
||||
if ((return_val= grant_load(tables)))
|
||||
{ // Error. Revert to old hash
|
||||
DBUG_PRINT("error",("Reverting to old privileges"));
|
||||
grant_free(); /* purecov: deadcode */
|
||||
|
@ -3334,7 +3432,9 @@ void grant_reload(THD *thd)
|
|||
free_root(&old_mem,MYF(0));
|
||||
}
|
||||
rw_unlock(&LOCK_grant);
|
||||
DBUG_VOID_RETURN;
|
||||
end:
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(return_val);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -175,8 +175,8 @@ public:
|
|||
/* prototypes */
|
||||
|
||||
bool hostname_requires_resolving(const char *hostname);
|
||||
my_bool acl_init(THD *thd, bool dont_read_acl_tables);
|
||||
void acl_reload(THD *thd);
|
||||
my_bool acl_init(bool dont_read_acl_tables);
|
||||
my_bool acl_reload(THD *thd);
|
||||
void acl_free(bool end=0);
|
||||
ulong acl_get(const char *host, const char *ip,
|
||||
const char *user, const char *db, my_bool db_is_pattern);
|
||||
|
@ -197,9 +197,9 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc,
|
|||
List <LEX_USER> &user_list, ulong rights,
|
||||
bool revoke, bool no_error);
|
||||
ACL_USER *check_acl_user(LEX_USER *user_name, uint *acl_acl_userdx);
|
||||
my_bool grant_init(THD *thd);
|
||||
my_bool grant_init();
|
||||
void grant_free(void);
|
||||
void grant_reload(THD *thd);
|
||||
my_bool grant_reload(THD *thd);
|
||||
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
uint show_command, uint number, bool dont_print_error);
|
||||
bool check_grant_column (THD *thd, GRANT_INFO *grant,
|
||||
|
|
|
@ -923,8 +923,7 @@ static int check_connection(THD *thd)
|
|||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||
if (sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout))
|
||||
{
|
||||
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
|
||||
pkt_len));
|
||||
DBUG_PRINT("error", ("Failed to accept new SSL connection"));
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
return(ER_HANDSHAKE_ERROR);
|
||||
}
|
||||
|
@ -3472,7 +3471,7 @@ end_with_restore_list:
|
|||
if (lex->local_file)
|
||||
{
|
||||
if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) ||
|
||||
! opt_local_infile)
|
||||
!opt_local_infile)
|
||||
{
|
||||
my_message(ER_NOT_ALLOWED_COMMAND, ER(ER_NOT_ALLOWED_COMMAND), MYF(0));
|
||||
goto error;
|
||||
|
@ -6557,8 +6556,25 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
|||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (options & REFRESH_GRANT)
|
||||
{
|
||||
acl_reload(thd);
|
||||
grant_reload(thd);
|
||||
THD *tmp_thd= 0;
|
||||
/*
|
||||
If reload_acl_and_cache() is called from SIGHUP handler we have to
|
||||
allocate temporary THD for execution of acl_reload()/grant_reload().
|
||||
*/
|
||||
if (!thd && (thd= (tmp_thd= new THD)))
|
||||
thd->store_globals();
|
||||
if (thd)
|
||||
{
|
||||
(void)acl_reload(thd);
|
||||
(void)grant_reload(thd);
|
||||
}
|
||||
if (tmp_thd)
|
||||
{
|
||||
delete tmp_thd;
|
||||
/* Remember that we don't have a THD */
|
||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||
thd= 0;
|
||||
}
|
||||
reset_mqh((LEX_USER *)NULL, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7968,6 +7968,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
|||
item->name, table, item->unsigned_flag);
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
DBUG_ASSERT(item->collation.collation);
|
||||
|
||||
enum enum_field_types type;
|
||||
/*
|
||||
DATE/TIME fields have STRING_RESULT result type. To preserve
|
||||
|
@ -7976,7 +7978,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
|||
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
|
||||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE)
|
||||
new_field= item->tmp_table_field_from_field_type(table);
|
||||
else if (item->max_length > 255 && convert_blob_length)
|
||||
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
|
||||
convert_blob_length)
|
||||
new_field= new Field_varstring(convert_blob_length, maybe_null,
|
||||
item->name, table,
|
||||
item->collation.collation);
|
||||
|
|
|
@ -2529,11 +2529,16 @@ send_result_message:
|
|||
}
|
||||
|
||||
default: // Probably HA_ADMIN_INTERNAL_ERROR
|
||||
protocol->store("error", 5, system_charset_info);
|
||||
protocol->store("Unknown - internal error during operation", 41
|
||||
, system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
{
|
||||
char buf[ERRMSGSIZE+20];
|
||||
uint length=my_snprintf(buf, ERRMSGSIZE,
|
||||
"Unknown - internal error %d during operation",
|
||||
result_code);
|
||||
protocol->store("error", 5, system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fatal_error)
|
||||
table->table->s->version=0; // Force close of table
|
||||
|
@ -3951,7 +3956,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
Field **f_ptr,*field;
|
||||
for (f_ptr=table->field ; (field= *f_ptr) ; f_ptr++)
|
||||
{
|
||||
/* Check if field should be droped */
|
||||
/* Check if field should be dropped */
|
||||
Alter_drop *drop;
|
||||
drop_it.rewind();
|
||||
while ((drop=drop_it++))
|
||||
|
|
|
@ -62,7 +62,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
|
|||
}
|
||||
if (share->base.blobs)
|
||||
mi_alloc_rec_buff(info, -1, &info->rec_buff);
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
|
||||
if (info->opt_flag & MEMMAP_USED)
|
||||
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
|
||||
#endif
|
||||
|
@ -93,7 +93,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
|
|||
my_errno=EACCES;
|
||||
break;
|
||||
}
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
|
||||
if ((share->options & HA_OPTION_COMPRESS_RECORD))
|
||||
{
|
||||
pthread_mutex_lock(&share->intern_lock);
|
||||
|
@ -177,7 +177,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
|
|||
error=end_io_cache(&info->rec_cache);
|
||||
/* Sergei will insert full text index caching here */
|
||||
}
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
|
||||
if (info->opt_flag & MEMMAP_USED)
|
||||
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
|
||||
#endif
|
||||
|
|
|
@ -31,25 +31,7 @@
|
|||
* SENDER: Ndbfs
|
||||
* RECIVER:
|
||||
*/
|
||||
class FsRef {
|
||||
/**
|
||||
* Reciver(s)
|
||||
*/
|
||||
friend class Dbdict;
|
||||
friend class Backup;
|
||||
|
||||
/**
|
||||
* Sender(s)
|
||||
*/
|
||||
friend class Ndbfs;
|
||||
friend class VoidFs;
|
||||
|
||||
/**
|
||||
* For printing
|
||||
*/
|
||||
friend bool printFSREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
|
||||
|
||||
public:
|
||||
struct FsRef {
|
||||
/**
|
||||
* Enum type for errorCode
|
||||
*/
|
||||
|
@ -73,8 +55,6 @@ public:
|
|||
*/
|
||||
STATIC_CONST( SignalLength = 4 );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* DATA VARIABLES
|
||||
*/
|
||||
|
|
|
@ -150,16 +150,16 @@ Backup::Backup(const Configuration & conf) :
|
|||
addRecSignal(GSN_DI_FCOUNTCONF, &Backup::execDI_FCOUNTCONF);
|
||||
addRecSignal(GSN_DIGETPRIMCONF, &Backup::execDIGETPRIMCONF);
|
||||
|
||||
addRecSignal(GSN_FSOPENREF, &Backup::execFSOPENREF);
|
||||
addRecSignal(GSN_FSOPENREF, &Backup::execFSOPENREF, true);
|
||||
addRecSignal(GSN_FSOPENCONF, &Backup::execFSOPENCONF);
|
||||
|
||||
addRecSignal(GSN_FSCLOSEREF, &Backup::execFSCLOSEREF);
|
||||
addRecSignal(GSN_FSCLOSEREF, &Backup::execFSCLOSEREF, true);
|
||||
addRecSignal(GSN_FSCLOSECONF, &Backup::execFSCLOSECONF);
|
||||
|
||||
addRecSignal(GSN_FSAPPENDREF, &Backup::execFSAPPENDREF);
|
||||
addRecSignal(GSN_FSAPPENDREF, &Backup::execFSAPPENDREF, true);
|
||||
addRecSignal(GSN_FSAPPENDCONF, &Backup::execFSAPPENDCONF);
|
||||
|
||||
addRecSignal(GSN_FSREMOVEREF, &Backup::execFSREMOVEREF);
|
||||
addRecSignal(GSN_FSREMOVEREF, &Backup::execFSREMOVEREF, true);
|
||||
addRecSignal(GSN_FSREMOVECONF, &Backup::execFSREMOVECONF);
|
||||
|
||||
/*****/
|
||||
|
|
|
@ -905,17 +905,12 @@ private:
|
|||
void execACC_TO_REQ(Signal* signal);
|
||||
void execACC_LOCKREQ(Signal* signal);
|
||||
void execFSOPENCONF(Signal* signal);
|
||||
void execFSOPENREF(Signal* signal);
|
||||
void execFSCLOSECONF(Signal* signal);
|
||||
void execFSCLOSEREF(Signal* signal);
|
||||
void execFSWRITECONF(Signal* signal);
|
||||
void execFSWRITEREF(Signal* signal);
|
||||
void execFSREADCONF(Signal* signal);
|
||||
void execFSREADREF(Signal* signal);
|
||||
void execNDB_STTOR(Signal* signal);
|
||||
void execDROP_TAB_REQ(Signal* signal);
|
||||
void execFSREMOVECONF(Signal* signal);
|
||||
void execFSREMOVEREF(Signal* signal);
|
||||
void execREAD_CONFIG_REQ(Signal* signal);
|
||||
void execSET_VAR_REQ(Signal* signal);
|
||||
void execDUMP_STATE_ORD(Signal* signal);
|
||||
|
|
|
@ -188,17 +188,12 @@ Dbacc::Dbacc(const class Configuration & conf):
|
|||
addRecSignal(GSN_ACC_TO_REQ, &Dbacc::execACC_TO_REQ);
|
||||
addRecSignal(GSN_ACC_LOCKREQ, &Dbacc::execACC_LOCKREQ);
|
||||
addRecSignal(GSN_FSOPENCONF, &Dbacc::execFSOPENCONF);
|
||||
addRecSignal(GSN_FSOPENREF, &Dbacc::execFSOPENREF);
|
||||
addRecSignal(GSN_FSCLOSECONF, &Dbacc::execFSCLOSECONF);
|
||||
addRecSignal(GSN_FSCLOSEREF, &Dbacc::execFSCLOSEREF);
|
||||
addRecSignal(GSN_FSWRITECONF, &Dbacc::execFSWRITECONF);
|
||||
addRecSignal(GSN_FSWRITEREF, &Dbacc::execFSWRITEREF);
|
||||
addRecSignal(GSN_FSREADCONF, &Dbacc::execFSREADCONF);
|
||||
addRecSignal(GSN_FSREADREF, &Dbacc::execFSREADREF);
|
||||
addRecSignal(GSN_NDB_STTOR, &Dbacc::execNDB_STTOR);
|
||||
addRecSignal(GSN_DROP_TAB_REQ, &Dbacc::execDROP_TAB_REQ);
|
||||
addRecSignal(GSN_FSREMOVECONF, &Dbacc::execFSREMOVECONF);
|
||||
addRecSignal(GSN_FSREMOVEREF, &Dbacc::execFSREMOVEREF);
|
||||
addRecSignal(GSN_READ_CONFIG_REQ, &Dbacc::execREAD_CONFIG_REQ, true);
|
||||
addRecSignal(GSN_SET_VAR_REQ, &Dbacc::execSET_VAR_REQ);
|
||||
|
||||
|
|
|
@ -251,15 +251,6 @@ void Dbacc::execFSCLOSECONF(Signal* signal)
|
|||
return;
|
||||
}//Dbacc::execFSCLOSECONF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSCLOSEREF OPENFILE CONF */
|
||||
/* ******************------------------------------+ */
|
||||
/* SENDER: FS, LEVEL B */
|
||||
void Dbacc::execFSCLOSEREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
ndbrequire(false);
|
||||
}//Dbacc::execFSCLOSEREF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSOPENCONF OPENFILE CONF */
|
||||
|
@ -307,15 +298,6 @@ void Dbacc::execFSOPENCONF(Signal* signal)
|
|||
return;
|
||||
}//Dbacc::execFSOPENCONF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSOPENREF OPENFILE REF */
|
||||
/* ******************------------------------------+ */
|
||||
/* SENDER: FS, LEVEL B */
|
||||
void Dbacc::execFSOPENREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
ndbrequire(false);
|
||||
}//Dbacc::execFSOPENREF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSREADCONF OPENFILE CONF */
|
||||
|
@ -369,16 +351,6 @@ void Dbacc::execFSREADCONF(Signal* signal)
|
|||
return;
|
||||
}//Dbacc::execFSREADCONF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSREADRREF OPENFILE CONF */
|
||||
/* ******************------------------------------+ */
|
||||
/* SENDER: FS, LEVEL B */
|
||||
void Dbacc::execFSREADREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
progError(0, __LINE__, "Read of file refused");
|
||||
return;
|
||||
}//Dbacc::execFSREADREF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSWRITECONF OPENFILE CONF */
|
||||
|
@ -482,16 +454,6 @@ void Dbacc::execFSWRITECONF(Signal* signal)
|
|||
return;
|
||||
}//Dbacc::execFSWRITECONF()
|
||||
|
||||
/* ******************--------------------------------------------------------------- */
|
||||
/* FSWRITEREF OPENFILE CONF */
|
||||
/* ******************------------------------------+ */
|
||||
/* SENDER: FS, LEVEL B */
|
||||
void Dbacc::execFSWRITEREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
progError(0, __LINE__, "Write to file refused");
|
||||
return;
|
||||
}//Dbacc::execFSWRITEREF()
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@ -1436,10 +1398,6 @@ void Dbacc::execFSREMOVECONF(Signal* signal)
|
|||
tabPtr.p->tabUserRef = 0;
|
||||
}//Dbacc::execFSREMOVECONF()
|
||||
|
||||
void Dbacc::execFSREMOVEREF(Signal* signal)
|
||||
{
|
||||
ndbrequire(false);
|
||||
}//Dbacc::execFSREMOVEREF()
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ADDFRAGTOTAB */
|
||||
|
|
|
@ -399,14 +399,6 @@ void Dbdict::execFSCLOSECONF(Signal* signal)
|
|||
}//switch
|
||||
}//execFSCLOSECONF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
// A close file was refused.
|
||||
/* ---------------------------------------------------------------- */
|
||||
void Dbdict::execFSCLOSEREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
progError(0, 0);
|
||||
}//execFSCLOSEREF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
// A file was successfully opened.
|
||||
|
@ -469,17 +461,21 @@ void Dbdict::execFSOPENREF(Signal* signal)
|
|||
c_fsConnectRecordPool.getPtr(fsPtr, fsRef->userPointer);
|
||||
switch (fsPtr.p->fsState) {
|
||||
case FsConnectRecord::OPEN_READ_SCHEMA1:
|
||||
jam();
|
||||
openReadSchemaRef(signal, fsPtr);
|
||||
break;
|
||||
return;
|
||||
case FsConnectRecord::OPEN_READ_TAB_FILE1:
|
||||
jam();
|
||||
openReadTableRef(signal, fsPtr);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
jamLine((fsPtr.p->fsState & 0xFFF));
|
||||
ndbrequire(false);
|
||||
break;
|
||||
}//switch
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system open failed during FsConnectRecord state %d", (Uint32)fsPtr.p->fsState);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
}//execFSOPENREF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@ -519,17 +515,21 @@ void Dbdict::execFSREADREF(Signal* signal)
|
|||
c_fsConnectRecordPool.getPtr(fsPtr, fsRef->userPointer);
|
||||
switch (fsPtr.p->fsState) {
|
||||
case FsConnectRecord::READ_SCHEMA1:
|
||||
jam();
|
||||
readSchemaRef(signal, fsPtr);
|
||||
break;
|
||||
return;
|
||||
case FsConnectRecord::READ_TAB_FILE1:
|
||||
jam();
|
||||
readTableRef(signal, fsPtr);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
jamLine((fsPtr.p->fsState & 0xFFF));
|
||||
ndbrequire(false);
|
||||
break;
|
||||
}//switch
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system read failed during FsConnectRecord state %d", (Uint32)fsPtr.p->fsState);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
}//execFSREADREF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@ -556,14 +556,6 @@ void Dbdict::execFSWRITECONF(Signal* signal)
|
|||
}//switch
|
||||
}//execFSWRITECONF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
// A write file was refused.
|
||||
/* ---------------------------------------------------------------- */
|
||||
void Dbdict::execFSWRITEREF(Signal* signal)
|
||||
{
|
||||
jamEntry();
|
||||
progError(0, 0);
|
||||
}//execFSWRITEREF()
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
// Routines to handle Read/Write of Table Files
|
||||
|
@ -1326,13 +1318,11 @@ Dbdict::Dbdict(const class Configuration & conf):
|
|||
addRecSignal(GSN_DICTSTARTREQ, &Dbdict::execDICTSTARTREQ);
|
||||
addRecSignal(GSN_READ_NODESCONF, &Dbdict::execREAD_NODESCONF);
|
||||
addRecSignal(GSN_FSOPENCONF, &Dbdict::execFSOPENCONF);
|
||||
addRecSignal(GSN_FSOPENREF, &Dbdict::execFSOPENREF);
|
||||
addRecSignal(GSN_FSOPENREF, &Dbdict::execFSOPENREF, true);
|
||||
addRecSignal(GSN_FSCLOSECONF, &Dbdict::execFSCLOSECONF);
|
||||
addRecSignal(GSN_FSCLOSEREF, &Dbdict::execFSCLOSEREF);
|
||||
addRecSignal(GSN_FSWRITECONF, &Dbdict::execFSWRITECONF);
|
||||
addRecSignal(GSN_FSWRITEREF, &Dbdict::execFSWRITEREF);
|
||||
addRecSignal(GSN_FSREADCONF, &Dbdict::execFSREADCONF);
|
||||
addRecSignal(GSN_FSREADREF, &Dbdict::execFSREADREF);
|
||||
addRecSignal(GSN_FSREADREF, &Dbdict::execFSREADREF, true);
|
||||
addRecSignal(GSN_LQHFRAGCONF, &Dbdict::execLQHFRAGCONF);
|
||||
addRecSignal(GSN_LQHADDATTCONF, &Dbdict::execLQHADDATTCONF);
|
||||
addRecSignal(GSN_LQHADDATTREF, &Dbdict::execLQHADDATTREF);
|
||||
|
|
|
@ -471,13 +471,11 @@ private:
|
|||
void execSCHEMA_INFOCONF(Signal* signal);
|
||||
void execREAD_NODESCONF(Signal* signal);
|
||||
void execFSCLOSECONF(Signal* signal);
|
||||
void execFSCLOSEREF(Signal* signal);
|
||||
void execFSOPENCONF(Signal* signal);
|
||||
void execFSOPENREF(Signal* signal);
|
||||
void execFSREADCONF(Signal* signal);
|
||||
void execFSREADREF(Signal* signal);
|
||||
void execFSWRITECONF(Signal* signal);
|
||||
void execFSWRITEREF(Signal* signal);
|
||||
void execNDB_STTOR(Signal* signal);
|
||||
void execREAD_CONFIG_REQ(Signal* signal);
|
||||
void execSTTOR(Signal* signal);
|
||||
|
|
|
@ -206,13 +206,13 @@ Dbdih::Dbdih(const class Configuration & config):
|
|||
addRecSignal(GSN_ADD_FRAGCONF, &Dbdih::execADD_FRAGCONF);
|
||||
addRecSignal(GSN_ADD_FRAGREF, &Dbdih::execADD_FRAGREF);
|
||||
addRecSignal(GSN_FSOPENCONF, &Dbdih::execFSOPENCONF);
|
||||
addRecSignal(GSN_FSOPENREF, &Dbdih::execFSOPENREF);
|
||||
addRecSignal(GSN_FSOPENREF, &Dbdih::execFSOPENREF, true);
|
||||
addRecSignal(GSN_FSCLOSECONF, &Dbdih::execFSCLOSECONF);
|
||||
addRecSignal(GSN_FSCLOSEREF, &Dbdih::execFSCLOSEREF);
|
||||
addRecSignal(GSN_FSCLOSEREF, &Dbdih::execFSCLOSEREF, true);
|
||||
addRecSignal(GSN_FSREADCONF, &Dbdih::execFSREADCONF);
|
||||
addRecSignal(GSN_FSREADREF, &Dbdih::execFSREADREF);
|
||||
addRecSignal(GSN_FSREADREF, &Dbdih::execFSREADREF, true);
|
||||
addRecSignal(GSN_FSWRITECONF, &Dbdih::execFSWRITECONF);
|
||||
addRecSignal(GSN_FSWRITEREF, &Dbdih::execFSWRITEREF);
|
||||
addRecSignal(GSN_FSWRITEREF, &Dbdih::execFSWRITEREF, true);
|
||||
addRecSignal(GSN_SET_VAR_REQ, &Dbdih::execSET_VAR_REQ);
|
||||
|
||||
addRecSignal(GSN_START_INFOREQ,
|
||||
|
|
|
@ -782,29 +782,36 @@ void Dbdih::execFSCLOSEREF(Signal* signal)
|
|||
filePtr.p->reqStatus = FileRecord::IDLE;
|
||||
switch (status) {
|
||||
case FileRecord::CLOSING_GCP:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::CLOSING_GCP_CRASH:
|
||||
jam();
|
||||
closingGcpCrashLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::CLOSING_TABLE_CRASH:
|
||||
jam();
|
||||
closingTableCrashLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::CLOSING_TABLE_SR:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::TABLE_CLOSE:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::TABLE_CLOSE_DELETE:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
default:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
|
||||
}//switch
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system close failed during FileRecord status %d", (Uint32)status);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
|
||||
return;
|
||||
}//Dbdih::execFSCLOSEREF()
|
||||
|
||||
|
@ -868,34 +875,39 @@ void Dbdih::execFSOPENREF(Signal* signal)
|
|||
/* WE DID NOT MANAGE TO CREATE A GLOBAL CHECKPOINT FILE. SERIOUS ERROR */
|
||||
/* WHICH CAUSES A SYSTEM RESTART. */
|
||||
/* --------------------------------------------------------------------- */
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::OPENING_COPY_GCI:
|
||||
jam();
|
||||
openingCopyGciErrorLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::CREATING_COPY_GCI:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::OPENING_GCP:
|
||||
jam();
|
||||
openingGcpErrorLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::OPENING_TABLE:
|
||||
jam();
|
||||
openingTableErrorLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::TABLE_CREATE:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::TABLE_OPEN_FOR_DELETE:
|
||||
jam();
|
||||
tableDeleteLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
}//switch
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system open failed during FileRecord status %d", (Uint32)status);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
return;
|
||||
}//Dbdih::execFSOPENREF()
|
||||
|
||||
|
@ -935,16 +947,19 @@ void Dbdih::execFSREADREF(Signal* signal)
|
|||
case FileRecord::READING_GCP:
|
||||
jam();
|
||||
readingGcpErrorLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
case FileRecord::READING_TABLE:
|
||||
jam();
|
||||
readingTableErrorLab(signal, filePtr);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
ndbrequire(false);
|
||||
break;
|
||||
}//switch
|
||||
return;
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system read failed during FileRecord status %d", (Uint32)status);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
}//Dbdih::execFSREADREF()
|
||||
|
||||
void Dbdih::execFSWRITECONF(Signal* signal)
|
||||
|
@ -989,22 +1004,27 @@ void Dbdih::execFSWRITEREF(Signal* signal)
|
|||
/* EVEN CREATING THE FILE DID NOT WORK. WE WILL THEN CRASH. */
|
||||
/* ERROR IN WRITING FILE. WE WILL NOT CONTINUE FROM HERE. */
|
||||
/* --------------------------------------------------------------------- */
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::WRITE_INIT_GCP:
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* AN ERROR OCCURRED IN WRITING A GCI FILE WHICH IS A SERIOUS ERROR */
|
||||
/* THAT CAUSE A SYSTEM RESTART. */
|
||||
/* --------------------------------------------------------------------- */
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
case FileRecord::TABLE_WRITE:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
default:
|
||||
ndbrequire(false);
|
||||
jam();
|
||||
break;
|
||||
}//switch
|
||||
{
|
||||
char msg[100];
|
||||
sprintf(msg, "File system write failed during FileRecord status %d", (Uint32)status);
|
||||
fsRefError(signal,__LINE__,msg);
|
||||
}
|
||||
return;
|
||||
}//Dbdih::execFSWRITEREF()
|
||||
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
noinst_LIBRARIES = libdbdih.a
|
||||
EXTRA_PROGRAMS = ndbd_sysfile_reader
|
||||
|
||||
libdbdih_a_SOURCES = DbdihInit.cpp DbdihMain.cpp
|
||||
ndbd_sysfile_reader_SOURCES = printSysfile/printSysfile.cpp
|
||||
|
||||
include $(top_srcdir)/storage/ndb/config/common.mk.am
|
||||
include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
|
||||
|
||||
LDADD += \
|
||||
$(top_builddir)/ndb/src/common/util/libgeneral.la \
|
||||
$(top_builddir)/ndb/src/common/portlib/libportlib.la
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue