Commit 72cc5173 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Merge from mysql-5.5-bugteam to mysql-5.5-runtime.

parents c4a18b6a 774a5778
...@@ -24,7 +24,7 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ ...@@ -24,7 +24,7 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common scripts \ @readline_topdir@ sql-common scripts \
@pstack_dir@ libservices \ libservices \
@sql_union_dirs@ unittest \ @sql_union_dirs@ unittest \
@sql_server@ @man_dirs@ tests \ @sql_server@ @man_dirs@ tests \
@libmysqld_dirs@ \ @libmysqld_dirs@ \
...@@ -34,7 +34,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ ...@@ -34,7 +34,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
cmake cmake
DIST_SUBDIRS = . include Docs zlib \ DIST_SUBDIRS = . include Docs zlib \
cmd-line-utils sql-common scripts \ cmd-line-utils sql-common scripts \
pstack libservices \ libservices \
strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \ strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
vio sql man tests \ vio sql man tests \
libmysqld \ libmysqld \
......
...@@ -2208,97 +2208,3 @@ library. If this is what you want to do, use the GNU Lesser General ...@@ -2208,97 +2208,3 @@ library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. Public License instead of this License.
*************************************************************************** ***************************************************************************
%%The following software may be included in this product:
pstack (part of GNU Binutils)
Use of any of this software is governed by the terms of the license below:
pstack is comprised of various .c and .h files; all begin like this:
/* bucomm.h -- binutils common include file.
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
***************************************************************************
%%The following software may be included in this product:
libiberty.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://www.koders.com/c/fid99F596804BBE22C076522B848D5575F142079064.aspx
/* Function declarations for libiberty.
Written by Cygnus Support, 1994.
The libiberty library provides a number of functions which are
missing on some operating systems. We do not declare those here,
to avoid conflicts with the system header files on operating
systems that do support those functions. In this file we only
declare those functions which are specific to libiberty. */
***************************************************************************
%%The following software may be included in this product:
ieee.h (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
See
http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee.h
/* IEEE Standard 695-1980 "Universal Format for Object Modules"
header file
Contributed by Cygnus Support. */
***************************************************************************
%%The following software may be included in this product:
pstack.c (part of pstack GNU Binutils)
Use of any of this software is governed by the terms of the license below:
/*
pstack.c -- asynchronous stack trace of a running process
Copyright (c) 1999 Ross Thompson
Author: Ross Thompson
Critical bug fix: Tim Waugh
*/
/*
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
***************************************************************************
This diff is collapsed.
...@@ -1069,46 +1069,6 @@ struct request_info *req; ...@@ -1069,46 +1069,6 @@ struct request_info *req;
]) ])
AC_SUBST(WRAPLIBS) AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],
[ USE_PSTACK=no ])
pstack_libs=
pstack_dir=
if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386"
then
have_libiberty= have_libbfd=
my_save_LIBS="$LIBS"
dnl I have no idea if this is a good test - can not find docs for libiberty
AC_CHECK_LIB([iberty], [fdmatch],
[have_libiberty=yes
AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])])
LIBS="$my_save_LIBS"
if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
then
pstack_dir="pstack"
pstack_libs="../pstack/libpstack.a -lbfd -liberty"
# We must link staticly when using pstack
with_mysqld_ldflags="-all-static"
AC_SUBST([pstack_dir])
AC_SUBST([pstack_libs])
AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
dnl This check isn't needed, but might be nice to give some feedback....
dnl AC_CHECK_HEADER(libiberty.h,
dnl have_libiberty_h=yes,
dnl have_libiberty_h=no)
else
USE_PSTACK="no"
fi
else
USE_PSTACK="no"
fi
fi
AC_MSG_CHECKING([if we should use pstack])
AC_MSG_RESULT([$USE_PSTACK])
# Check for gtty if termio.h doesn't exists # Check for gtty if termio.h doesn't exists
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no" if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
then then
...@@ -3004,9 +2964,6 @@ AC_SUBST([RDTSC_SPARC_ASSEMBLY]) ...@@ -3004,9 +2964,6 @@ AC_SUBST([RDTSC_SPARC_ASSEMBLY])
# Output results # Output results
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if test -d "$srcdir/pstack" ; then
AC_CONFIG_FILES(pstack/Makefile pstack/aout/Makefile)
fi
if test -d "$srcdir/cmd-line-utils/readline" ; then if test -d "$srcdir/cmd-line-utils/readline" ; then
AC_CONFIG_FILES(cmd-line-utils/readline/Makefile) AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
fi fi
......
...@@ -496,6 +496,7 @@ int DbugParse(CODE_STATE *cs, const char *control) ...@@ -496,6 +496,7 @@ int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-'; rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next))) if ((!rel || (!stack->out_file && !stack->next)))
{ {
/* Free memory associated with the state before resetting its members */
FreeState(cs, stack, 0); FreeState(cs, stack, 0);
stack->flags= 0; stack->flags= 0;
stack->delay= 0; stack->delay= 0;
...@@ -1608,7 +1609,7 @@ static void PushState(CODE_STATE *cs) ...@@ -1608,7 +1609,7 @@ static void PushState(CODE_STATE *cs)
struct settings *new_malloc; struct settings *new_malloc;
new_malloc= (struct settings *) DbugMalloc(sizeof(struct settings)); new_malloc= (struct settings *) DbugMalloc(sizeof(struct settings));
bzero(new_malloc, sizeof(*new_malloc)); bzero(new_malloc, sizeof(struct settings));
new_malloc->next= cs->stack; new_malloc->next= cs->stack;
cs->stack= new_malloc; cs->stack= new_malloc;
} }
...@@ -2088,7 +2089,7 @@ static FILE *OpenProfile(CODE_STATE *cs, const char *name) ...@@ -2088,7 +2089,7 @@ static FILE *OpenProfile(CODE_STATE *cs, const char *name)
static void DBUGCloseFile(CODE_STATE *cs, FILE *fp) static void DBUGCloseFile(CODE_STATE *cs, FILE *fp)
{ {
if (fp && fp != stderr && fp != stdout && fclose(fp) == EOF) if (fp != NULL && fp != stderr && fp != stdout && fclose(fp) == EOF)
{ {
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
(void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process); (void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
......
...@@ -1474,7 +1474,6 @@ static inline double rint(double x) ...@@ -1474,7 +1474,6 @@ static inline double rint(double x)
/* Things we don't need in the embedded version of MySQL */ /* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_OPENSSL #undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */ #undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
......
...@@ -48,19 +48,30 @@ typedef struct st_pthread_link { ...@@ -48,19 +48,30 @@ typedef struct st_pthread_link {
struct st_pthread_link *next; struct st_pthread_link *next;
} pthread_link; } pthread_link;
typedef struct { /**
Implementation of Windows condition variables.
We use native conditions on Vista and later, and fallback to own
implementation on earlier OS version.
*/
typedef union
{
/* Native condition (used on Vista and later) */
CONDITION_VARIABLE native_cond;
/* Own implementation (used on XP) */
struct
{
uint32 waiting; uint32 waiting;
CRITICAL_SECTION lock_waiting; CRITICAL_SECTION lock_waiting;
enum
enum { {
SIGNAL= 0, SIGNAL= 0,
BROADCAST= 1, BROADCAST= 1,
MAX_EVENTS= 2 MAX_EVENTS= 2
} EVENTS; } EVENTS;
HANDLE events[MAX_EVENTS]; HANDLE events[MAX_EVENTS];
HANDLE broadcast_block_event; HANDLE broadcast_block_event;
};
} pthread_cond_t; } pthread_cond_t;
...@@ -679,6 +690,47 @@ extern int rw_pr_destroy(rw_pr_lock_t *); ...@@ -679,6 +690,47 @@ extern int rw_pr_destroy(rw_pr_lock_t *);
#ifdef NEED_MY_RW_LOCK #ifdef NEED_MY_RW_LOCK
#ifdef _WIN32
/**
Implementation of Windows rwlock.
We use native (slim) rwlocks on Win7 and later, and fallback to portable
implementation on earlier Windows.
slim rwlock are also available on Vista/WS2008, but we do not use it
("trylock" APIs are missing on Vista)
*/
typedef union
{
/* Native rwlock (is_srwlock == TRUE) */
struct
{
SRWLOCK srwlock; /* native reader writer lock */
BOOL have_exclusive_srwlock; /* used for unlock */
};
/*
Portable implementation (is_srwlock == FALSE)
Fields are identical with Unix my_rw_lock_t fields.
*/
struct
{
pthread_mutex_t lock; /* lock for structure */
pthread_cond_t readers; /* waiting readers */
pthread_cond_t writers; /* waiting writers */
int state; /* -1:writer,0:free,>0:readers */
int waiters; /* number of waiting writers */
#ifdef SAFE_MUTEX
pthread_t write_thread;
#endif
};
} my_rw_lock_t;
#else /* _WIN32 */
/* /*
On systems which don't support native read/write locks we have On systems which don't support native read/write locks we have
to use own implementation. to use own implementation.
...@@ -694,6 +746,8 @@ typedef struct st_my_rw_lock_t { ...@@ -694,6 +746,8 @@ typedef struct st_my_rw_lock_t {
#endif #endif
} my_rw_lock_t; } my_rw_lock_t;
#endif /*! _WIN32 */
extern int my_rw_init(my_rw_lock_t *); extern int my_rw_init(my_rw_lock_t *);
extern int my_rw_destroy(my_rw_lock_t *); extern int my_rw_destroy(my_rw_lock_t *);
extern int my_rw_rdlock(my_rw_lock_t *); extern int my_rw_rdlock(my_rw_lock_t *);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
/* Things we don't need in the embedded version of MySQL */ /* Things we don't need in the embedded version of MySQL */
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_SMEM /* No shared memory */ #undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
......
...@@ -24,8 +24,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes ...@@ -24,8 +24,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout
rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029 rpl.rpl_innodb_bug28430* # Bug#46029
......
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb main.variables-big rpl_ndb.rpl_truncate_7ndb_2
...@@ -7,15 +7,27 @@ ...@@ -7,15 +7,27 @@
# force lower-case-table-names=1 (linux/macosx have different defaults) # force lower-case-table-names=1 (linux/macosx have different defaults)
# force symbolic-links=0 (valgrind build has a different default) # force symbolic-links=0 (valgrind build has a different default)
# #
exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1; exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1;
# The inline perl code below will copy $MYSQL_TMP_DIR/mysqld--help.txt
# to output, but filter away some variable stuff (e.g. paths).
perl; perl;
# Variables which we don't want to display in the result file since
# their paths may vary:
@skipvars=qw/basedir open-files-limit general-log-file log plugin-dir @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
log-slow-queries pid-file slow-query-log-file log-slow-queries pid-file slow-query-log-file
datadir slave-load-tmpdir tmpdir/; datadir slave-load-tmpdir tmpdir socket/;
# Plugins which may or may not be there:
@plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
thread-concurrency super-large-pages mutex-deadlock-detector null-audit/; thread-concurrency super-large-pages mutex-deadlock-detector null-audit/;
@env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /;
# And substitute the content some environment variables with their
# names:
@env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/;
$re1=join('|', @skipvars, @plugins); $re1=join('|', @skipvars, @plugins);
$re2=join('|', @plugins); $re2=join('|', @plugins);
$skip=0; $skip=0;
......
...@@ -229,7 +229,8 @@ sub mtr_report_stats ($$;$) { ...@@ -229,7 +229,8 @@ sub mtr_report_stats ($$;$) {
# Find out how we where doing # Find out how we where doing
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
my $tot_skiped= 0; my $tot_skipped= 0;
my $tot_skipdetect= 0;
my $tot_passed= 0; my $tot_passed= 0;
my $tot_failed= 0; my $tot_failed= 0;
my $tot_tests= 0; my $tot_tests= 0;
...@@ -246,8 +247,9 @@ sub mtr_report_stats ($$;$) { ...@@ -246,8 +247,9 @@ sub mtr_report_stats ($$;$) {
} }
elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' ) elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
{ {
# Test was skipped # Test was skipped (disabled not counted)
$tot_skiped++; $tot_skipped++ unless $tinfo->{'disable'};
$tot_skipdetect++ if $tinfo->{'skip_detected_by_test'};
} }
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' ) elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
{ {
...@@ -376,6 +378,9 @@ sub mtr_report_stats ($$;$) { ...@@ -376,6 +378,9 @@ sub mtr_report_stats ($$;$) {
print "All $tot_tests tests were successful.\n\n"; print "All $tot_tests tests were successful.\n\n";
} }
print "$tot_skipped tests were skipped, ".
"$tot_skipdetect by the test itself.\n\n" if $tot_skipped;
if ( $tot_failed != 0 || $found_problems) if ( $tot_failed != 0 || $found_problems)
{ {
mtr_error("there were failing test cases") unless $dont_error; mtr_error("there were failing test cases") unless $dont_error;
......
...@@ -126,13 +126,25 @@ my $path_vardir_trace; # unix formatted opt_vardir for trace files ...@@ -126,13 +126,25 @@ my $path_vardir_trace; # unix formatted opt_vardir for trace files
my $opt_tmpdir; # Path to use for tmp/ dir my $opt_tmpdir; # Path to use for tmp/ dir
my $opt_tmpdir_pid; my $opt_tmpdir_pid;
my $opt_start;
my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
END { END {
if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ ) if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ )
{
if (!$opt_start_exit)
{ {
# Remove the tempdir this process has created # Remove the tempdir this process has created
mtr_verbose("Removing tmpdir '$opt_tmpdir"); mtr_verbose("Removing tmpdir $opt_tmpdir");
rmtree($opt_tmpdir); rmtree($opt_tmpdir);
} }
else
{
mtr_warning("tmpdir $opt_tmpdir should be removed after the server has finished");
}
}
} }
sub env_or_val($$) { defined $ENV{$_[0]} ? $ENV{$_[0]} : $_[1] } sub env_or_val($$) { defined $ENV{$_[0]} ? $ENV{$_[0]} : $_[1] }
...@@ -234,10 +246,6 @@ my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds ...@@ -234,10 +246,6 @@ my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds
sub suite_timeout { return $opt_suite_timeout * 60; }; sub suite_timeout { return $opt_suite_timeout * 60; };
sub check_timeout { return $opt_testcase_timeout * 6; }; sub check_timeout { return $opt_testcase_timeout * 6; };
my $opt_start;
my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
my $opt_wait_all; my $opt_wait_all;
my $opt_user_args; my $opt_user_args;
my $opt_repeat= 1; my $opt_repeat= 1;
...@@ -2186,6 +2194,11 @@ sub environment_setup { ...@@ -2186,6 +2194,11 @@ sub environment_setup {
# to detect that valgrind is being used from test cases # to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind; $ENV{'VALGRIND_TEST'}= $opt_valgrind;
# Add dir of this perl to aid mysqltest in finding perl
my $perldir= dirname($^X);
my $pathsep= ":";
$pathsep= ";" if IS_WINDOWS && ! IS_CYGWIN;
$ENV{'PATH'}= "$ENV{'PATH'}".$pathsep.$perldir;
} }
...@@ -3658,6 +3671,9 @@ sub run_testcase ($) { ...@@ -3658,6 +3671,9 @@ sub run_testcase ($) {
# Try to get reason from test log file # Try to get reason from test log file
find_testcase_skipped_reason($tinfo); find_testcase_skipped_reason($tinfo);
mtr_report_test_skipped($tinfo); mtr_report_test_skipped($tinfo);
# Restart if skipped due to missing perl, it may have had side effects
stop_all_servers($opt_shutdown_timeout)
if ($tinfo->{'comment'} =~ /^perl not found/);
} }
elsif ( $res == 65 ) elsif ( $res == 65 )
{ {
......
...@@ -913,7 +913,6 @@ slave-transaction-retries 10 ...@@ -913,7 +913,6 @@ slave-transaction-retries 10
slave-type-conversions slave-type-conversions
slow-launch-time 2 slow-launch-time 2
slow-query-log FALSE slow-query-log FALSE
socket /tmp/mysql.sock
sort-buffer-size 2097152 sort-buffer-size 2097152
sporadic-binlog-dump-fail FALSE sporadic-binlog-dump-fail FALSE
sql-mode sql-mode
......
...@@ -109,20 +109,13 @@ Database: information_schema ...@@ -109,20 +109,13 @@ Database: information_schema
| TRIGGERS | | TRIGGERS |
| USER_PRIVILEGES | | USER_PRIVILEGES |
| VIEWS | | VIEWS |
| INNODB_SYS_FIELDS | | INNODB_CMP_RESET |
| INNODB_TRX | | INNODB_TRX |
| INNODB_SYS_INDEXES | | INNODB_CMPMEM_RESET |
| INNODB_LOCK_WAITS | | INNODB_LOCK_WAITS |
| INNODB_SYS_TABLESTATS | | INNODB_CMPMEM |
| INNODB_CMP | | INNODB_CMP |
| INNODB_SYS_COLUMNS |
| INNODB_CMP_RESET |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_LOCKS | | INNODB_LOCKS |
| INNODB_CMPMEM_RESET |
| INNODB_CMPMEM |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_TABLES |
+---------------------------------------+ +---------------------------------------+
Database: INFORMATION_SCHEMA Database: INFORMATION_SCHEMA
+---------------------------------------+ +---------------------------------------+
...@@ -158,20 +151,13 @@ Database: INFORMATION_SCHEMA ...@@ -158,20 +151,13 @@ Database: INFORMATION_SCHEMA
| TRIGGERS | | TRIGGERS |
| USER_PRIVILEGES | | USER_PRIVILEGES |
| VIEWS | | VIEWS |
| INNODB_SYS_FIELDS | | INNODB_CMP_RESET |
| INNODB_TRX | | INNODB_TRX |
| INNODB_SYS_INDEXES | | INNODB_CMPMEM_RESET |
| INNODB_LOCK_WAITS | | INNODB_LOCK_WAITS |
| INNODB_SYS_TABLESTATS | | INNODB_CMPMEM |
| INNODB_CMP | | INNODB_CMP |
| INNODB_SYS_COLUMNS |
| INNODB_CMP_RESET |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_LOCKS | | INNODB_LOCKS |
| INNODB_CMPMEM_RESET |
| INNODB_CMPMEM |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_TABLES |
+---------------------------------------+ +---------------------------------------+
Wildcard: inf_rmation_schema Wildcard: inf_rmation_schema
+--------------------+ +--------------------+
......
...@@ -177,6 +177,9 @@ mysqltest: At line 1: End of line junk detected: "disconnect default # comment ...@@ -177,6 +177,9 @@ mysqltest: At line 1: End of line junk detected: "disconnect default # comment
" "
mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Spurious text after `query` expression
mysqltest: At line 1: Spurious text after `query` expression
mysqltest: At line 2: Spurious text after `query` expression
mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: The sqlstate definition must start with an uppercase S mysqltest: At line 1: The sqlstate definition must start with an uppercase S
...@@ -366,23 +369,24 @@ mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_s ...@@ -366,23 +369,24 @@ mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_s
mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to sleep "abc"
mysqltest: At line 1: Invalid argument to real_sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc"
1 1
2
101 101
hej -99
1
mysqltest: At line 1: Missing argument to inc mysqltest: At line 1: Missing argument to inc
mysqltest: At line 1: The argument to inc must be a variable (start with $) mysqltest: At line 1: The argument to inc must be a variable (start with $)
mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: End of line junk detected: "1000"
4 mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
4 mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
-96
-96
-1 -1
-2
99 99
hej
-1
mysqltest: At line 1: Missing argument to dec mysqltest: At line 1: Missing argument to dec
mysqltest: At line 1: The argument to dec must be a variable (start with $) mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
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: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do!
system command 'NonExistsinfComamdn 2> /dev/null' failed system command 'NonExistsinfComamdn 2> /dev/null' failed
...@@ -449,12 +453,16 @@ mysqltest: At line 1: Missing required argument 'host' to command 'connect' ...@@ -449,12 +453,16 @@ mysqltest: At line 1: Missing required argument 'host' to command 'connect'
mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db' mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP mysqltest: At line 1: Illegal option to connect: SMTP
OK 200 connects succeeded
mysqltest: The test didn't produce any output
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
show tables; show tables;
ERROR 3D000: No database selected ERROR 3D000: No database selected
connect con1,localhost,root,,;
connection default;
connection con1;
disconnect con1;
connection default;
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
......
drop table if exists t1, t2; drop table if exists t1, t2;
# #
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
(id INT NOT NULL PRIMARY KEY,
name VARCHAR(16) NOT NULL,
year YEAR,
INDEX name (name(8))
)
PARTITION BY HASH(id) PARTITIONS 2;
INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
CREATE TABLE t2 (id INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
DROP TABLE t1, t2;
#
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -551,12 +566,12 @@ create table t1 (a bigint) ...@@ -551,12 +566,12 @@ create table t1 (a bigint)
partition by range (a) partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF), (partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10)); partition p1 values less than (10));
ERROR HY000: VALUES value must be of same type as partition function ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint) create table t1 (a bigint)
partition by list (a) partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF), (partition p0 values in (0xFFFFFFFFFFFFFFFF),
partition p1 values in (10)); partition p1 values in (10));
ERROR HY000: VALUES value must be of same type as partition function ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint unsigned) create table t1 (a bigint unsigned)
partition by range (a) partition by range (a)
(partition p0 values less than (100), (partition p0 values less than (100),
......
drop table if exists t1; drop table if exists t1, t2;
#
# Bug#50036: Inconsistent errors when using TIMESTAMP
# columns/expressions
# 1. correct and appropriate errors in light of
# the fix for BUG#42849:
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t2 (c TIMESTAMP);
ALTER TABLE t2
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
DROP TABLE t2;
# 2. These errors where questionable before the fix:
# VALUES clause are checked first, clearified the error message.
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: VALUES value for partition 'p0' must have type INT
# TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: VALUES value for partition 'p0' must have type INT
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t1;
# Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY HASH (c) PARTITIONS 4;
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
SELECT * FROM t1;
a
2000-01-02 03:04:05
FLUSH TABLES;
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
# Disable warnings, since the result would differ when running with
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
SELECT * FROM t1;
a
2000-01-02 03:04:05
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
PARTITIONS 3 */
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
DROP TABLE t1;
# #
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes) # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
# #
...@@ -497,7 +618,7 @@ partition by range (a) ...@@ -497,7 +618,7 @@ partition by range (a)
partitions 2 partitions 2
(partition x1 values less than (4.0) tablespace ts1, (partition x1 values less than (4.0) tablespace ts1,
partition x2 values less than (8) tablespace ts2); partition x2 values less than (8) tablespace ts2);
ERROR HY000: VALUES value must be of same type as partition function ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -736,7 +857,7 @@ partition by list (a) ...@@ -736,7 +857,7 @@ partition by list (a)
partitions 2 partitions 2
(partition x1 values in (4.0, 12+8), (partition x1 values in (4.0, 12+8),
partition x2 values in (3, 21)); partition x2 values in (3, 21));
ERROR HY000: VALUES value must be of same type as partition function ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -796,12 +917,12 @@ CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) ...@@ -796,12 +917,12 @@ CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) ( PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819), PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE); PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
ALTER TABLE old ALTER TABLE old
PARTITION BY RANGE (a) ( PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819), PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE); PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a+0) ( PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819), PARTITION p VALUES LESS THAN (20080819),
...@@ -1075,4 +1196,14 @@ PARTITION p VALUES LESS THAN (1219089600), ...@@ -1075,4 +1196,14 @@ PARTITION p VALUES LESS THAN (1219089600),
PARTITION pmax VALUES LESS THAN MAXVALUE); PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE old; DROP TABLE old;
#
# Bug #56709: Memory leaks at running the 5.1 test suite
#
CREATE TABLE t1 (a TIMESTAMP NOT NULL PRIMARY KEY);
ALTER TABLE t1
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -31,6 +31,19 @@ SELECT @@global.debug; ...@@ -31,6 +31,19 @@ SELECT @@global.debug;
@@global.debug @@global.debug
SET GLOBAL debug=@old_debug; SET GLOBAL debug=@old_debug;
#
# Bug #56709: Memory leaks at running the 5.1 test suite
#
SET @old_local_debug = @@debug;
SET @@debug='d,foo';
SELECT @@debug;
@@debug
d,foo
SET @@debug='';
SELECT @@debug;
@@debug
SET @@debug = @old_local_debug;
End of 5.1 tests End of 5.1 tests
# #
# Bug#46165 server crash in dbug # Bug#46165 server crash in dbug
......
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
TABLE_ID NAME FLAG N_COLS SPACE
11 SYS_FOREIGN 0 7 0
12 SYS_FOREIGN_COLS 0 7 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE
11 ID_IND 11 3 1 302 0
12 FOR_IND 11 0 1 303 0
13 REF_IND 11 0 1 304 0
14 ID_IND 12 3 2 305 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
TABLE_ID NAME POS MTYPE PRTYPE LEN
11 ID 0 1 524292 0
11 FOR_NAME 1 1 524292 0
11 REF_NAME 2 1 524292 0
11 N_COLS 3 6 0 4
12 ID 0 1 524292 0
12 POS 1 6 0 4
12 FOR_COL_NAME 2 1 524292 0
12 REF_COL_NAME 3 1 524292 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
INDEX_ID NAME POS
11 ID 0
12 FOR_NAME 0
13 REF_NAME 0
14 ID 0
14 POS 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC MYSQL_HANDLES_OPENED
11 SYS_FOREIGN Uninitialized 0 0 0 0 0 0
12 SYS_FOREIGN_COLS Uninitialized 0 0 0 0 0 0
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 1 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test parent_id id 0
INSERT INTO parent VALUES(1);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows mysql_handles_opened
test/parent 1 1
SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
NAME FLAG N_COLS SPACE
SYS_FOREIGN 0 7 0
SYS_FOREIGN_COLS 0 7 0
test/child 1 5 0
test/parent 1 4 0
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
name n_fields
PRIMARY 1
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name n_fields
GEN_CLUST_INDEX 0
par_ind 1
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name pos mtype len
id 0 6 4
parent_id 1 6 4
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 2 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test id id 0
test/constraint_test parent_id newid 1
INSERT INTO parent VALUES(1, 9);
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
id newid
1 9
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows mysql_handles_opened
test/parent 1 2
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE bug56716 (a INT PRIMARY KEY,b INT,c INT,INDEX(b)) ENGINE=InnoDB;
SELECT * FROM bug56716 WHERE b<=42 ORDER BY b DESC FOR UPDATE;
a b c
DROP TABLE bug56716;
--default-storage-engine=MyISAM
--innodb-strict-mode=0
--innodb-file-per-table=0
# This is the test for Information Schema System Table View
# that displays the InnoDB system table content through
# information schema tables.
--source include/have_innodb.inc
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
# Create a foreign key constraint, and verify the information
# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and
# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
# Insert a row in the table "parent", and see whether that reflected in
# INNODB_SYS_TABLESTATS
INSERT INTO parent VALUES(1);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
DROP TABLE child;
DROP TABLE parent;
# Create table with 2 columns in the foreign key constraint
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
INSERT INTO parent VALUES(1, 9);
# Nested query will open the table handle twice
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
DROP TABLE child;
DROP TABLE parent;
#
# Bug #56716 InnoDB locks a record gap without locking the table
#
-- source include/have_innodb.inc
CREATE TABLE bug56716 (a INT PRIMARY KEY,b INT,c INT,INDEX(b)) ENGINE=InnoDB;
SELECT * FROM bug56716 WHERE b<=42 ORDER BY b DESC FOR UPDATE;
DROP TABLE bug56716;
...@@ -26,10 +26,12 @@ if ($do_file_tests) ...@@ -26,10 +26,12 @@ if ($do_file_tests)
{ {
let $ls_file= $MYSQLD_DATADIR/test/tmp2; let $ls_file= $MYSQLD_DATADIR/test/tmp2;
# List the files belonging to the table t1 # List the files belonging to the table t1
--replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
--list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
--chmod 0644 $ls_file --chmod 0644 $ls_file
if ($with_directories) if ($with_directories)
{ {
--replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1* --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
} }
eval SET @aux = load_file('$ls_file'); eval SET @aux = load_file('$ls_file');
...@@ -60,16 +62,15 @@ if ($found_garbage) ...@@ -60,16 +62,15 @@ if ($found_garbage)
--echo # <alter partitioning> worked incomplete. --echo # <alter partitioning> worked incomplete.
--echo # We found: --echo # We found:
# Print the list of files into the protocol # Print the list of files into the protocol
eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR') eval SELECT file_list AS "unified filelist"
AS "unified filelist"
FROM t0_definition WHERE state = 'old'; FROM t0_definition WHERE state = 'old';
} }
# Do a manual cleanup, because the following tests should not suffer from # Do a manual cleanup, because the following tests should not suffer from
# remaining files # remaining files
--exec rm -f $MYSQLD_DATADIR/test/t1* || true --remove_files_wildcard $MYSQLD_DATADIR/test t1*
if ($with_directories) if ($with_directories)
{ {
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*
} }
} }
--enable_query_log --enable_query_log
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
--eval $create_statement --eval $create_statement
--eval $insert_statement --eval $insert_statement
--echo # State before crash --echo # State before crash
--replace_result #p# #P# --replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test --list_files $DATADIR/test
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--sorted_result --sorted_result
...@@ -14,13 +14,13 @@ SELECT * FROM t1; ...@@ -14,13 +14,13 @@ SELECT * FROM t1;
--error 2013 --error 2013
--eval $crash_statement --eval $crash_statement
--echo # State after crash (before recovery) --echo # State after crash (before recovery)
--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/ --replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/ /#sp#/#SP#/ /#tmp#/#TMP#/
--list_files $DATADIR/test --list_files $DATADIR/test
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect --enable_reconnect
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--echo # State after crash recovery --echo # State after crash recovery
--replace_result #p# #P# --replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test --list_files $DATADIR/test
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--sorted_result --sorted_result
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
--eval $create_statement --eval $create_statement
--eval $insert_statement --eval $insert_statement
--echo # State before failure --echo # State before failure
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test --list_files $DATADIR/test
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--sorted_result --sorted_result
...@@ -11,8 +12,29 @@ SELECT * FROM t1; ...@@ -11,8 +12,29 @@ SELECT * FROM t1;
--eval $fail_statement --eval $fail_statement
--enable_abort_on_error --enable_abort_on_error
--echo # State after failure --echo # State after failure
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test --list_files $DATADIR/test
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--sorted_result --sorted_result
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # Same test under LOCK TABLE
--eval $create_statement
--eval $insert_statement
--echo # State before failure
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
LOCK TABLE t1 WRITE;
--disable_abort_on_error
--eval $fail_statement
--enable_abort_on_error
--echo # State after failure
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
UNLOCK TABLES;
DROP TABLE t1;
...@@ -10,6 +10,6 @@ eval SHOW CREATE TABLE t1; ...@@ -10,6 +10,6 @@ eval SHOW CREATE TABLE t1;
if ($ls) if ($ls)
{ {
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test t1* --list_files $MYSQLD_DATADIR/test t1*
} }
...@@ -69,7 +69,7 @@ if ($do_file_tests) ...@@ -69,7 +69,7 @@ if ($do_file_tests)
if ($ls) if ($ls)
{ {
# Print the list of files into the protocol # Print the list of files into the protocol
replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR; replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# part_n part_N;
SELECT file_list AS "unified filelist" SELECT file_list AS "unified filelist"
FROM t0_definition WHERE state = 'old'; FROM t0_definition WHERE state = 'old';
} }
......
...@@ -65,7 +65,7 @@ let $run= `SELECT @aux`; ...@@ -65,7 +65,7 @@ let $run= `SELECT @aux`;
if ($run) if ($run)
{ {
--vertical_results --vertical_results
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP#
SELECT state, SELECT state,
REPLACE(create_command,'\n',' ') AS "Table definition", REPLACE(create_command,'\n',' ') AS "Table definition",
REPLACE(file_list ,'\n',' ') AS "File list" REPLACE(file_list ,'\n',' ') AS "File list"
......
call mtr.add_suppression("./test/t1_will_crash"); call mtr.add_suppression("t1_will_crash");
call mtr.add_suppression("Got an error from unknown thread"); call mtr.add_suppression("Got an error from unknown thread");
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
......
...@@ -238,11 +238,10 @@ LOCK TABLE t1 READ; ...@@ -238,11 +238,10 @@ LOCK TABLE t1 READ;
# Third attempt: says that the table does not exist # Third attempt: says that the table does not exist
ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Check table returns the same # Check table returns the same (not after fixing bug#56172!)
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check Error Lock wait timeout exceeded; try restarting transaction test.t1 check status OK
test.t1 check status Operation failed
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT ) CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
......
...@@ -214,7 +214,7 @@ SET lock_wait_timeout = 2; ...@@ -214,7 +214,7 @@ SET lock_wait_timeout = 2;
ALTER TABLE t1 COALESCE PARTITION 2; ALTER TABLE t1 COALESCE PARTITION 2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Connection 3 tries to load into the table: # Connection 3 tries to load into the table:
LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f); LOAD DATA INFILE 'load.in' INTO TABLE t1 (f);
# Connection 1 commits the transaction # Connection 1 commits the transaction
COMMIT; COMMIT;
# Connection 3... # Connection 3...
......
...@@ -28,6 +28,9 @@ let $do_long_tests= 1; ...@@ -28,6 +28,9 @@ let $do_long_tests= 1;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0; ...@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0; ...@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -45,6 +45,9 @@ let $only_part_1= 1; ...@@ -45,6 +45,9 @@ let $only_part_1= 1;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -45,6 +45,9 @@ let $only_part_2= 1; ...@@ -45,6 +45,9 @@ let $only_part_2= 1;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -45,6 +45,9 @@ let $only_part_2= 1; ...@@ -45,6 +45,9 @@ let $only_part_2= 1;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -43,6 +43,9 @@ let $more_pk_ui_tests= 0; ...@@ -43,6 +43,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning. # The server must support partitioning.
--source include/have_partition.inc --source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
...@@ -56,6 +56,7 @@ partition by range (a) ...@@ -56,6 +56,7 @@ partition by range (a)
insert into t1 values (1), (11), (21), (33); insert into t1 values (1), (11), (21), (33);
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
...@@ -78,6 +79,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO ...@@ -78,6 +79,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
disconnect con1; disconnect con1;
connection default; connection default;
--reap --reap
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
......
# test the auto-recover (--myisam-recover) of partitioned myisam tables # test the auto-recover (--myisam-recover) of partitioned myisam tables
call mtr.add_suppression("./test/t1_will_crash"); call mtr.add_suppression("t1_will_crash");
call mtr.add_suppression("Got an error from unknown thread"); call mtr.add_suppression("Got an error from unknown thread");
--source include/have_partition.inc --source include/have_partition.inc
......
...@@ -111,7 +111,7 @@ LOCK TABLE t1 READ; ...@@ -111,7 +111,7 @@ LOCK TABLE t1 READ;
--echo # Third attempt: says that the table does not exist --echo # Third attempt: says that the table does not exist
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
--echo # Check table returns the same --echo # Check table returns the same (not after fixing bug#56172!)
CHECK TABLE t1; CHECK TABLE t1;
--connection con1 --connection con1
......
...@@ -62,13 +62,14 @@ ALTER TABLE t1 COALESCE PARTITION 2; ...@@ -62,13 +62,14 @@ ALTER TABLE t1 COALESCE PARTITION 2;
--connect (con3,localhost,root,,) --connect (con3,localhost,root,,)
perl; --let $MYSQLD_DATADIR= `SELECT @@datadir`
open( LD, ">" . "/tmp/load.in" ) || die "Could not open file for writing " . $ENV{'MYSQLTEST_DATADIR'} . "/test/load.in"; --write_file $MYSQLD_DATADIR/test/load.in
print LD "1\n2\n3\n"; 1
close( LD ); 2
3
EOF EOF
--echo # Connection 3 tries to load into the table: --echo # Connection 3 tries to load into the table:
send LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f); send LOAD DATA INFILE 'load.in' INTO TABLE t1 (f);
--connection default --connection default
--real_sleep 1 --real_sleep 1
......
...@@ -205,7 +205,7 @@ DROP TABLE `t1`; ...@@ -205,7 +205,7 @@ DROP TABLE `t1`;
-- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. -- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
-- let $MYSQLD_DATADIR= `SELECT @@datadir`; -- let $MYSQLD_DATADIR= `SELECT @@datadir`
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog -- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog -- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
...@@ -330,7 +330,7 @@ while($ntables) ...@@ -330,7 +330,7 @@ while($ntables)
-- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to -- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to
-- echo ### detect failure. Before the patch mysqlbinlog would find -- echo ### detect failure. Before the patch mysqlbinlog would find
-- echo ### a corrupted event, thence would fail. -- echo ### a corrupted event, thence would fail.
-- let $MYSQLD_DATADIR= `SELECT @@datadir`; -- let $MYSQLD_DATADIR= `SELECT @@datadir`
-- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog -- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
## clean up ## clean up
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# # # #
################################################################################ ################################################################################
let $save_div_precision_increment = `SELECT @@global.div_precision_increment` let $save_div_precision_increment = `SELECT @@global.div_precision_increment`;
#SET @save_div_precision_increment = @@global.div_precision_increment; #SET @save_div_precision_increment = @@global.div_precision_increment;
......
...@@ -9,7 +9,7 @@ SHOW VARIABLES LIKE 'secure_file_priv'; ...@@ -9,7 +9,7 @@ SHOW VARIABLES LIKE 'secure_file_priv';
# Doing this in a portable manner is difficult but we should be able to # Doing this in a portable manner is difficult but we should be able to
# count on the depth of the directory hierarchy used. Three steps up from # count on the depth of the directory hierarchy used. Three steps up from
# the datadir is the 'mysql_test' directory. # the datadir is the 'mysql_test' directory.
--let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`; --let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`
--eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE'; --eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE';
DELETE FROM t1; DELETE FROM t1;
--eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1; --eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1;
......
...@@ -494,6 +494,32 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; ...@@ -494,6 +494,32 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--error 1 --error 1
--exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1 --exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1
#
# Extra text after ``
#
# Cannot use exec echo here as ` may or may not need to be escaped
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
let $x= `select 1` BOO ;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
--let $x= `select 1`;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
# Missing ; in next line should be detected and cause failure
let $x= `select 1`
let $x= 2;
echo $x;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Allow trailing # comment # Allow trailing # comment
--sleep 1 # Wait for insert delayed to be executed. --sleep 1 # Wait for insert delayed to be executed.
...@@ -980,16 +1006,13 @@ EOF ...@@ -980,16 +1006,13 @@ EOF
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test inc # Test inc
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
inc $i; let $i= 0;
echo $i;
inc $i; inc $i;
echo $i; echo $i;
let $i=100; let $i=100;
inc $i; inc $i;
echo $i; echo $i;
let $i= -100;
let $i=hej;
echo $i;
inc $i; inc $i;
echo $i; echo $i;
...@@ -998,7 +1021,13 @@ echo $i; ...@@ -998,7 +1021,13 @@ echo $i;
--error 1 --error 1
--exec echo "inc i;" | $MYSQL_TEST 2>&1 --exec echo "inc i;" | $MYSQL_TEST 2>&1
--error 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 --exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=text; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=10cc; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1
inc $i; inc $i; inc $i; --echo $i inc $i; inc $i; inc $i; --echo $i
echo $i; echo $i;
...@@ -1008,25 +1037,25 @@ echo $i; ...@@ -1008,25 +1037,25 @@ echo $i;
# Test dec # Test dec
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
dec $d; let $d= 0;
echo $d;
dec $d; dec $d;
echo $d; echo $d;
let $d=100; let $d=100;
dec $d; dec $d;
echo $d; echo $d;
let $d=hej;
echo $d;
dec $d;
echo $d;
--error 1 --error 1
--exec echo "dec;" | $MYSQL_TEST 2>&1 --exec echo "dec;" | $MYSQL_TEST 2>&1
--error 1 --error 1
--exec echo "dec i;" | $MYSQL_TEST 2>&1 --exec echo "dec i;" | $MYSQL_TEST 2>&1
--error 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 --exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=text; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=10cc; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -1439,19 +1468,6 @@ eval select "$long_rep" as x; ...@@ -1439,19 +1468,6 @@ eval select "$long_rep" as x;
--error 1 --error 1
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1 --exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
let $i=100;
while ($i)
{
connect (test_con1,localhost,root,,);
disconnect test_con1;
dec $i;
}
EOF
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Repeat connect/disconnect # Repeat connect/disconnect
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
let $i=200; let $i=200;
...@@ -1461,9 +1477,8 @@ while ($i) ...@@ -1461,9 +1477,8 @@ while ($i)
disconnect test_con1; disconnect test_con1;
dec $i; dec $i;
} }
echo 200 connects succeeded;
EOF EOF
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
...@@ -1504,6 +1519,22 @@ show tables; ...@@ -1504,6 +1519,22 @@ show tables;
disconnect con2; disconnect con2;
connection default; connection default;
# Test enable_connect_log
--enable_connect_log
connect (con1,localhost,root,,);
connection default;
connection con1;
--disable_query_log
# These should not be logged
connect (con2,localhost,root,,*NO-ONE*);
connection con2;
disconnect con2;
connection con1;
--enable_query_log
disconnect con1;
connection default;
--disable_connect_log
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test mysqltest arguments # Test mysqltest arguments
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -14,6 +14,28 @@ ...@@ -14,6 +14,28 @@
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
--echo #
--echo # Bug#57113: ha_partition::extra(ha_extra_function):
--echo # Assertion `m_extra_cache' failed
CREATE TABLE t1
(id INT NOT NULL PRIMARY KEY,
name VARCHAR(16) NOT NULL,
year YEAR,
INDEX name (name(8))
)
PARTITION BY HASH(id) PARTITIONS 2;
INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
CREATE TABLE t2 (id INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
DROP TABLE t1, t2;
--echo # --echo #
--echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update --echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
--echo # --echo #
...@@ -458,12 +480,12 @@ drop table t1; ...@@ -458,12 +480,12 @@ drop table t1;
# #
# BUG 16002: Handle unsigned integer functions properly # BUG 16002: Handle unsigned integer functions properly
# #
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR --error ER_VALUES_IS_NOT_INT_TYPE_ERROR
create table t1 (a bigint) create table t1 (a bigint)
partition by range (a) partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF), (partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10)); partition p1 values less than (10));
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR --error ER_VALUES_IS_NOT_INT_TYPE_ERROR
create table t1 (a bigint) create table t1 (a bigint)
partition by list (a) partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF), (partition p0 values in (0xFFFFFFFFFFFFFFFF),
......
...@@ -8,10 +8,8 @@ DROP TABLE IF EXISTS t1; ...@@ -8,10 +8,8 @@ DROP TABLE IF EXISTS t1;
--echo # --echo #
--echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into --echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
--echo # partitioned MyISAM table --echo # partitioned MyISAM table
perl; --write_file init_file.txt
open( INIT, ">init_file.txt"); abcd
print INIT "abcd\n";
close( INIT );
EOF EOF
CREATE TABLE t1 CREATE TABLE t1
......
...@@ -5,11 +5,108 @@ ...@@ -5,11 +5,108 @@
-- source include/have_partition.inc -- source include/have_partition.inc
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1, t2;
--enable_warnings --enable_warnings
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
--echo # columns/expressions
--echo # 1. correct and appropriate errors in light of
--echo # the fix for BUG#42849:
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
CREATE TABLE t2 (c TIMESTAMP);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t2
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t2;
--echo # 2. These errors where questionable before the fix:
--echo # VALUES clause are checked first, clearified the error message.
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--echo # TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t1;
--echo # Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY HASH (c) PARTITIONS 4;
--echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
--sorted_result
SELECT * FROM t1;
FLUSH TABLES;
--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier.
--remove_file $MYSQLD_DATADIR/test/t1.frm
--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm
--echo # Disable warnings, since the result would differ when running with
--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement).
--disable_warnings
--sorted_result
SELECT * FROM t1;
--enable_warnings
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
--sorted_result
SELECT * FROM t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--echo # --echo #
...@@ -536,7 +633,7 @@ partitions 2 ...@@ -536,7 +633,7 @@ partitions 2
# #
# Partition by range, inconsistent partition function and constants # Partition by range, inconsistent partition function and constants
# #
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR --error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -849,7 +946,7 @@ partitions 2 ...@@ -849,7 +946,7 @@ partitions 2
# #
# Partition by list, wrong constant result type (not INT) # Partition by list, wrong constant result type (not INT)
# #
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR --error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
...@@ -939,13 +1036,13 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); ...@@ -939,13 +1036,13 @@ PARTITION pmax VALUES LESS THAN MAXVALUE);
# Check that allowed arithmetic/math functions involving TIMESTAMP values result # Check that allowed arithmetic/math functions involving TIMESTAMP values result
# in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function # in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR --error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) ( PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819), PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE); PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR --error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
ALTER TABLE old ALTER TABLE old
PARTITION BY RANGE (a) ( PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819), PARTITION p VALUES LESS THAN (20080819),
...@@ -1284,4 +1381,18 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); ...@@ -1284,4 +1381,18 @@ PARTITION pmax VALUES LESS THAN MAXVALUE);
DROP TABLE old; DROP TABLE old;
--echo #
--echo # Bug #56709: Memory leaks at running the 5.1 test suite
--echo #
CREATE TABLE t1 (a TIMESTAMP NOT NULL PRIMARY KEY);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t1
PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
PARTITION p VALUES LESS THAN (18),
PARTITION pmax VALUES LESS THAN MAXVALUE);
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -35,6 +35,19 @@ SELECT @@global.debug; ...@@ -35,6 +35,19 @@ SELECT @@global.debug;
SET GLOBAL debug=@old_debug; SET GLOBAL debug=@old_debug;
--echo #
--echo # Bug #56709: Memory leaks at running the 5.1 test suite
--echo #
SET @old_local_debug = @@debug;
SET @@debug='d,foo';
SELECT @@debug;
SET @@debug='';
SELECT @@debug;
SET @@debug = @old_local_debug;
--echo End of 5.1 tests --echo End of 5.1 tests
......
...@@ -24,7 +24,108 @@ ...@@ -24,7 +24,108 @@
#include <process.h> #include <process.h>
#include <sys/timeb.h> #include <sys/timeb.h>
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
/*
Windows native condition variables. We use runtime loading / function
pointers, because they are not available on XP
*/
/* Prototypes and function pointers for condition variable functions */
typedef VOID (WINAPI * InitializeConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
typedef BOOL (WINAPI * SleepConditionVariableCSProc)
(PCONDITION_VARIABLE ConditionVariable,
PCRITICAL_SECTION CriticalSection,
DWORD dwMilliseconds);
typedef VOID (WINAPI * WakeAllConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
typedef VOID (WINAPI * WakeConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
static InitializeConditionVariableProc my_InitializeConditionVariable;
static SleepConditionVariableCSProc my_SleepConditionVariableCS;
static WakeAllConditionVariableProc my_WakeAllConditionVariable;
static WakeConditionVariableProc my_WakeConditionVariable;
/**
Indicates if we have native condition variables,
initialized first time pthread_cond_init is called.
*/
static BOOL have_native_conditions= FALSE;
/**
Check if native conditions can be used, load function pointers
*/
static void check_native_cond_availability(void)
{
HMODULE module= GetModuleHandle("kernel32");
my_InitializeConditionVariable= (InitializeConditionVariableProc)
GetProcAddress(module, "InitializeConditionVariable");
my_SleepConditionVariableCS= (SleepConditionVariableCSProc)
GetProcAddress(module, "SleepConditionVariableCS");
my_WakeAllConditionVariable= (WakeAllConditionVariableProc)
GetProcAddress(module, "WakeAllConditionVariable");
my_WakeConditionVariable= (WakeConditionVariableProc)
GetProcAddress(module, "WakeConditionVariable");
if (my_InitializeConditionVariable)
have_native_conditions= TRUE;
}
/**
Convert abstime to milliseconds
*/
static DWORD get_milliseconds(const struct timespec *abstime)
{
long long millis;
union ft64 now;
if (abstime == NULL)
return INFINITE;
GetSystemTimeAsFileTime(&now.ft);
/*
Calculate time left to abstime
- subtract start time from current time(values are in 100ns units)
- convert to millisec by dividing with 10000
*/
millis= (abstime->tv.i64 - now.i64) / 10000;
/* Don't allow the timeout to be negative */
if (millis < 0)
return 0;
/*
Make sure the calculated timeout does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
if (millis > abstime->max_timeout_msec)
millis= abstime->max_timeout_msec;
if (millis > UINT_MAX)
millis= UINT_MAX;
return (DWORD)millis;
}
/*
Old (pre-vista) implementation using events
*/
static int legacy_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{ {
cond->waiting= 0; cond->waiting= 0;
InitializeCriticalSection(&cond->lock_waiting); InitializeCriticalSection(&cond->lock_waiting);
...@@ -53,7 +154,8 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) ...@@ -53,7 +154,8 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
return 0; return 0;
} }
int pthread_cond_destroy(pthread_cond_t *cond)
static int legacy_cond_destroy(pthread_cond_t *cond)
{ {
DeleteCriticalSection(&cond->lock_waiting); DeleteCriticalSection(&cond->lock_waiting);
...@@ -65,48 +167,13 @@ int pthread_cond_destroy(pthread_cond_t *cond) ...@@ -65,48 +167,13 @@ int pthread_cond_destroy(pthread_cond_t *cond)
} }
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) static int legacy_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
{
return pthread_cond_timedwait(cond,mutex,NULL);
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime) struct timespec *abstime)
{ {
int result; int result;
long timeout; DWORD timeout;
union ft64 now;
if( abstime != NULL )
{
GetSystemTimeAsFileTime(&now.ft);
/*
Calculate time left to abstime
- subtract start time from current time(values are in 100ns units)
- convert to millisec by dividing with 10000
*/
timeout= (long)((abstime->tv.i64 - now.i64) / 10000);
/* Don't allow the timeout to be negative */
if (timeout < 0)
timeout= 0L;
/*
Make sure the calucated timeout does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
if (timeout > abstime->max_timeout_msec)
timeout= abstime->max_timeout_msec;
}
else
{
/* No time specified; don't expire */
timeout= INFINITE;
}
timeout= get_milliseconds(abstime);
/* /*
Block access if previous broadcast hasn't finished. Block access if previous broadcast hasn't finished.
This is just for safety and should normally not This is just for safety and should normally not
...@@ -142,7 +209,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, ...@@ -142,7 +209,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
return result == WAIT_TIMEOUT ? ETIMEDOUT : 0; return result == WAIT_TIMEOUT ? ETIMEDOUT : 0;
} }
int pthread_cond_signal(pthread_cond_t *cond) static int legacy_cond_signal(pthread_cond_t *cond)
{ {
EnterCriticalSection(&cond->lock_waiting); EnterCriticalSection(&cond->lock_waiting);
...@@ -155,7 +222,7 @@ int pthread_cond_signal(pthread_cond_t *cond) ...@@ -155,7 +222,7 @@ int pthread_cond_signal(pthread_cond_t *cond)
} }
int pthread_cond_broadcast(pthread_cond_t *cond) static int legacy_cond_broadcast(pthread_cond_t *cond)
{ {
EnterCriticalSection(&cond->lock_waiting); EnterCriticalSection(&cond->lock_waiting);
/* /*
...@@ -177,6 +244,87 @@ int pthread_cond_broadcast(pthread_cond_t *cond) ...@@ -177,6 +244,87 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
} }
/*
Posix API functions. Just choose between native and legacy implementation.
*/
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
{
/*
Once initialization is used here rather than in my_init(), to
1) avoid my_init() pitfalls- undefined order in which initialization should
run
2) be potentially useful C++ (in static constructors that run before main())
3) just to simplify the API.
Also, the overhead of my_pthread_once is very small.
*/
static my_pthread_once_t once_control= MY_PTHREAD_ONCE_INIT;
my_pthread_once(&once_control, check_native_cond_availability);
if (have_native_conditions)
{
my_InitializeConditionVariable(&cond->native_cond);
return 0;
}
else
return legacy_cond_init(cond, attr);
}
int pthread_cond_destroy(pthread_cond_t *cond)
{
if (have_native_conditions)
return 0; /* no destroy function */
else
return legacy_cond_destroy(cond);
}
int pthread_cond_broadcast(pthread_cond_t *cond)
{
if (have_native_conditions)
{
my_WakeAllConditionVariable(&cond->native_cond);
return 0;
}
else
return legacy_cond_broadcast(cond);
}
int pthread_cond_signal(pthread_cond_t *cond)
{
if (have_native_conditions)
{
my_WakeConditionVariable(&cond->native_cond);
return 0;
}
else
return legacy_cond_signal(cond);
}
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
{
if (have_native_conditions)
{
DWORD timeout= get_milliseconds(abstime);
if (!my_SleepConditionVariableCS(&cond->native_cond, mutex, timeout))
return ETIMEDOUT;
return 0;
}
else
return legacy_cond_timedwait(cond, mutex, abstime);
}
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
return pthread_cond_timedwait(cond, mutex, NULL);
}
int pthread_attr_init(pthread_attr_t *connect_att) int pthread_attr_init(pthread_attr_t *connect_att)
{ {
connect_att->dwStackSize = 0; connect_att->dwStackSize = 0;
......
...@@ -155,8 +155,19 @@ int pthread_cancel(pthread_t thread) ...@@ -155,8 +155,19 @@ int pthread_cancel(pthread_t thread)
int my_pthread_once(my_pthread_once_t *once_control, int my_pthread_once(my_pthread_once_t *once_control,
void (*init_routine)(void)) void (*init_routine)(void))
{ {
LONG state= InterlockedCompareExchange(once_control, MY_PTHREAD_ONCE_INPROGRESS, LONG state;
/*
Do "dirty" read to find out if initialization is already done, to
save an interlocked operation in common case. Memory barriers are ensured by
Visual C++ volatile implementation.
*/
if (*once_control == MY_PTHREAD_ONCE_DONE)
return 0;
state= InterlockedCompareExchange(once_control, MY_PTHREAD_ONCE_INPROGRESS,
MY_PTHREAD_ONCE_INIT); MY_PTHREAD_ONCE_INIT);
switch(state) switch(state)
{ {
case MY_PTHREAD_ONCE_INIT: case MY_PTHREAD_ONCE_INIT:
......
...@@ -20,6 +20,119 @@ ...@@ -20,6 +20,119 @@
#if defined(NEED_MY_RW_LOCK) #if defined(NEED_MY_RW_LOCK)
#include <errno.h> #include <errno.h>
#ifdef _WIN32
static BOOL have_srwlock= FALSE;
/* Prototypes and function pointers for windows functions */
typedef VOID (WINAPI* srw_func) (PSRWLOCK SRWLock);
typedef BOOL (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
static srw_func my_InitializeSRWLock;
static srw_func my_AcquireSRWLockExclusive;
static srw_func my_ReleaseSRWLockExclusive;
static srw_func my_AcquireSRWLockShared;
static srw_func my_ReleaseSRWLockShared;
static srw_bool_func my_TryAcquireSRWLockExclusive;
static srw_bool_func my_TryAcquireSRWLockShared;
/**
Check for presence of Windows slim reader writer lock function.
Load function pointers.
*/
static void check_srwlock_availability(void)
{
HMODULE module= GetModuleHandle("kernel32");
my_InitializeSRWLock= (srw_func) GetProcAddress(module,
"InitializeSRWLock");
my_AcquireSRWLockExclusive= (srw_func) GetProcAddress(module,
"AcquireSRWLockExclusive");
my_AcquireSRWLockShared= (srw_func) GetProcAddress(module,
"AcquireSRWLockShared");
my_ReleaseSRWLockExclusive= (srw_func) GetProcAddress(module,
"ReleaseSRWLockExclusive");
my_ReleaseSRWLockShared= (srw_func) GetProcAddress(module,
"ReleaseSRWLockShared");
my_TryAcquireSRWLockExclusive= (srw_bool_func) GetProcAddress(module,
"TryAcquireSRWLockExclusive");
my_TryAcquireSRWLockShared= (srw_bool_func) GetProcAddress(module,
"TryAcquireSRWLockShared");
/*
We currently require TryAcquireSRWLockExclusive. This API is missing on
Vista, this means SRWLock are only used starting with Win7.
If "trylock" usage for rwlocks is eliminated from server codebase (it is used
in a single place currently, in query cache), then SRWLock can be enabled on
Vista too. In this case condition below needs to be changed to e.g check
for my_InitializeSRWLock.
*/
if (my_TryAcquireSRWLockExclusive)
have_srwlock= TRUE;
}
static int srw_init(my_rw_lock_t *rwp)
{
my_InitializeSRWLock(&rwp->srwlock);
rwp->have_exclusive_srwlock = FALSE;
return 0;
}
static int srw_rdlock(my_rw_lock_t *rwp)
{
my_AcquireSRWLockShared(&rwp->srwlock);
return 0;
}
static int srw_tryrdlock(my_rw_lock_t *rwp)
{
if (!my_TryAcquireSRWLockShared(&rwp->srwlock))
return EBUSY;
return 0;
}
static int srw_wrlock(my_rw_lock_t *rwp)
{
my_AcquireSRWLockExclusive(&rwp->srwlock);
rwp->have_exclusive_srwlock= TRUE;
return 0;
}
static int srw_trywrlock(my_rw_lock_t *rwp)
{
if (!my_TryAcquireSRWLockExclusive(&rwp->srwlock))
return EBUSY;
rwp->have_exclusive_srwlock= TRUE;
return 0;
}
static int srw_unlock(my_rw_lock_t *rwp)
{
if (rwp->have_exclusive_srwlock)
{
rwp->have_exclusive_srwlock= FALSE;
my_ReleaseSRWLockExclusive(&rwp->srwlock);
}
else
{
my_ReleaseSRWLockShared(&rwp->srwlock);
}
return 0;
}
#endif /*_WIN32 */
/* /*
Source base from Sun Microsystems SPILT, simplified for MySQL use Source base from Sun Microsystems SPILT, simplified for MySQL use
-- Joshua Chamas -- Joshua Chamas
...@@ -63,6 +176,22 @@ int my_rw_init(my_rw_lock_t *rwp) ...@@ -63,6 +176,22 @@ int my_rw_init(my_rw_lock_t *rwp)
{ {
pthread_condattr_t cond_attr; pthread_condattr_t cond_attr;
#ifdef _WIN32
/*
Once initialization is used here rather than in my_init(), in order to
- avoid my_init() pitfalls- (undefined order in which initialization should
run)
- be potentially useful C++ (static constructors)
- just to simplify the API.
Also, the overhead is of my_pthread_once is very small.
*/
static my_pthread_once_t once_control= MY_PTHREAD_ONCE_INIT;
my_pthread_once(&once_control, check_srwlock_availability);
if (have_srwlock)
return srw_init(rwp);
#endif
pthread_mutex_init( &rwp->lock, MY_MUTEX_INIT_FAST); pthread_mutex_init( &rwp->lock, MY_MUTEX_INIT_FAST);
pthread_condattr_init( &cond_attr ); pthread_condattr_init( &cond_attr );
pthread_cond_init( &rwp->readers, &cond_attr ); pthread_cond_init( &rwp->readers, &cond_attr );
...@@ -81,6 +210,10 @@ int my_rw_init(my_rw_lock_t *rwp) ...@@ -81,6 +210,10 @@ int my_rw_init(my_rw_lock_t *rwp)
int my_rw_destroy(my_rw_lock_t *rwp) int my_rw_destroy(my_rw_lock_t *rwp)
{ {
#ifdef _WIN32
if (have_srwlock)
return 0; /* no destroy function */
#endif
DBUG_ASSERT(rwp->state == 0); DBUG_ASSERT(rwp->state == 0);
pthread_mutex_destroy( &rwp->lock ); pthread_mutex_destroy( &rwp->lock );
pthread_cond_destroy( &rwp->readers ); pthread_cond_destroy( &rwp->readers );
...@@ -91,6 +224,11 @@ int my_rw_destroy(my_rw_lock_t *rwp) ...@@ -91,6 +224,11 @@ int my_rw_destroy(my_rw_lock_t *rwp)
int my_rw_rdlock(my_rw_lock_t *rwp) int my_rw_rdlock(my_rw_lock_t *rwp)
{ {
#ifdef _WIN32
if (have_srwlock)
return srw_rdlock(rwp);
#endif
pthread_mutex_lock(&rwp->lock); pthread_mutex_lock(&rwp->lock);
/* active or queued writers */ /* active or queued writers */
...@@ -105,6 +243,12 @@ int my_rw_rdlock(my_rw_lock_t *rwp) ...@@ -105,6 +243,12 @@ int my_rw_rdlock(my_rw_lock_t *rwp)
int my_rw_tryrdlock(my_rw_lock_t *rwp) int my_rw_tryrdlock(my_rw_lock_t *rwp)
{ {
int res; int res;
#ifdef _WIN32
if (have_srwlock)
return srw_tryrdlock(rwp);
#endif
pthread_mutex_lock(&rwp->lock); pthread_mutex_lock(&rwp->lock);
if ((rwp->state < 0 ) || rwp->waiters) if ((rwp->state < 0 ) || rwp->waiters)
res= EBUSY; /* Can't get lock */ res= EBUSY; /* Can't get lock */
...@@ -120,6 +264,11 @@ int my_rw_tryrdlock(my_rw_lock_t *rwp) ...@@ -120,6 +264,11 @@ int my_rw_tryrdlock(my_rw_lock_t *rwp)
int my_rw_wrlock(my_rw_lock_t *rwp) int my_rw_wrlock(my_rw_lock_t *rwp)
{ {
#ifdef _WIN32
if (have_srwlock)
return srw_wrlock(rwp);
#endif
pthread_mutex_lock(&rwp->lock); pthread_mutex_lock(&rwp->lock);
rwp->waiters++; /* another writer queued */ rwp->waiters++; /* another writer queued */
...@@ -140,6 +289,12 @@ int my_rw_wrlock(my_rw_lock_t *rwp) ...@@ -140,6 +289,12 @@ int my_rw_wrlock(my_rw_lock_t *rwp)
int my_rw_trywrlock(my_rw_lock_t *rwp) int my_rw_trywrlock(my_rw_lock_t *rwp)
{ {
int res; int res;
#ifdef _WIN32
if (have_srwlock)
return srw_trywrlock(rwp);
#endif
pthread_mutex_lock(&rwp->lock); pthread_mutex_lock(&rwp->lock);
if (rwp->state) if (rwp->state)
res= EBUSY; /* Can't get lock */ res= EBUSY; /* Can't get lock */
...@@ -158,6 +313,11 @@ int my_rw_trywrlock(my_rw_lock_t *rwp) ...@@ -158,6 +313,11 @@ int my_rw_trywrlock(my_rw_lock_t *rwp)
int my_rw_unlock(my_rw_lock_t *rwp) int my_rw_unlock(my_rw_lock_t *rwp)
{ {
#ifdef _WIN32
if (have_srwlock)
return srw_unlock(rwp);
#endif
DBUG_PRINT("rw_unlock", DBUG_PRINT("rw_unlock",
("state: %d waiters: %d", rwp->state, rwp->waiters)); ("state: %d waiters: %d", rwp->state, rwp->waiters));
pthread_mutex_lock(&rwp->lock); pthread_mutex_lock(&rwp->lock);
......
# Copyright (C) 2000-2003, 2005 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# As pstack doesn't work on all configurations, we have to use
# the USE_PSTACK hack to get all files into distribution
#
SUBDIRS = aout
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
pkglib_LIBRARIES = libpstack.a
libpstack_a_SOURCES = bucomm.c filemode.c linuxthreads.c rddbg.c \
debug.c ieee.c pstack.c stabs.c
noinst_HEADERS = bucomm.h debug.h ieee.h budbg.h demangle.h \
linuxthreads.h pstack.h pstacktrace.h
noinst_HEADERS = aout64.h stab.def stab_gnu.h
This diff is collapsed.
This diff is collapsed.
#ifndef __GNU_STAB__
/* Indicate the GNU stab.h is in use. */
#define __GNU_STAB__
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
#define __define_stab_duplicate(NAME, CODE, STRING) NAME=CODE,
enum __stab_debug_code
{
#include "aout/stab.def"
LAST_UNUSED_STAB_CODE
};
#undef __define_stab
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
#define N_SO_AS 1
#define N_SO_C 2
#define N_SO_ANSI_C 3
#define N_SO_CC 4 /* C++ */
#define N_SO_FORTRAN 5
#define N_SO_PASCAL 6
/* Solaris2: Floating point type values in basic types. */
#define NF_NONE 0
#define NF_SINGLE 1 /* IEEE 32-bit */
#define NF_DOUBLE 2 /* IEEE 64-bit */
#define NF_COMPLEX 3 /* Fortran complex */
#define NF_COMPLEX16 4 /* Fortran double complex */
#define NF_COMPLEX32 5 /* Fortran complex*16 */
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
#endif /* __GNU_STAB_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -81,7 +81,6 @@ mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la ...@@ -81,7 +81,6 @@ mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la
LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@ LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
mysqld_LDADD = libndb.la \ mysqld_LDADD = libndb.la \
@MYSQLD_EXTRA_LDFLAGS@ \ @MYSQLD_EXTRA_LDFLAGS@ \
@pstack_libs@ \
@mysql_plugin_libs@ \ @mysql_plugin_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
$(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@ $(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment