mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1
This commit is contained in:
commit
b895a180c4
221 changed files with 11572 additions and 9808 deletions
|
@ -692,6 +692,7 @@ mysql-test/*.ds?
|
|||
mysql-test/*.vcproj
|
||||
mysql-test/gmon.out
|
||||
mysql-test/install_test_db
|
||||
mysql-test/mtr
|
||||
mysql-test/mysql-test-run
|
||||
mysql-test/mysql-test-run.log
|
||||
mysql-test/mysql_test_run_new
|
||||
|
@ -1170,6 +1171,7 @@ sql/*.ds?
|
|||
sql/*.vcproj
|
||||
sql/.gdbinit
|
||||
sql/client.c
|
||||
sql/f.c
|
||||
sql/gen_lex_hash
|
||||
sql/gmon.out
|
||||
sql/handlerton.cc
|
||||
|
|
|
@ -51,7 +51,7 @@ parse_options()
|
|||
|
||||
########################################################################
|
||||
|
||||
if ! test -f sql/mysqld.cc
|
||||
if test ! -f sql/mysqld.cc
|
||||
then
|
||||
echo "You must run this script from the MySQL top-level directory"
|
||||
exit 1
|
||||
|
@ -185,12 +185,6 @@ fi
|
|||
# (returns 0 if finds lines)
|
||||
if ccache -V > /dev/null 2>&1
|
||||
then
|
||||
if ! (echo "$CC" | grep "ccache" > /dev/null)
|
||||
then
|
||||
CC="ccache $CC"
|
||||
fi
|
||||
if ! (echo "$CXX" | grep "ccache" > /dev/null)
|
||||
then
|
||||
CXX="ccache $CXX"
|
||||
fi
|
||||
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
||||
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
|
||||
fi
|
||||
|
|
383
BUILD/check-cpu
383
BUILD/check-cpu
|
@ -3,213 +3,216 @@
|
|||
# Check cpu of current machine and find the
|
||||
# best compiler optimization flags for gcc
|
||||
#
|
||||
#
|
||||
|
||||
if test -r /proc/cpuinfo ; then
|
||||
# on Linux (and others?) we can get detailed CPU information out of /proc
|
||||
cpuinfo="cat /proc/cpuinfo"
|
||||
check_cpu () {
|
||||
if test -r /proc/cpuinfo ; then
|
||||
# on Linux (and others?) we can get detailed CPU information out of /proc
|
||||
cpuinfo="cat /proc/cpuinfo"
|
||||
|
||||
# detect CPU family
|
||||
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
if test -z "$cpu_family" ; then
|
||||
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
# detect CPU family
|
||||
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
if test -z "$cpu_family" ; then
|
||||
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
fi
|
||||
|
||||
# detect CPU vendor and model
|
||||
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
|
||||
if test -z "$model_name" ; then
|
||||
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
|
||||
fi
|
||||
|
||||
# fallback: get CPU model from uname output
|
||||
if test -z "$model_name" ; then
|
||||
model_name=`uname -m`
|
||||
fi
|
||||
|
||||
# parse CPU flags
|
||||
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
|
||||
eval cpu_flag_$flag=yes
|
||||
done
|
||||
else
|
||||
# Fallback when there is no /proc/cpuinfo
|
||||
case "`uname -s`" in
|
||||
FreeBSD|OpenBSD)
|
||||
cpu_family=`uname -m`;
|
||||
model_name=`sysctl -n hw.model`
|
||||
;;
|
||||
Darwin)
|
||||
cpu_family=`uname -p`
|
||||
model_name=`machine`
|
||||
;;
|
||||
*)
|
||||
cpu_family=`uname -m`;
|
||||
model_name=`uname -p`;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# detect CPU vendor and model
|
||||
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
|
||||
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
|
||||
if test -z "$model_name" ; then
|
||||
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
|
||||
fi
|
||||
|
||||
# fallback: get CPU model from uname output
|
||||
if test -z "$model_name" ; then
|
||||
model_name=`uname -m`
|
||||
fi
|
||||
|
||||
# parse CPU flags
|
||||
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do
|
||||
eval cpu_flag_$flag=yes
|
||||
done
|
||||
else
|
||||
# Fallback when there is no /proc/cpuinfo
|
||||
case "`uname -s`" in
|
||||
FreeBSD|OpenBSD)
|
||||
cpu_family=`uname -m`;
|
||||
model_name=`sysctl -n hw.model`
|
||||
# detect CPU shortname as used by gcc options
|
||||
# this list is not complete, feel free to add further entries
|
||||
cpu_arg=""
|
||||
case "$cpu_family--$model_name" in
|
||||
# DEC Alpha
|
||||
Alpha*EV6*)
|
||||
cpu_arg="ev6";
|
||||
;;
|
||||
Darwin)
|
||||
cpu_family=`uname -p`
|
||||
model_name=`machine`
|
||||
|
||||
# Intel ia32
|
||||
*X[eE][oO][nN]*)
|
||||
# a Xeon is just another pentium4 ...
|
||||
# ... unless it has the "lm" (long-mode) flag set,
|
||||
# in that case it's a Xeon with EM64T support
|
||||
if [ -z "$cpu_flag_lm" ]; then
|
||||
cpu_arg="pentium4";
|
||||
else
|
||||
cpu_arg="nocona";
|
||||
fi
|
||||
;;
|
||||
*Pentium*4*Mobile*)
|
||||
cpu_arg="pentium4m";
|
||||
;;
|
||||
*Pentium*4*)
|
||||
cpu_arg="pentium4";
|
||||
;;
|
||||
*Pentium*III*Mobile*)
|
||||
cpu_arg="pentium3m";
|
||||
;;
|
||||
*Pentium*III*)
|
||||
cpu_arg="pentium3";
|
||||
;;
|
||||
*Pentium*M*pro*)
|
||||
cpu_arg="pentium-m";
|
||||
;;
|
||||
*Athlon*64*)
|
||||
cpu_arg="athlon64";
|
||||
;;
|
||||
*Athlon*)
|
||||
cpu_arg="athlon";
|
||||
;;
|
||||
*Opteron*)
|
||||
cpu_arg="opteron";
|
||||
;;
|
||||
# MacOSX / Intel
|
||||
*i386*i486*)
|
||||
cpu_arg="pentium-m";
|
||||
;;
|
||||
|
||||
# Intel ia64
|
||||
*Itanium*)
|
||||
# Don't need to set any flags for itanium(at the moment)
|
||||
cpu_arg="";
|
||||
;;
|
||||
|
||||
#
|
||||
*ppc*)
|
||||
cpu_arg='powerpc'
|
||||
;;
|
||||
|
||||
*powerpc*)
|
||||
cpu_arg='powerpc'
|
||||
;;
|
||||
|
||||
# unknown
|
||||
*)
|
||||
cpu_family=`uname -m`;
|
||||
model_name=`uname -p`;
|
||||
cpu_arg="";
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# detect CPU shortname as used by gcc options
|
||||
# this list is not complete, feel free to add further entries
|
||||
cpu_arg=""
|
||||
case "$cpu_family--$model_name" in
|
||||
# DEC Alpha
|
||||
Alpha*EV6*)
|
||||
cpu_arg="ev6";
|
||||
;;
|
||||
|
||||
# Intel ia32
|
||||
*X[eE][oO][nN]*)
|
||||
# a Xeon is just another pentium4 ...
|
||||
# ... unless it has the "lm" (long-mode) flag set,
|
||||
# in that case it's a Xeon with EM64T support
|
||||
if [ -z "$cpu_flag_lm" ]; then
|
||||
cpu_arg="pentium4";
|
||||
else
|
||||
cpu_arg="nocona";
|
||||
fi
|
||||
;;
|
||||
*Pentium*4*Mobile*)
|
||||
cpu_arg="pentium4m";
|
||||
;;
|
||||
*Pentium*4*)
|
||||
cpu_arg="pentium4";
|
||||
;;
|
||||
*Pentium*III*Mobile*)
|
||||
cpu_arg="pentium3m";
|
||||
;;
|
||||
*Pentium*III*)
|
||||
cpu_arg="pentium3";
|
||||
;;
|
||||
*Pentium*M*pro*)
|
||||
cpu_arg="pentium-m";
|
||||
;;
|
||||
*Athlon*64*)
|
||||
cpu_arg="athlon64";
|
||||
;;
|
||||
*Athlon*)
|
||||
cpu_arg="athlon";
|
||||
;;
|
||||
*Opteron*)
|
||||
cpu_arg="opteron";
|
||||
;;
|
||||
# MacOSX / Intel
|
||||
*i386*i486*)
|
||||
cpu_arg="pentium-m";
|
||||
;;
|
||||
|
||||
# Intel ia64
|
||||
*Itanium*)
|
||||
# Don't need to set any flags for itanium(at the moment)
|
||||
cpu_arg="";
|
||||
;;
|
||||
|
||||
#
|
||||
*ppc*)
|
||||
cpu_arg='powerpc'
|
||||
;;
|
||||
|
||||
*powerpc*)
|
||||
cpu_arg='powerpc'
|
||||
;;
|
||||
|
||||
# unknown
|
||||
*)
|
||||
cpu_arg="";
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if test -z "$cpu_arg"; then
|
||||
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using."
|
||||
check_cpu_cflags=""
|
||||
return
|
||||
fi
|
||||
|
||||
# different compiler versions have different option names
|
||||
# for CPU specific command line options
|
||||
if test -z "$CC" ; then
|
||||
cc="gcc";
|
||||
else
|
||||
cc=$CC
|
||||
fi
|
||||
|
||||
cc_ver=`$cc --version | sed 1q`
|
||||
cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
||||
|
||||
case "$cc_ver--$cc_verno" in
|
||||
*GCC*)
|
||||
# different gcc backends (and versions) have different CPU flags
|
||||
case `gcc -dumpmachine` in
|
||||
i?86-*)
|
||||
case "$cc_verno" in
|
||||
3.4*|3.5*|4.*)
|
||||
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
ppc-*)
|
||||
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
|
||||
;;
|
||||
x86_64-*)
|
||||
check_cpu_args='-mtune=$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
check_cpu_cflags=""
|
||||
return
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
2.95.*)
|
||||
# GCC 2.95 doesn't expose its name in --version output
|
||||
check_cpu_args='-m$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
if test -z "$cpu_arg"; then
|
||||
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
|
||||
check_cpu_cflags=""
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# now we check whether the compiler really understands the cpu type
|
||||
touch __test.c
|
||||
|
||||
while [ "$cpu_arg" ] ; do
|
||||
echo -n testing $cpu_arg "... "
|
||||
|
||||
# compile check
|
||||
check_cpu_cflags=`eval echo $check_cpu_args`
|
||||
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
|
||||
echo ok
|
||||
break;
|
||||
fi
|
||||
|
||||
echo failed
|
||||
check_cpu_cflags=""
|
||||
# different compiler versions have different option names
|
||||
# for CPU specific command line options
|
||||
if test -z "$CC" ; then
|
||||
cc="gcc";
|
||||
else
|
||||
cc=$CC
|
||||
fi
|
||||
|
||||
# if compile failed: check whether it supports a predecessor of this CPU
|
||||
# this list is not complete, feel free to add further entries
|
||||
case "$cpu_arg" in
|
||||
# Intel ia32
|
||||
nocona) cpu_arg=pentium4 ;;
|
||||
prescott) cpu_arg=pentium4 ;;
|
||||
pentium4m) cpu_arg=pentium4 ;;
|
||||
pentium4) cpu_arg=pentium3 ;;
|
||||
pentium3m) cpu_arg=pentium3 ;;
|
||||
pentium3) cpu_arg=pentium2 ;;
|
||||
pentium2) cpu_arg=pentiumpro ;;
|
||||
pentiumpro) cpu_arg=pentium ;;
|
||||
pentium) cpu_arg=i486 ;;
|
||||
i486) cpu_arg=i386 ;;
|
||||
cc_ver=`$cc --version | sed 1q`
|
||||
cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
||||
|
||||
# power / powerPC
|
||||
7450) cpu_arg=7400 ;;
|
||||
|
||||
*) cpu_arg="" ;;
|
||||
case "$cc_ver--$cc_verno" in
|
||||
*GCC*)
|
||||
# different gcc backends (and versions) have different CPU flags
|
||||
case `gcc -dumpmachine` in
|
||||
i?86-*)
|
||||
case "$cc_verno" in
|
||||
3.4*|3.5*|4.*)
|
||||
check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
ppc-*)
|
||||
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
|
||||
;;
|
||||
x86_64-*)
|
||||
check_cpu_args='-mtune=$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
check_cpu_cflags=""
|
||||
return
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
2.95.*)
|
||||
# GCC 2.95 doesn't expose its name in --version output
|
||||
check_cpu_args='-m$cpu_arg'
|
||||
;;
|
||||
*)
|
||||
check_cpu_cflags=""
|
||||
return
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm __test.*
|
||||
# now we check whether the compiler really understands the cpu type
|
||||
touch __test.c
|
||||
|
||||
while [ "$cpu_arg" ] ; do
|
||||
# FIXME: echo -n isn't portable - see contortions autoconf goes through
|
||||
echo -n testing $cpu_arg "... " >&2
|
||||
|
||||
# compile check
|
||||
check_cpu_cflags=`eval echo $check_cpu_args`
|
||||
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
|
||||
echo ok >&2
|
||||
break;
|
||||
fi
|
||||
|
||||
echo failed >&2
|
||||
check_cpu_cflags=""
|
||||
|
||||
# if compile failed: check whether it supports a predecessor of this CPU
|
||||
# this list is not complete, feel free to add further entries
|
||||
case "$cpu_arg" in
|
||||
# Intel ia32
|
||||
nocona) cpu_arg=pentium4 ;;
|
||||
prescott) cpu_arg=pentium4 ;;
|
||||
pentium4m) cpu_arg=pentium4 ;;
|
||||
pentium4) cpu_arg=pentium3 ;;
|
||||
pentium3m) cpu_arg=pentium3 ;;
|
||||
pentium3) cpu_arg=pentium2 ;;
|
||||
pentium2) cpu_arg=pentiumpro ;;
|
||||
pentiumpro) cpu_arg=pentium ;;
|
||||
pentium) cpu_arg=i486 ;;
|
||||
i486) cpu_arg=i386 ;;
|
||||
|
||||
# power / powerPC
|
||||
7450) cpu_arg=7400 ;;
|
||||
|
||||
*) cpu_arg="" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm __test.*
|
||||
}
|
||||
|
||||
check_cpu
|
||||
|
|
44
bdb/CMakeLists.txt
Executable file
44
bdb/CMakeLists.txt
Executable file
|
@ -0,0 +1,44 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bdb/build_win32
|
||||
${CMAKE_SOURCE_DIR}/bdb/dbinc
|
||||
${CMAKE_SOURCE_DIR}/bdb)
|
||||
|
||||
# BDB needs a number of source files that are auto-generated by the unix
|
||||
# configure. So to build BDB, it is necessary to copy these over to the Windows
|
||||
# bitkeeper tree, or to use a source .tar.gz package which already has these
|
||||
# files.
|
||||
ADD_LIBRARY(bdb btree/bt_compare.c btree/bt_conv.c btree/bt_curadj.c btree/bt_cursor.c
|
||||
btree/bt_delete.c btree/bt_method.c btree/bt_open.c btree/bt_put.c btree/bt_rec.c
|
||||
btree/bt_reclaim.c btree/bt_recno.c btree/bt_rsearch.c btree/bt_search.c
|
||||
btree/bt_split.c btree/bt_stat.c btree/bt_upgrade.c btree/bt_verify.c btree/btree_auto.c
|
||||
db/crdel_auto.c db/crdel_rec.c db/db.c db/db_am.c db/db_auto.c common/db_byteorder.c
|
||||
db/db_cam.c db/db_conv.c db/db_dispatch.c db/db_dup.c common/db_err.c common/db_getlong.c
|
||||
common/db_idspace.c db/db_iface.c db/db_join.c common/db_log2.c db/db_meta.c
|
||||
db/db_method.c db/db_open.c db/db_overflow.c db/db_pr.c db/db_rec.c db/db_reclaim.c
|
||||
db/db_remove.c db/db_rename.c db/db_ret.c env/db_salloc.c env/db_shash.c db/db_truncate.c
|
||||
db/db_upg.c db/db_upg_opd.c db/db_vrfy.c db/db_vrfyutil.c dbm/dbm.c dbreg/dbreg.c
|
||||
dbreg/dbreg_auto.c dbreg/dbreg_rec.c dbreg/dbreg_util.c env/env_file.c env/env_method.c
|
||||
env/env_open.c env/env_recover.c env/env_region.c fileops/fileops_auto.c fileops/fop_basic.c
|
||||
fileops/fop_rec.c fileops/fop_util.c hash/hash.c hash/hash_auto.c hash/hash_conv.c
|
||||
hash/hash_dup.c hash/hash_func.c hash/hash_meta.c hash/hash_method.c hash/hash_open.c
|
||||
hash/hash_page.c hash/hash_rec.c hash/hash_reclaim.c hash/hash_stat.c hash/hash_upgrade.c
|
||||
hash/hash_verify.c hmac/hmac.c hsearch/hsearch.c lock/lock.c lock/lock_deadlock.c
|
||||
lock/lock_method.c lock/lock_region.c lock/lock_stat.c lock/lock_util.c log/log.c
|
||||
log/log_archive.c log/log_compare.c log/log_get.c log/log_method.c log/log_put.c
|
||||
mp/mp_alloc.c mp/mp_bh.c mp/mp_fget.c mp/mp_fopen.c mp/mp_fput.c
|
||||
mp/mp_fset.c mp/mp_method.c mp/mp_region.c mp/mp_register.c mp/mp_stat.c mp/mp_sync.c
|
||||
mp/mp_trickle.c mutex/mut_tas.c mutex/mut_win32.c mutex/mutex.c os_win32/os_abs.c
|
||||
os/os_alloc.c os_win32/os_clock.c os_win32/os_config.c os_win32/os_dir.c os_win32/os_errno.c
|
||||
os_win32/os_fid.c os_win32/os_fsync.c os_win32/os_handle.c os/os_id.c os_win32/os_map.c
|
||||
os/os_method.c os/os_oflags.c os_win32/os_open.c os/os_region.c os_win32/os_rename.c
|
||||
os/os_root.c os/os_rpath.c os_win32/os_rw.c os_win32/os_seek.c os_win32/os_sleep.c
|
||||
os_win32/os_spin.c os_win32/os_stat.c os/os_tmpdir.c os_win32/os_type.c os/os_unlink.c
|
||||
qam/qam.c qam/qam_auto.c qam/qam_conv.c qam/qam_files.c qam/qam_method.c qam/qam_open.c
|
||||
qam/qam_rec.c qam/qam_stat.c qam/qam_upgrade.c qam/qam_verify.c rep/rep_method.c
|
||||
rep/rep_record.c rep/rep_region.c rep/rep_util.c hmac/sha1.c
|
||||
clib/strcasecmp.c txn/txn.c txn/txn_auto.c txn/txn_method.c txn/txn_rec.c
|
||||
txn/txn_recover.c txn/txn_region.c txn/txn_stat.c txn/txn_util.c common/util_log.c
|
||||
common/util_sig.c xa/xa.c xa/xa_db.c xa/xa_map.c)
|
||||
|
|
@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
|
|||
static void mysql_end_timer(ulong start_time,char *buff);
|
||||
static void nice_time(double sec,char *buff,bool part_second);
|
||||
static sig_handler mysql_end(int sig);
|
||||
static sig_handler mysql_sigint(int sig);
|
||||
static sig_handler handle_sigint(int sig);
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
@ -420,8 +420,7 @@ int main(int argc,char *argv[])
|
|||
if (opt_sigint_ignore)
|
||||
signal(SIGINT, SIG_IGN);
|
||||
else
|
||||
signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up
|
||||
|
||||
signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
|
||||
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
|
||||
|
||||
/*
|
||||
|
@ -489,28 +488,6 @@ int main(int argc,char *argv[])
|
|||
#endif
|
||||
}
|
||||
|
||||
sig_handler mysql_sigint(int sig)
|
||||
{
|
||||
char kill_buffer[40];
|
||||
MYSQL *kill_mysql= NULL;
|
||||
|
||||
signal(SIGINT, mysql_sigint);
|
||||
|
||||
/* terminate if no query being executed, or we already tried interrupting */
|
||||
if (!executing_query || interrupted_query++)
|
||||
mysql_end(sig);
|
||||
|
||||
kill_mysql= mysql_init(kill_mysql);
|
||||
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
|
||||
"", opt_mysql_port, opt_mysql_unix_port,0))
|
||||
mysql_end(sig);
|
||||
/* kill_buffer is always big enough because max length of %lu is 15 */
|
||||
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
|
||||
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
|
||||
mysql_close(kill_mysql);
|
||||
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
|
||||
}
|
||||
|
||||
sig_handler mysql_end(int sig)
|
||||
{
|
||||
mysql_close(&mysql);
|
||||
|
@ -1058,8 +1035,6 @@ static int read_and_execute(bool interactive)
|
|||
if (opt_outfile && glob_buffer.is_empty())
|
||||
fflush(OUTFILE);
|
||||
|
||||
interrupted_query= 0;
|
||||
|
||||
#if defined( __WIN__) || defined(__NETWARE__)
|
||||
tee_fputs(prompt, stdout);
|
||||
#if defined(__NETWARE__)
|
||||
|
@ -1982,6 +1957,9 @@ com_charset(String *buffer __attribute__((unused)), char *line)
|
|||
if (new_cs)
|
||||
{
|
||||
charset_info= new_cs;
|
||||
mysql_set_character_set(&mysql, charset_info->csname);
|
||||
default_charset= (char *)charset_info->csname;
|
||||
default_charset_used= 1;
|
||||
put_info("Charset changed", INFO_INFO);
|
||||
}
|
||||
else put_info("Charset is not found", INFO_INFO);
|
||||
|
@ -2041,9 +2019,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
}
|
||||
|
||||
timer=start_timer();
|
||||
|
||||
executing_query= 1;
|
||||
|
||||
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
|
||||
|
||||
#ifdef HAVE_READLINE
|
||||
|
@ -2059,7 +2035,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
{
|
||||
executing_query= 0;
|
||||
buffer->length(0); // Remove query on error
|
||||
executing_query= 0;
|
||||
return error;
|
||||
}
|
||||
error=0;
|
||||
|
@ -2143,9 +2118,6 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
fflush(stdout);
|
||||
mysql_free_result(result);
|
||||
} while (!(err= mysql_next_result(&mysql)));
|
||||
|
||||
executing_query= 0;
|
||||
|
||||
if (err >= 1)
|
||||
error= put_error(&mysql);
|
||||
|
||||
|
@ -2362,9 +2334,14 @@ print_table_data(MYSQL_RES *result)
|
|||
(void) tee_fputs("|", PAGER);
|
||||
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||
{
|
||||
tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
|
||||
uint name_length= (uint) strlen(field->name);
|
||||
uint numcells= charset_info->cset->numcells(charset_info,
|
||||
field->name,
|
||||
field->name + name_length);
|
||||
uint display_length= field->max_length + name_length - numcells;
|
||||
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
|
||||
MAX_COLUMN_LENGTH),
|
||||
field->name);
|
||||
field->name);
|
||||
num_flag[off]= IS_NUM(field->type);
|
||||
not_null_flag[off]= IS_NOT_NULL(field->flags);
|
||||
}
|
||||
|
|
|
@ -157,17 +157,29 @@ static int create_defaults_file(const char *path, const char *our_defaults_path)
|
|||
File our_defaults_file, defaults_file;
|
||||
char buffer[512];
|
||||
char *buffer_end;
|
||||
int failed_to_open_count= 0;
|
||||
int error;
|
||||
|
||||
/* check if the defaults file is needed at all */
|
||||
if (!opt_password)
|
||||
return 0;
|
||||
|
||||
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY,
|
||||
retry_open:
|
||||
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
|
||||
MYF(MY_FAE | MY_WME));
|
||||
|
||||
if (defaults_file < 0)
|
||||
return 1;
|
||||
{
|
||||
if (failed_to_open_count == 0)
|
||||
{
|
||||
remove(path);
|
||||
failed_to_open_count+= 1;
|
||||
goto retry_open;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
upgrade_defaults_created= 1;
|
||||
if (our_defaults_path)
|
||||
{
|
||||
|
|
|
@ -430,7 +430,9 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
|
|||
int string_value);
|
||||
static int dump_selected_tables(char *db, char **table_names, int tables);
|
||||
static int dump_all_tables_in_db(char *db);
|
||||
static int init_dumping(char *);
|
||||
static int init_dumping_views(char *);
|
||||
static int init_dumping_tables(char *);
|
||||
static int init_dumping(char *, int init_func(char*));
|
||||
static int dump_databases(char **);
|
||||
static int dump_all_databases();
|
||||
static char *quote_name(const char *name, char *buff, my_bool force);
|
||||
|
@ -861,8 +863,9 @@ static int get_options(int *argc, char ***argv)
|
|||
static void DB_error(MYSQL *mysql, const char *when)
|
||||
{
|
||||
DBUG_ENTER("DB_error");
|
||||
my_printf_error(0,"Got error: %d: %s %s", MYF(0),
|
||||
mysql_errno(mysql), mysql_error(mysql), when);
|
||||
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
|
||||
mysql_errno(mysql), mysql_error(mysql), when);
|
||||
fflush(stderr);
|
||||
safe_exit(EX_MYSQLERR);
|
||||
DBUG_VOID_RETURN;
|
||||
} /* DB_error */
|
||||
|
@ -890,8 +893,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
|
|||
if (mysql_query(mysql_con, query) ||
|
||||
(res && !((*res)= mysql_store_result(mysql_con))))
|
||||
{
|
||||
my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0),
|
||||
query, mysql_error(mysql_con), mysql_errno(mysql_con));
|
||||
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
|
||||
my_progname, query,
|
||||
mysql_error(mysql_con), mysql_errno(mysql_con));
|
||||
safe_exit(EX_MYSQLERR);
|
||||
return 1;
|
||||
}
|
||||
|
@ -2378,7 +2382,10 @@ static void dump_table(char *table, char *db)
|
|||
check_io(md_result_file);
|
||||
}
|
||||
if (mysql_query_with_error_report(mysql, 0, query))
|
||||
{
|
||||
DB_error(mysql, "when retrieving data from server");
|
||||
goto err;
|
||||
}
|
||||
if (quick)
|
||||
res=mysql_use_result(mysql);
|
||||
else
|
||||
|
@ -2905,7 +2912,76 @@ static int dump_databases(char **db_names)
|
|||
} /* dump_databases */
|
||||
|
||||
|
||||
static int init_dumping(char *database)
|
||||
/*
|
||||
View Specific database initalization.
|
||||
|
||||
SYNOPSIS
|
||||
init_dumping_views
|
||||
qdatabase quoted name of the database
|
||||
|
||||
RETURN VALUES
|
||||
0 Success.
|
||||
1 Failure.
|
||||
*/
|
||||
int init_dumping_views(char *qdatabase)
|
||||
{
|
||||
return 0;
|
||||
} /* init_dumping_views */
|
||||
|
||||
|
||||
/*
|
||||
Table Specific database initalization.
|
||||
|
||||
SYNOPSIS
|
||||
init_dumping_tables
|
||||
qdatabase quoted name of the database
|
||||
|
||||
RETURN VALUES
|
||||
0 Success.
|
||||
1 Failure.
|
||||
*/
|
||||
int init_dumping_tables(char *qdatabase)
|
||||
{
|
||||
if (!opt_create_db)
|
||||
{
|
||||
char qbuf[256];
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *dbinfo;
|
||||
|
||||
my_snprintf(qbuf, sizeof(qbuf),
|
||||
"SHOW CREATE DATABASE IF NOT EXISTS %s",
|
||||
qdatabase);
|
||||
|
||||
if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
|
||||
{
|
||||
/* Old server version, dump generic CREATE DATABASE */
|
||||
if (opt_drop_database)
|
||||
fprintf(md_result_file,
|
||||
"\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
|
||||
qdatabase);
|
||||
fprintf(md_result_file,
|
||||
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
|
||||
qdatabase);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opt_drop_database)
|
||||
fprintf(md_result_file,
|
||||
"\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
|
||||
qdatabase);
|
||||
row = mysql_fetch_row(dbinfo);
|
||||
if (row[1])
|
||||
{
|
||||
fprintf(md_result_file,"\n%s;\n",row[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* init_dumping_tables */
|
||||
|
||||
|
||||
static int init_dumping(char *database, int init_func(char*))
|
||||
{
|
||||
if (mysql_get_server_version(mysql) >= 50003 &&
|
||||
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
|
||||
|
@ -2930,40 +3006,10 @@ static int init_dumping(char *database)
|
|||
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
if (!opt_create_db)
|
||||
{
|
||||
char qbuf[256];
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *dbinfo;
|
||||
|
||||
my_snprintf(qbuf, sizeof(qbuf),
|
||||
"SHOW CREATE DATABASE IF NOT EXISTS %s",
|
||||
qdatabase);
|
||||
/* Call the view or table specific function */
|
||||
init_func(qdatabase);
|
||||
|
||||
if (mysql_query(mysql, qbuf) || !(dbinfo = mysql_store_result(mysql)))
|
||||
{
|
||||
/* Old server version, dump generic CREATE DATABASE */
|
||||
if (opt_drop_database)
|
||||
fprintf(md_result_file,
|
||||
"\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n",
|
||||
qdatabase);
|
||||
fprintf(md_result_file,
|
||||
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
|
||||
qdatabase);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opt_drop_database)
|
||||
fprintf(md_result_file,
|
||||
"\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n",
|
||||
qdatabase);
|
||||
row = mysql_fetch_row(dbinfo);
|
||||
if (row[1])
|
||||
{
|
||||
fprintf(md_result_file,"\n%s;\n",row[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
|
@ -2997,7 +3043,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
|
||||
if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
|
||||
return 0;
|
||||
if (init_dumping(database))
|
||||
if (init_dumping(database, init_dumping_tables))
|
||||
return 1;
|
||||
if (opt_xml)
|
||||
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||
|
@ -3075,23 +3121,8 @@ static my_bool dump_all_views_in_db(char *database)
|
|||
uint numrows;
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
|
||||
if (mysql_select_db(mysql, database))
|
||||
{
|
||||
DB_error(mysql, "when selecting the database");
|
||||
if (init_dumping(database, init_dumping_views))
|
||||
return 1;
|
||||
}
|
||||
if (opt_databases || opt_alldbs)
|
||||
{
|
||||
char quoted_database_buf[NAME_LEN*2+3];
|
||||
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
|
||||
if (opt_comments)
|
||||
{
|
||||
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
if (opt_xml)
|
||||
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||
if (lock_tables)
|
||||
|
@ -3186,7 +3217,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
char **dump_tables, **pos, **end;
|
||||
DBUG_ENTER("dump_selected_tables");
|
||||
|
||||
if (init_dumping(db))
|
||||
if (init_dumping(db, init_dumping_tables))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
init_alloc_root(&root, 8192, 0);
|
||||
|
|
|
@ -5527,6 +5527,9 @@ int main(int argc, char **argv)
|
|||
if ( opt_mark_progress )
|
||||
dump_progress(result_file);
|
||||
dynstr_free(&ds_progress);
|
||||
|
||||
dynstr_free(&ds_res);
|
||||
|
||||
if (!got_end_timer)
|
||||
timer_output(); /* No end_timer cmd, end it */
|
||||
free_used_memory();
|
||||
|
|
14
dbug/dbug.c
14
dbug/dbug.c
|
@ -71,19 +71,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
/* This file won't compile unless DBUG_OFF is undefined locally */
|
||||
#ifdef DBUG_OFF
|
||||
#undef DBUG_OFF
|
||||
#endif
|
||||
|
||||
#include <m_string.h>
|
||||
#include <errno.h>
|
||||
#if defined(MSDOS) || defined(__WIN__)
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
|
||||
|
||||
/*
|
||||
* Manifest constants which may be "tuned" if desired.
|
||||
*/
|
||||
|
@ -316,6 +315,7 @@ static unsigned long Clock(void);
|
|||
#define ChangeOwner(cs,name)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Macros to allow dbugging with threads
|
||||
*/
|
||||
|
@ -2354,3 +2354,5 @@ va_list ap;
|
|||
}
|
||||
|
||||
#endif /* NO_VARARGS */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ sub generate_prefix($$)
|
|||
next;
|
||||
}
|
||||
|
||||
if ( /^\s*[a-zA-Z0-9*_ ]+\s+([_a-zA-Z0-9]+)\s*\(/ )
|
||||
if ( /^\s*[a-zA-Z0-9*_ ]+\s+\*?([_a-zA-Z0-9]+)\s*\(/ )
|
||||
{
|
||||
print OUT "#define $1 ya$1\n";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define Copyright yaCopyright
|
||||
#define yaSSL_CleanUp yayaSSL_CleanUp
|
||||
#define BN_bin2bn yaBN_bin2bn
|
||||
#define DH_new yaDH_new
|
||||
#define DH_free yaDH_free
|
||||
#define RSA_free yaRSA_free
|
||||
|
@ -92,6 +93,12 @@
|
|||
#define SSL_want_read yaSSL_want_read
|
||||
#define SSL_want_write yaSSL_want_write
|
||||
#define SSL_pending yaSSL_pending
|
||||
#define SSLv3_method yaSSLv3_method
|
||||
#define SSLv3_server_method yaSSLv3_server_method
|
||||
#define SSLv3_client_method yaSSLv3_client_method
|
||||
#define TLSv1_server_method yaTLSv1_server_method
|
||||
#define TLSv1_client_method yaTLSv1_client_method
|
||||
#define SSLv23_server_method yaSSLv23_server_method
|
||||
#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file
|
||||
#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file
|
||||
#define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list
|
||||
|
@ -115,11 +122,13 @@
|
|||
#define RAND_write_file yaRAND_write_file
|
||||
#define RAND_load_file yaRAND_load_file
|
||||
#define RAND_status yaRAND_status
|
||||
#define RAND_bytes yaRAND_bytes
|
||||
#define DES_set_key yaDES_set_key
|
||||
#define DES_set_odd_parity yaDES_set_odd_parity
|
||||
#define DES_ecb_encrypt yaDES_ecb_encrypt
|
||||
#define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata
|
||||
#define SSL_SESSION_free yaSSL_SESSION_free
|
||||
#define SSL_peek yaSSL_peek
|
||||
#define SSL_get_certificate yaSSL_get_certificate
|
||||
#define SSL_get_privatekey yaSSL_get_privatekey
|
||||
#define X509_get_pubkey yaX509_get_pubkey
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "runtime.hpp"
|
||||
#include "misc.hpp"
|
||||
|
||||
|
||||
#if !defined(YASSL_MYSQL_COMPATIBLE)
|
||||
extern "C" {
|
||||
|
||||
// for libcurl configure test, these are the signatures they use
|
||||
|
@ -37,6 +37,7 @@ extern "C" {
|
|||
char CRYPTO_lock() { return 0;}
|
||||
char CRYPTO_add_lock() { return 0;}
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#ifdef YASSL_PURE_C
|
||||
|
||||
|
|
8
heap/CMakeLists.txt
Executable file
8
heap/CMakeLists.txt
Executable file
|
@ -0,0 +1,8 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_LIBRARY(heap _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create.c
|
||||
hp_delete.c hp_extra.c hp_hash.c hp_info.c hp_open.c hp_panic.c
|
||||
hp_rename.c hp_rfirst.c hp_rkey.c hp_rlast.c hp_rnext.c hp_rprev.c
|
||||
hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)
|
|
@ -165,7 +165,6 @@ struct st_mysql_options {
|
|||
char *ssl_ca; /* PEM CA file */
|
||||
char *ssl_capath; /* PEM directory of CA-s? */
|
||||
char *ssl_cipher; /* cipher to use */
|
||||
my_bool ssl_verify_server_cert; /* if to verify server cert */
|
||||
char *shared_memory_base_name;
|
||||
unsigned long max_allowed_packet;
|
||||
my_bool use_ssl; /* if to use SSL or not */
|
||||
|
|
|
@ -138,8 +138,10 @@ enum enum_server_command
|
|||
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
|
||||
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
|
||||
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
|
||||
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
|
||||
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
|
||||
#define CLIENT_MULTI_STATEMENTS (((ulong) 1) << 16) /* Enable/disable multi-stmt support */
|
||||
#define CLIENT_MULTI_RESULTS (((ulong) 1) << 17) /* Enable/disable multi-results */
|
||||
|
||||
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
|
||||
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
|
||||
|
||||
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
|
||||
|
|
35
innobase/CMakeLists.txt
Executable file
35
innobase/CMakeLists.txt
Executable file
|
@ -0,0 +1,35 @@
|
|||
#SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
|
||||
#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
|
||||
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include include)
|
||||
ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
|
||||
buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
|
||||
data/data0data.c data/data0type.c
|
||||
dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c
|
||||
dyn/dyn0dyn.c
|
||||
eval/eval0eval.c eval/eval0proc.c
|
||||
fil/fil0fil.c
|
||||
fsp/fsp0fsp.c
|
||||
fut/fut0fut.c fut/fut0lst.c
|
||||
ha/ha0ha.c ha/hash0hash.c
|
||||
ibuf/ibuf0ibuf.c
|
||||
pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c
|
||||
lock/lock0lock.c
|
||||
log/log0log.c log/log0recv.c
|
||||
mach/mach0data.c
|
||||
mem/mem0mem.c mem/mem0pool.c
|
||||
mtr/mtr0log.c mtr/mtr0mtr.c
|
||||
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
|
||||
page/page0cur.c page/page0page.c
|
||||
que/que0que.c
|
||||
read/read0read.c
|
||||
rem/rem0cmp.c rem/rem0rec.c
|
||||
row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c
|
||||
row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
|
||||
srv/srv0que.c srv/srv0srv.c srv/srv0start.c
|
||||
sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
|
||||
thr/thr0loc.c
|
||||
trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c
|
||||
usr/usr0sess.c
|
||||
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c )
|
26
myisam/CMakeLists.txt
Executable file
26
myisam/CMakeLists.txt
Executable file
|
@ -0,0 +1,26 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
|
||||
ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
|
||||
mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
|
||||
mi_delete_all.c mi_delete_table.c mi_dynrec.c mi_extra.c mi_info.c
|
||||
mi_key.c mi_keycache.c mi_locking.c mi_log.c mi_open.c
|
||||
mi_packrec.c mi_page.c mi_panic.c mi_preload.c mi_range.c mi_rename.c
|
||||
mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
|
||||
mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
|
||||
mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
|
||||
rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
|
||||
|
||||
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
|
||||
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
|
||||
|
||||
ADD_EXECUTABLE(myisamchk myisamchk.c)
|
||||
TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
|
||||
|
||||
ADD_EXECUTABLE(myisamlog myisamlog.c)
|
||||
TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
|
||||
|
||||
ADD_EXECUTABLE(myisampack myisampack.c)
|
||||
TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)
|
9
myisammrg/CMakeLists.txt
Executable file
9
myisammrg/CMakeLists.txt
Executable file
|
@ -0,0 +1,9 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_LIBRARY(myisammrg myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
|
||||
myrg_locking.c myrg_open.c myrg_panic.c myrg_queue.c myrg_range.c
|
||||
myrg_rfirst.c myrg_rkey.c myrg_rlast.c myrg_rnext.c myrg_rnext_same.c
|
||||
myrg_rprev.c myrg_rrnd.c myrg_rsame.c myrg_static.c myrg_update.c
|
||||
myrg_write.c)
|
|
@ -24,7 +24,7 @@ benchdir_root= $(prefix)
|
|||
testdir = $(benchdir_root)/mysql-test
|
||||
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
|
||||
EXTRA_DIST = $(EXTRA_SCRIPTS)
|
||||
GENSCRIPTS = mysql-test-run install_test_db
|
||||
GENSCRIPTS = mysql-test-run install_test_db mtr
|
||||
PRESCRIPTS = mysql-test-run.pl
|
||||
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
|
||||
test_DATA = std_data/client-key.pem std_data/client-cert.pem \
|
||||
|
@ -113,6 +113,10 @@ install-data-local:
|
|||
uninstall-local:
|
||||
@RM@ -f -r $(DESTDIR)$(testdir)
|
||||
|
||||
# mtr - a shortcut for executing mysql-test-run.pl
|
||||
mtr:
|
||||
$(RM) -f mtr
|
||||
$(LN_S) mysql-test-run.pl mtr
|
||||
|
||||
SUFFIXES = .sh
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ sub collect_test_cases ($) {
|
|||
|
||||
if ( $mysqld_test_exists and $im_test_exists )
|
||||
{
|
||||
mtr_error("Ambiguos test case name ($tname)");
|
||||
mtr_error("Ambiguous test case name ($tname)");
|
||||
}
|
||||
elsif ( ! $mysqld_test_exists and ! $im_test_exists )
|
||||
{
|
||||
|
@ -157,34 +157,38 @@ sub collect_test_cases ($) {
|
|||
|
||||
if ( $::opt_reorder )
|
||||
{
|
||||
@$cases = sort {
|
||||
if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
|
||||
{
|
||||
return $a->{'name'} cmp $b->{'name'};
|
||||
}
|
||||
|
||||
if ( $a->{'master_restart'} and $b->{'master_restart'} )
|
||||
{
|
||||
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
|
||||
if ( $cmp == 0 )
|
||||
{
|
||||
return $a->{'name'} cmp $b->{'name'};
|
||||
}
|
||||
else
|
||||
{
|
||||
return $cmp;
|
||||
}
|
||||
}
|
||||
my %sort_criteria;
|
||||
my $tinfo;
|
||||
|
||||
if ( $a->{'master_restart'} )
|
||||
{
|
||||
return 1; # Is greater
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1; # Is less
|
||||
}
|
||||
} @$cases;
|
||||
# Make a mapping of test name to a string that represents how that test
|
||||
# should be sorted among the other tests. Put the most important criterion
|
||||
# first, then a sub-criterion, then sub-sub-criterion, et c.
|
||||
foreach $tinfo (@$cases)
|
||||
{
|
||||
my @this_criteria = ();
|
||||
|
||||
# Append the criteria for sorting, in order of importance.
|
||||
push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled
|
||||
push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
|
||||
push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
|
||||
push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0"));
|
||||
push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME?
|
||||
push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name
|
||||
|
||||
$sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria);
|
||||
}
|
||||
|
||||
@$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases;
|
||||
|
||||
### For debugging the sort-order
|
||||
# foreach $tinfo (@$cases)
|
||||
# {
|
||||
# print $sort_criteria{$tinfo->{"name"}};
|
||||
# print " -> \t";
|
||||
# print $tinfo->{"name"};
|
||||
# print "\n";
|
||||
# }
|
||||
}
|
||||
|
||||
return $cases;
|
||||
|
@ -469,14 +473,6 @@ sub collect_one_test_case($$$$$$$) {
|
|||
{
|
||||
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
|
||||
|
||||
if ( ! $tinfo->{'innodb_test'} )
|
||||
{
|
||||
# mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
|
||||
# FIXME activate the --skip-innodb only when running with
|
||||
# selected test cases
|
||||
# push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
|
||||
}
|
||||
|
||||
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
|
|
|
@ -139,6 +139,8 @@ sub mtr_copy_dir($$) {
|
|||
my $from_dir= shift;
|
||||
my $to_dir= shift;
|
||||
|
||||
# mtr_verbose("Copying from $from_dir to $to_dir");
|
||||
|
||||
mkpath("$to_dir");
|
||||
opendir(DIR, "$from_dir")
|
||||
or mtr_error("Can't find $from_dir$!");
|
||||
|
|
|
@ -115,6 +115,8 @@ sub spawn_impl ($$$$$$$$) {
|
|||
my $pid_file= shift; # FIXME
|
||||
my $spawn_opts= shift;
|
||||
|
||||
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
|
||||
|
||||
if ( $::opt_script_debug )
|
||||
{
|
||||
print STDERR "\n";
|
||||
|
@ -702,7 +704,7 @@ sub mtr_check_stop_servers ($) {
|
|||
}
|
||||
else
|
||||
{
|
||||
mtr_verbose("All ports where free, continuing");
|
||||
mtr_verbose("All ports were free, continuing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -975,6 +977,7 @@ sub check_expected_crash_and_restart($)
|
|||
|
||||
sub mtr_record_dead_children () {
|
||||
|
||||
my $process_died= 0;
|
||||
my $ret_pid;
|
||||
|
||||
# Wait without blockinng to see if any processes had died
|
||||
|
@ -983,7 +986,9 @@ sub mtr_record_dead_children () {
|
|||
{
|
||||
mtr_warning("mtr_record_dead_children: $ret_pid");
|
||||
mark_process_dead($ret_pid);
|
||||
$process_died= 1;
|
||||
}
|
||||
return $process_died;
|
||||
}
|
||||
|
||||
sub start_reap_all {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -446,52 +446,6 @@ INSERT INTO t1 VALUES(1, 1);
|
|||
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
|
||||
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
`a` int(11) default NULL,
|
||||
`c` int(11) default NULL,
|
||||
PRIMARY KEY (`k`),
|
||||
UNIQUE KEY `idx_1` (`a`)
|
||||
) ENGINE=InnoDB;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
2
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 NULL
|
||||
2 7 NULL
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 1
|
||||
2 7 NULL
|
||||
insert ignore into t2 values (null,6,1),(10,8,1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
11
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 1
|
||||
2 7 NULL
|
||||
10 8 1
|
||||
11 15 1
|
||||
12 20 1
|
||||
drop table t2;
|
||||
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
|
||||
insert into t1 values(null,1,1,now());
|
||||
insert into t1 values(null,0,0,null);
|
||||
|
|
|
@ -248,3 +248,14 @@ select rpad(c1,3,'
|
|||
rpad(c1,3,'ö') rpad('ö',3,c1)
|
||||
ßöö ößß
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(1) CHARACTER SET cp1251 DEFAULT '˙'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||
ERROR 42000: Invalid default value for 'a'
|
||||
End of 4.1 tests
|
||||
|
|
|
@ -730,6 +730,45 @@ id MIN(s)
|
|||
1 ZZZ
|
||||
2 ZZZ
|
||||
DROP TABLE t1;
|
||||
drop table if exists bug20536;
|
||||
set names latin1;
|
||||
create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
varchar(255) character set ucs2 not null);
|
||||
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
select md5(name) from bug20536;
|
||||
md5(name)
|
||||
f4b7ce8b45a20e3c4e84bef515d1525c
|
||||
48d95db0d8305c2fe11548a3635c9385
|
||||
select sha1(name) from bug20536;
|
||||
sha1(name)
|
||||
e0b52f38deddb9f9e8d5336b153592794cb49baf
|
||||
677d4d505355eb5b0549b865fcae4b7f0c28aef5
|
||||
select make_set(3, name, upper(name)) from bug20536;
|
||||
make_set(3, name, upper(name))
|
||||
test1,TEST1
|
||||
'test\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name)) from bug20536;
|
||||
export_set(5, name, upper(name))
|
||||
test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
export_set(5, name, upper(name), ",", 5)
|
||||
test1,TEST1,test1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
|
||||
select password(name) from bug20536;
|
||||
password(name)
|
||||
????????????????????
|
||||
????????????????????
|
||||
select old_password(name) from bug20536;
|
||||
old_password(name)
|
||||
????????
|
||||
????????
|
||||
select quote(name) from bug20536;
|
||||
quote(name)
|
||||
????????
|
||||
????????????????
|
||||
drop table bug20536;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
|
||||
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
|
||||
update t1 set b=a;
|
||||
|
@ -765,3 +804,4 @@ blob 65535 65535
|
|||
text 65535 65535
|
||||
text 65535 32767
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -924,6 +924,37 @@ NULL
|
|||
select ifnull(NULL, _utf8'string');
|
||||
ifnull(NULL, _utf8'string')
|
||||
string
|
||||
set names utf8;
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
|
||||
insert into t1 values ('I'),('K'),('Y');
|
||||
select * from t1 where s1 < 'K' and s1 = 'Y';
|
||||
s1
|
||||
I
|
||||
Y
|
||||
select * from t1 where 'K' > s1 and s1 = 'Y';
|
||||
s1
|
||||
I
|
||||
Y
|
||||
drop table t1;
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
|
||||
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
|
||||
select * from t1 where s1 > 'd' and s1 = 'CH';
|
||||
s1
|
||||
ch
|
||||
CH
|
||||
Ch
|
||||
select * from t1 where 'd' < s1 and s1 = 'CH';
|
||||
s1
|
||||
ch
|
||||
CH
|
||||
Ch
|
||||
select * from t1 where s1 = 'cH' and s1 <> 'ch';
|
||||
s1
|
||||
cH
|
||||
select * from t1 where 'cH' = s1 and s1 <> 'ch';
|
||||
s1
|
||||
cH
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255)) default character set utf8;
|
||||
insert into t1 values (1.0);
|
||||
drop table t1;
|
||||
|
|
|
@ -87,6 +87,10 @@ SELECT IS_USED_LOCK('bug16501');
|
|||
IS_USED_LOCK('bug16501')
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
|
||||
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
|
||||
foo,foo,bar,bar
|
||||
End of 4.1 tests
|
||||
create table t1 as select uuid(), length(uuid());
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -130,3 +134,4 @@ timediff(b, a) >= '00:00:03'
|
|||
drop table t2;
|
||||
drop table t1;
|
||||
set global query_cache_size=default;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -911,6 +911,18 @@ union
|
|||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
|
||||
H
|
||||
5
|
||||
SET NAMES latin1;
|
||||
SET character_set_results = NULL;
|
||||
SHOW VARIABLES LIKE 'character_set_results';
|
||||
Variable_name Value
|
||||
character_set_results
|
||||
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
|
||||
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
|
||||
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
|
||||
fmtddate field2
|
||||
Sep-4 12:00AM abcd
|
||||
DROP TABLE testBug8868;
|
||||
SET NAMES DEFAULT;
|
||||
End of 4.1 tests
|
||||
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
||||
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
|
||||
|
|
|
@ -294,3 +294,4 @@ DROP TABLE t1;
|
|||
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1;
|
|||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
29267
|
||||
623
|
||||
explain select * from t1 where c between 1 and 2500;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL # Using where
|
||||
update t1 set c=a;
|
||||
explain select * from t1 where c between 1 and 2500;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 5 NULL # Using where
|
||||
1 SIMPLE t1 ALL c NULL NULL NULL # Using where
|
||||
drop table t1,t2;
|
||||
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
|
||||
insert into t1 (id) values (null),(null),(null),(null),(null);
|
||||
|
@ -1786,10 +1778,10 @@ Variable_name Value
|
|||
Innodb_rows_deleted 2070
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 31727
|
||||
Innodb_rows_inserted 3083
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 29530
|
||||
Innodb_rows_updated 886
|
||||
show status like "Innodb_row_lock_waits";
|
||||
Variable_name Value
|
||||
Innodb_row_lock_waits 0
|
||||
|
|
|
@ -407,3 +407,71 @@ Warnings:
|
|||
Warning 1071 Specified key was too long; max key length is 765 bytes
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
`a` int(11) default NULL,
|
||||
`c` int(11) default NULL,
|
||||
PRIMARY KEY (`k`),
|
||||
UNIQUE KEY `idx_1` (`a`)
|
||||
) ENGINE=InnoDB;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
2
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 NULL
|
||||
2 7 NULL
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
2
|
||||
select last_insert_id(0);
|
||||
last_insert_id(0)
|
||||
0
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
0
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 2
|
||||
2 7 NULL
|
||||
insert ignore into t2 values (null,6,1),(10,8,1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
0
|
||||
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
11
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 2
|
||||
2 7 NULL
|
||||
10 8 1
|
||||
11 15 1
|
||||
12 20 1
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1, k=last_insert_id(k);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
select * from t2;
|
||||
k a c
|
||||
1 6 3
|
||||
2 7 NULL
|
||||
10 8 1
|
||||
11 15 1
|
||||
12 20 1
|
||||
drop table t2;
|
||||
|
|
|
@ -59,16 +59,16 @@ database()
|
|||
test
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
c_cp932
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
ソ
|
||||
+----------------------+------------+--------+
|
||||
| concat('>',col1,'<') | col2 | col3 |
|
||||
+----------------------+------------+--------+
|
||||
|
|
|
@ -1404,92 +1404,6 @@ UNLOCK TABLES;
|
|||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
DROP TABLE t1;
|
||||
create database db1;
|
||||
use db1;
|
||||
CREATE TABLE t2 (
|
||||
a varchar(30) default NULL,
|
||||
KEY a (a(5))
|
||||
);
|
||||
INSERT INTO t2 VALUES ('alfred');
|
||||
INSERT INTO t2 VALUES ('angie');
|
||||
INSERT INTO t2 VALUES ('bingo');
|
||||
INSERT INTO t2 VALUES ('waffle');
|
||||
INSERT INTO t2 VALUES ('lemon');
|
||||
create view v2 as select * from t2 where a like 'a%' with check option;
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
CREATE TABLE `t2` (
|
||||
`a` varchar(30) DEFAULT NULL,
|
||||
KEY `a` (`a`(5))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t2` WRITE;
|
||||
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
|
||||
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
|
||||
/*!50002 WITH CASCADED CHECK OPTION */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t2;
|
||||
drop view v2;
|
||||
drop database db1;
|
||||
create database db2;
|
||||
use db2;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b varchar(10), primary key(a));
|
||||
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
||||
insert into t1 values (289), (298), (234), (456), (789);
|
||||
create view v1 as select * from t2;
|
||||
create view v2 as select * from t1;
|
||||
drop table t1, t2;
|
||||
drop view v1, v2;
|
||||
drop database db2;
|
||||
create database db1;
|
||||
use db1;
|
||||
show tables;
|
||||
Tables_in_db1
|
||||
t1
|
||||
t2
|
||||
v1
|
||||
v2
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
1 on
|
||||
2 off
|
||||
10 pol
|
||||
12 meg
|
||||
drop table t1, t2;
|
||||
drop database db1;
|
||||
--fields-optionally-enclosed-by="
|
||||
CREATE DATABASE mysqldump_test_db;
|
||||
USE mysqldump_test_db;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
|
@ -1682,6 +1596,7 @@ select * from t1;
|
|||
a b
|
||||
Osnabrück Köln
|
||||
drop table t1;
|
||||
--fields-optionally-enclosed-by="
|
||||
create table `t1` (
|
||||
t1_name varchar(255) default null,
|
||||
t1_id int(10) unsigned not null auto_increment,
|
||||
|
@ -1756,8 +1671,9 @@ CREATE TABLE `t2` (
|
|||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
create table t1 (a int);
|
||||
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
|
||||
mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
|
@ -1771,47 +1687,9 @@ insert into t1 values ('','');
|
|||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` binary(1) DEFAULT NULL,
|
||||
`b` blob
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` binary(1) DEFAULT NULL,
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
@ -1823,6 +1701,95 @@ UNLOCK TABLES;
|
|||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create database db1;
|
||||
use db1;
|
||||
CREATE TABLE t2 (
|
||||
a varchar(30) default NULL,
|
||||
KEY a (a(5))
|
||||
);
|
||||
INSERT INTO t2 VALUES ('alfred');
|
||||
INSERT INTO t2 VALUES ('angie');
|
||||
INSERT INTO t2 VALUES ('bingo');
|
||||
INSERT INTO t2 VALUES ('waffle');
|
||||
INSERT INTO t2 VALUES ('lemon');
|
||||
create view v2 as select * from t2 where a like 'a%' with check option;
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
CREATE TABLE `t2` (
|
||||
`a` varchar(30) DEFAULT NULL,
|
||||
KEY `a` (`a`(5))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t2` WRITE;
|
||||
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
|
||||
INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
|
||||
/*!50002 WITH CASCADED CHECK OPTION */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t2;
|
||||
drop view v2;
|
||||
drop database db1;
|
||||
use test;
|
||||
create database db2;
|
||||
use db2;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b varchar(10), primary key(a));
|
||||
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
||||
insert into t1 values (289), (298), (234), (456), (789);
|
||||
create view v1 as select * from t2;
|
||||
create view v2 as select * from t1;
|
||||
drop table t1, t2;
|
||||
drop view v1, v2;
|
||||
drop database db2;
|
||||
use test;
|
||||
create database db1;
|
||||
use db1;
|
||||
show tables;
|
||||
Tables_in_db1
|
||||
t1
|
||||
t2
|
||||
v1
|
||||
v2
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
1 on
|
||||
2 off
|
||||
10 pol
|
||||
12 meg
|
||||
drop table t1, t2;
|
||||
drop database db1;
|
||||
use test;
|
||||
create table t1(a int);
|
||||
create view v1 as select * from t1;
|
||||
|
||||
|
@ -2605,44 +2572,6 @@ drop view v2;
|
|||
drop view v0;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1(a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
DROP TABLE t1;
|
||||
SET @old_sql_mode = @@SQL_MODE;
|
||||
SET SQL_MODE = IGNORE_SPACE;
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
@ -2698,7 +2627,73 @@ DELIMITER ;
|
|||
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` binary(1) DEFAULT NULL,
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` binary(1) DEFAULT NULL,
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (289), (298), (234), (456), (789);
|
||||
create definer = CURRENT_USER view v1 as select * from t1;
|
||||
|
@ -2925,7 +2920,60 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
|
|||
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
|
||||
drop table t1;
|
||||
drop user mysqltest_1@localhost;
|
||||
create database mysqldump_myDB;
|
||||
use mysqldump_myDB;
|
||||
create user myDB_User;
|
||||
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (3);
|
||||
use mysqldump_myDB;
|
||||
create view v1 (c1) as select * from t1;
|
||||
use mysqldump_myDB;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
|
||||
drop user myDB_User;
|
||||
drop database mysqldump_myDB;
|
||||
use test;
|
||||
End of 5.0 tests
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1(a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
LOCK TABLES `t1` WRITE;
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
DROP TABLE t1;
|
||||
create table t1 (a text , b text);
|
||||
create table t2 (a text , b text);
|
||||
insert t1 values ("Duck, Duck", "goose");
|
||||
|
|
|
@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
|
|||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t2;
|
||||
|
@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
|
|||
`b2` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk2`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
@ -331,7 +331,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
@ -931,7 +931,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a1` int(11) DEFAULT NULL,
|
||||
`a2` blob,
|
||||
`a3` text
|
||||
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
DROP TABLE test.t1;
|
||||
CREATE TABLE test.t1 (a1 INT, a2 BLOB, a3 TEXT) ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
|
@ -950,7 +950,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a1` int(11) DEFAULT NULL,
|
||||
`a2` blob,
|
||||
`a3` text
|
||||
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
DROP TABLE test.t1;
|
||||
CREATE TABLE test.t1 (a1 INT PRIMARY KEY, a2 BLOB, a3 TEXT) TABLESPACE ts STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
|
@ -960,7 +960,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a2` blob,
|
||||
`a3` text,
|
||||
PRIMARY KEY (`a1`)
|
||||
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t1 ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
@ -980,7 +980,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a1` int(11) DEFAULT NULL,
|
||||
`a2` blob,
|
||||
`a3` text
|
||||
) TABLESPACE ts STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t1 ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
|
|
@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a2` varchar(256) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
@ -38,7 +38,7 @@ t2 CREATE TABLE `t2` (
|
|||
`a2` varchar(256) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
|
||||
INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
|
@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
|
|||
`a2` varchar(5000) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
@ -101,7 +101,7 @@ t2 CREATE TABLE `t2` (
|
|||
`a2` varchar(5000) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) TABLESPACE ts2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO test.t1 VALUES (1,@vc1,@d1);
|
||||
INSERT INTO test.t1 VALUES (2,@vc2,@b1);
|
||||
INSERT INTO test.t1 VALUES (3,@vc3,@d2);
|
||||
|
|
|
@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
|
||||
SHOW CREATE TABLE test.t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
|
@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
|
||||
SHOW CREATE TABLE test.t4;
|
||||
Table Create Table
|
||||
t4 CREATE TABLE `t4` (
|
||||
|
@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
|
||||
SHOW CREATE TABLE test.t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
|
@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` (
|
|||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
|
||||
SHOW CREATE TABLE test.t4;
|
||||
Table Create Table
|
||||
t4 CREATE TABLE `t4` (
|
||||
|
|
|
@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` (
|
|||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (0, 0, 0);
|
||||
SELECT * FROM t1;
|
||||
pk1 b c
|
||||
|
|
|
@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
|
|||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t2;
|
||||
|
@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
|
|||
`b2` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk2`)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
|
|
|
@ -1134,12 +1134,12 @@ partition by range (a)
|
|||
subpartition by hash (a)
|
||||
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
|
||||
(SUBPARTITION subpart00, SUBPARTITION subpart01));
|
||||
hello/master-data/test/t1.frm
|
||||
hello/master-data/test/t1.par
|
||||
hello/master-data/test/t1#P#p0#SP#subpart00.MYD
|
||||
hello/master-data/test/t1#P#p0#SP#subpart00.MYI
|
||||
hello/master-data/test/t1#P#p0#SP#subpart01.MYD
|
||||
hello/master-data/test/t1#P#p0#SP#subpart01.MYI
|
||||
hello/master-data/test/t1.frm
|
||||
hello/master-data/test/t1.par
|
||||
hello/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
|
||||
hello/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
|
||||
hello/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
|
||||
|
@ -1149,6 +1149,8 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
|||
(SUBPARTITION subpart10, SUBPARTITION subpart11),
|
||||
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'hello/master-data/tmpdata' INDEX DIRECTORY = 'hello/master-data/tmpinx'
|
||||
(SUBPARTITION subpart20, SUBPARTITION subpart21));
|
||||
hello/master-data/test/t1.frm
|
||||
hello/master-data/test/t1.par
|
||||
hello/master-data/test/t1#P#p1#SP#subpart10.MYD
|
||||
hello/master-data/test/t1#P#p1#SP#subpart10.MYI
|
||||
hello/master-data/test/t1#P#p1#SP#subpart11.MYD
|
||||
|
@ -1157,8 +1159,6 @@ hello/master-data/test/t1#P#p2#SP#subpart20.MYD
|
|||
hello/master-data/test/t1#P#p2#SP#subpart20.MYI
|
||||
hello/master-data/test/t1#P#p2#SP#subpart21.MYD
|
||||
hello/master-data/test/t1#P#p2#SP#subpart21.MYI
|
||||
hello/master-data/test/t1.frm
|
||||
hello/master-data/test/t1.par
|
||||
hello/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
|
||||
hello/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
|
||||
hello/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
|
||||
|
|
|
@ -695,4 +695,19 @@ Level Code Message
|
|||
Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW PLUGINS' instead
|
||||
show plugin;
|
||||
show plugins;
|
||||
create database `mysqlttest\1`;
|
||||
create table `mysqlttest\1`.`a\b` (a int);
|
||||
show tables from `mysqlttest\1`;
|
||||
Tables_in_mysqlttest\1
|
||||
a\b
|
||||
show fields from `mysqlttest\1`.`a\b`;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
show columns from `a\b` from `mysqlttest\1`;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
show keys from `mysqlttest\1`.`a\b`;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
drop table `mysqlttest\1`.`a\b`;
|
||||
drop database `mysqlttest\1`;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -689,6 +689,12 @@ select @@log_queries_not_using_indexes;
|
|||
show variables like 'log_queries_not_using_indexes';
|
||||
Variable_name Value
|
||||
log_queries_not_using_indexes OFF
|
||||
select @@"";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '""' at line 1
|
||||
select @@&;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1
|
||||
select @@@;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1
|
||||
End of 5.0 tests
|
||||
set global binlog_cache_size =@my_binlog_cache_size;
|
||||
set global connect_timeout =@my_connect_timeout;
|
||||
|
|
|
@ -2849,6 +2849,36 @@ SHOW TABLES;
|
|||
Tables_in_test
|
||||
t1
|
||||
DROP TABLE t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
CREATE DATABASE bug21261DB;
|
||||
USE bug21261DB;
|
||||
CREATE TABLE t1 (x INT);
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
|
||||
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
|
||||
CREATE TABLE t2 (y INT);
|
||||
GRANT SELECT ON t2 TO 'user21261'@'localhost';
|
||||
INSERT INTO v1 (x) VALUES (5);
|
||||
UPDATE v1 SET x=1;
|
||||
GRANT SELECT ON v1 TO 'user21261'@'localhost';
|
||||
GRANT SELECT ON t1 TO 'user21261'@'localhost';
|
||||
UPDATE v1,t2 SET x=1 WHERE x=y;
|
||||
SELECT * FROM t1;
|
||||
x
|
||||
1
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
|
||||
DROP USER 'user21261'@'localhost';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug21261DB;
|
||||
USE test;
|
||||
create table t1 (f1 datetime);
|
||||
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
|
||||
show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
|
@ -2887,32 +2917,3 @@ DROP FUNCTION f2;
|
|||
DROP VIEW v1, v2;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
CREATE DATABASE bug21261DB;
|
||||
USE bug21261DB;
|
||||
CREATE TABLE t1 (x INT);
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
|
||||
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
|
||||
CREATE TABLE t2 (y INT);
|
||||
GRANT SELECT ON t2 TO 'user21261'@'localhost';
|
||||
INSERT INTO v1 (x) VALUES (5);
|
||||
UPDATE v1 SET x=1;
|
||||
GRANT SELECT ON v1 TO 'user21261'@'localhost';
|
||||
GRANT SELECT ON t1 TO 'user21261'@'localhost';
|
||||
UPDATE v1,t2 SET x=1 WHERE x=y;
|
||||
SELECT * FROM t1;
|
||||
x
|
||||
1
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
|
||||
DROP USER 'user21261'@'localhost';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug21261DB;
|
||||
USE test;
|
||||
create table t1 (f1 datetime);
|
||||
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
|
||||
show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute))
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -6,3 +6,31 @@ use prn;
|
|||
ERROR 42000: Unknown database 'prn'
|
||||
create table nu (a int);
|
||||
drop table nu;
|
||||
CREATE TABLE `t1` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `t2` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `mt` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
|
||||
UNION=(`t1`,`t2`);
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
ALTER TABLE `t2` RENAME TO `t`;
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
ERROR HY000: Can't lock file (errno: 155)
|
||||
select * from mt;
|
||||
ERROR HY000: Can't lock file (errno: 155)
|
||||
FLUSH TABLES;
|
||||
select * from mt;
|
||||
ERROR HY000: Can't find file: 'mt' (errno: 2)
|
||||
ALTER TABLE `t` RENAME TO `t2`;
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
select * from mt;
|
||||
TIM VAL
|
||||
2006-01-01 00:00:00 0
|
||||
2006-01-01 00:00:00 0
|
||||
|
|
|
@ -304,42 +304,6 @@ INSERT INTO t1 VALUES(1, 1);
|
|||
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
|
||||
# row.
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
`a` int(11) default NULL,
|
||||
`c` int(11) default NULL,
|
||||
PRIMARY KEY (`k`),
|
||||
UNIQUE KEY `idx_1` (`a`)
|
||||
) ENGINE=InnoDB;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
|
||||
# Test of LAST_INSERT_ID() when autogenerated will fail:
|
||||
# last_insert_id() should not change
|
||||
insert ignore into t2 values (null,6,1),(10,8,1);
|
||||
select last_insert_id();
|
||||
# First and second autogenerated will fail, last_insert_id() should
|
||||
# point to third
|
||||
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
|
||||
drop table t2;
|
||||
|
||||
# Test of REPLACE when it does INSERT+DELETE and not UPDATE:
|
||||
# see if it sets LAST_INSERT_ID() ok
|
||||
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
--source include/have_debug.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE t1(a int) engine=innodb;
|
||||
START TRANSACTION;
|
||||
|
|
|
@ -187,4 +187,16 @@ select rpad(c1,3,'
|
|||
#select case c1 when 'ß' then 'ß' when 'ö' then 'ö' else 'c' end from t1;
|
||||
#select export_set(5,c1,'ö'), export_set(5,'ö',c1) from t1;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug 20695: problem with field default value's character set
|
||||
#
|
||||
|
||||
set names koi8r;
|
||||
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error 1067
|
||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
|
|
@ -465,7 +465,51 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
|
|||
SELECT id, MIN(s) FROM t1 GROUP BY id;
|
||||
|
||||
DROP TABLE t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists bug20536;
|
||||
--enable_warnings
|
||||
|
||||
set names latin1;
|
||||
create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
varchar(255) character set ucs2 not null);
|
||||
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
select md5(name) from bug20536;
|
||||
select sha1(name) from bug20536;
|
||||
select make_set(3, name, upper(name)) from bug20536;
|
||||
select export_set(5, name, upper(name)) from bug20536;
|
||||
select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
|
||||
# Some broken functions: add these tests just to document current behavior.
|
||||
|
||||
# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
|
||||
# not be backwards compatible in all cases, so it's best to leave it alone
|
||||
select password(name) from bug20536;
|
||||
select old_password(name) from bug20536;
|
||||
|
||||
# Disable test case as encrypt relies on 'crypt' function.
|
||||
# "decrypt" is noramlly tested in func_crypt.test which have a
|
||||
# "have_crypt.inc" test
|
||||
--disable_parsing
|
||||
# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
|
||||
# doesn't return good results for strings with embedded 0 bytes. It won't be
|
||||
# fixed unless we choose to re-implement the crypt() function ourselves to take
|
||||
# an extra size_t string_length argument.
|
||||
select encrypt(name, 'SALT') from bug20536;
|
||||
--enable_parsing
|
||||
|
||||
# QUOTE doesn't work with UCS2 data. It would require a total rewrite
|
||||
# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
|
||||
# supported fully as a client character set.
|
||||
select quote(name) from bug20536;
|
||||
|
||||
drop table bug20536;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Conversion from an UCS2 string to a decimal column
|
||||
|
@ -497,3 +541,5 @@ create table t1(a blob, b text charset utf8, c text charset ucs2);
|
|||
select data_type, character_octet_length, character_maximum_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -727,6 +727,24 @@ drop table t1;
|
|||
select repeat(_utf8'+',3) as h union select NULL;
|
||||
select ifnull(NULL, _utf8'string');
|
||||
|
||||
#
|
||||
# Bug#9509 Optimizer: wrong result after AND with comparisons
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
|
||||
insert into t1 values ('I'),('K'),('Y');
|
||||
select * from t1 where s1 < 'K' and s1 = 'Y';
|
||||
select * from t1 where 'K' > s1 and s1 = 'Y';
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
|
||||
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
|
||||
select * from t1 where s1 > 'd' and s1 = 'CH';
|
||||
select * from t1 where 'd' < s1 and s1 = 'CH';
|
||||
select * from t1 where s1 = 'cH' and s1 <> 'ch';
|
||||
select * from t1 where 'cH' = s1 and s1 <> 'ch';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#10714: Inserting double value into utf8 column crashes server
|
||||
#
|
||||
|
|
|
@ -31,7 +31,6 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa
|
|||
#rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ
|
||||
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
|
||||
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
|
||||
rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed
|
||||
rpl_sp : BUG#16456 2006-02-16 jmiller
|
||||
rpl_sp_effects : BUG#19862 2006-06-15 mkindahl
|
||||
|
||||
|
|
|
@ -78,7 +78,13 @@ connection default;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
|
||||
#
|
||||
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Test for BUG#9535
|
||||
|
@ -87,7 +93,9 @@ create table t1 as select uuid(), length(uuid());
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6760: Add SLEEP() function
|
||||
#
|
||||
create table t1 (a timestamp default '2005-05-05 01:01:01',
|
||||
b timestamp default '2005-05-05 01:01:01');
|
||||
insert into t1 set a = now();
|
||||
|
@ -117,4 +125,4 @@ drop table t2;
|
|||
drop table t1;
|
||||
set global query_cache_size=default;
|
||||
|
||||
# End of 5.0 tests
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -464,6 +464,24 @@ union
|
|||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
|
||||
|
||||
#
|
||||
# 21913: DATE_FORMAT() Crashes mysql server if I use it through
|
||||
# mysql-connector-j driver.
|
||||
#
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_results = NULL;
|
||||
SHOW VARIABLES LIKE 'character_set_results';
|
||||
|
||||
CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
|
||||
INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
|
||||
|
||||
SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
|
||||
|
||||
DROP TABLE testBug8868;
|
||||
|
||||
SET NAMES DEFAULT;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
|
||||
|
|
|
@ -682,8 +682,6 @@ drop table t2;
|
|||
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
|
||||
# privileged view
|
||||
|
|
|
@ -204,3 +204,4 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
|
|||
INSERT INTO t1 VALUES(NULL),(NULL);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -904,14 +904,6 @@ insert into t2 (a) select b from t1;
|
|||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
insert into t2 (a) select b from t1;
|
||||
insert into t1 (a) select b from t2;
|
||||
select count(*) from t1;
|
||||
--replace_column 9 #
|
||||
explain select * from t1 where c between 1 and 2500;
|
||||
|
|
|
@ -367,3 +367,55 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
|||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
# UPDATE": if the row is updated, it's like a regular UPDATE:
|
||||
# LAST_INSERT_ID() is not affected.
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
`a` int(11) default NULL,
|
||||
`c` int(11) default NULL,
|
||||
PRIMARY KEY (`k`),
|
||||
UNIQUE KEY `idx_1` (`a`)
|
||||
) ENGINE=InnoDB;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
# test again when last_insert_id() is 0 initially
|
||||
select last_insert_id(0);
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1;
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
|
||||
# Test of LAST_INSERT_ID() when autogenerated will fail:
|
||||
# last_insert_id() should not change
|
||||
insert ignore into t2 values (null,6,1),(10,8,1);
|
||||
select last_insert_id();
|
||||
# First and second autogenerated will fail, last_insert_id() should
|
||||
# point to third
|
||||
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
|
||||
# Test of the workaround which enables people to know the id of the
|
||||
# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
|
||||
# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
|
||||
|
||||
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
|
||||
ifnull( c,
|
||||
0 ) + 1, k=last_insert_id(k);
|
||||
select last_insert_id();
|
||||
select * from t2;
|
||||
|
||||
drop table t2;
|
||||
|
|
|
@ -52,8 +52,8 @@ drop table t1;
|
|||
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
|
||||
|
||||
# its usage to switch internally in mysql to requested charset
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set @@session.character_set_client= cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select 'ƒ\'"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
|
||||
|
||||
|
|
|
@ -548,71 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3);
|
|||
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
|
||||
#
|
||||
|
||||
create database db1;
|
||||
use db1;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a varchar(30) default NULL,
|
||||
KEY a (a(5))
|
||||
);
|
||||
|
||||
INSERT INTO t2 VALUES ('alfred');
|
||||
INSERT INTO t2 VALUES ('angie');
|
||||
INSERT INTO t2 VALUES ('bingo');
|
||||
INSERT INTO t2 VALUES ('waffle');
|
||||
INSERT INTO t2 VALUES ('lemon');
|
||||
create view v2 as select * from t2 where a like 'a%' with check option;
|
||||
--exec $MYSQL_DUMP --skip-comments db1
|
||||
drop table t2;
|
||||
drop view v2;
|
||||
drop database db1;
|
||||
|
||||
#
|
||||
# Bug 10713 mysqldump includes database in create view and referenced tables
|
||||
#
|
||||
|
||||
# create table and views in db2
|
||||
create database db2;
|
||||
use db2;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b varchar(10), primary key(a));
|
||||
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
||||
insert into t1 values (289), (298), (234), (456), (789);
|
||||
create view v1 as select * from t2;
|
||||
create view v2 as select * from t1;
|
||||
|
||||
# dump tables and view from db2
|
||||
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||
|
||||
# drop the db, tables and views
|
||||
drop table t1, t2;
|
||||
drop view v1, v2;
|
||||
drop database db2;
|
||||
|
||||
# create db1 and reload dump
|
||||
create database db1;
|
||||
use db1;
|
||||
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||
|
||||
# check that all tables and views could be created
|
||||
show tables;
|
||||
select * from t2 order by a;
|
||||
|
||||
drop table t1, t2;
|
||||
drop database db1;
|
||||
|
||||
#
|
||||
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
|
||||
#
|
||||
|
||||
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
|
||||
|
||||
|
||||
#
|
||||
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
|
||||
#
|
||||
|
@ -719,6 +654,12 @@ select * from t1;
|
|||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
|
||||
#
|
||||
|
||||
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
|
||||
|
||||
#
|
||||
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
|
||||
#
|
||||
|
@ -760,14 +701,74 @@ create table t3(a int);
|
|||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug #13318: Bad result with empty field and --hex-blob
|
||||
#
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
|
||||
# Bug #21288: mysqldump segmentation fault when using --where
|
||||
#
|
||||
create table t1 (a int);
|
||||
--error 2
|
||||
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
|
||||
#
|
||||
|
||||
create database db1;
|
||||
use db1;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a varchar(30) default NULL,
|
||||
KEY a (a(5))
|
||||
);
|
||||
|
||||
INSERT INTO t2 VALUES ('alfred');
|
||||
INSERT INTO t2 VALUES ('angie');
|
||||
INSERT INTO t2 VALUES ('bingo');
|
||||
INSERT INTO t2 VALUES ('waffle');
|
||||
INSERT INTO t2 VALUES ('lemon');
|
||||
create view v2 as select * from t2 where a like 'a%' with check option;
|
||||
--exec $MYSQL_DUMP --skip-comments db1
|
||||
drop table t2;
|
||||
drop view v2;
|
||||
drop database db1;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug 10713 mysqldump includes database in create view and referenced tables
|
||||
#
|
||||
|
||||
# create table and views in db2
|
||||
create database db2;
|
||||
use db2;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b varchar(10), primary key(a));
|
||||
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
|
||||
insert into t1 values (289), (298), (234), (456), (789);
|
||||
create view v1 as select * from t2;
|
||||
create view v2 as select * from t1;
|
||||
|
||||
# dump tables and view from db2
|
||||
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||
|
||||
# drop the db, tables and views
|
||||
drop table t1, t2;
|
||||
drop view v1, v2;
|
||||
drop database db2;
|
||||
use test;
|
||||
|
||||
# create db1 and reload dump
|
||||
create database db1;
|
||||
use db1;
|
||||
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
|
||||
|
||||
# check that all tables and views could be created
|
||||
show tables;
|
||||
select * from t2 order by a;
|
||||
|
||||
drop table t1, t2;
|
||||
drop database db1;
|
||||
use test;
|
||||
|
||||
#
|
||||
# dump of view
|
||||
|
@ -832,6 +833,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
|
|||
|
||||
drop view v1, v2, v3;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for dumping triggers
|
||||
#
|
||||
|
@ -1057,20 +1059,6 @@ drop view v0;
|
|||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
# Check new --replace option
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||
--exec $MYSQL_DUMP --replace --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
|
||||
# for tables with trigger created in the IGNORE_SPACE sql mode.
|
||||
|
@ -1095,7 +1083,14 @@ SET SQL_MODE = @old_sql_mode;
|
|||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
#
|
||||
# Bug #13318: Bad result with empty field and --hex-blob
|
||||
#
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 14871 Invalid view dump output
|
||||
|
@ -1126,7 +1121,6 @@ select * from v3 order by a;
|
|||
drop table t1;
|
||||
drop view v1, v2, v3, v4, v5;
|
||||
|
||||
|
||||
#
|
||||
# Bug #16878 dump of trigger
|
||||
#
|
||||
|
@ -1281,10 +1275,11 @@ use mysqldump_dbb;
|
|||
drop view v1;
|
||||
drop table t1;
|
||||
drop database mysqldump_dbb;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug#21215 mysqldump creating incomplete backups without warning
|
||||
#
|
||||
use test;
|
||||
|
||||
# Create user without sufficient privs to perform the requested operation
|
||||
create user mysqltest_1@localhost;
|
||||
|
@ -1326,8 +1321,52 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
|
|||
drop table t1;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
#
|
||||
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
|
||||
# information_schema database.
|
||||
#
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection root;
|
||||
create database mysqldump_myDB;
|
||||
use mysqldump_myDB;
|
||||
create user myDB_User;
|
||||
grant create view, select on mysqldump_myDB.* to myDB_User@localhost;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (3);
|
||||
|
||||
connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user1;
|
||||
use mysqldump_myDB;
|
||||
create view v1 (c1) as select * from t1;
|
||||
|
||||
# Backup should not fail.
|
||||
--exec $MYSQL_DUMP --all-databases --add-drop-table > $MYSQLTEST_VARDIR/tmp/bug21527.sql
|
||||
|
||||
# Clean up
|
||||
connection root;
|
||||
use mysqldump_myDB;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
|
||||
drop user myDB_User;
|
||||
drop database mysqldump_myDB;
|
||||
use test;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Check new --replace option
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||
--exec $MYSQL_DUMP --replace --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Added for use-thread option
|
||||
#
|
||||
|
|
|
@ -1340,11 +1340,13 @@ subpartition by hash (a)
|
|||
(SUBPARTITION subpart00, SUBPARTITION subpart01));
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
|
||||
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
||||
|
@ -1354,11 +1356,13 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
|||
(SUBPARTITION subpart20, SUBPARTITION subpart21));
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1* || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpdata/t1#* || true
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/tmpinx/t1#* || true
|
||||
|
||||
drop table t1;
|
||||
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
|
||||
|
|
|
@ -24,11 +24,15 @@ PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
|
|||
SHOW CREATE TABLE t1;
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
|
||||
ALTER TABLE t1 COALESCE PARTITION 1;
|
||||
SHOW CREATE TABLE t1;
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1#*
|
||||
--replace_result $MYSQLTEST_VARDIR "hello"
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1.*
|
||||
drop table t1;
|
||||
#
|
||||
# Bug 20767: REORGANIZE partition crashes
|
||||
|
|
|
@ -539,4 +539,17 @@ show plugin;
|
|||
show plugins;
|
||||
--enable_result_log
|
||||
|
||||
#
|
||||
# Bug #19874: SHOW COLUMNS and SHOW KEYS handle identifiers containing
|
||||
# \ incorrectly
|
||||
#
|
||||
create database `mysqlttest\1`;
|
||||
create table `mysqlttest\1`.`a\b` (a int);
|
||||
show tables from `mysqlttest\1`;
|
||||
show fields from `mysqlttest\1`.`a\b`;
|
||||
show columns from `a\b` from `mysqlttest\1`;
|
||||
show keys from `mysqlttest\1`.`a\b`;
|
||||
drop table `mysqlttest\1`.`a\b`;
|
||||
drop database `mysqlttest\1`;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# Windows doesn't support execution of shell scripts (to fix!!)
|
||||
--source include/not_windows.inc
|
||||
|
||||
# check that CSV engine was compiled in, as the test relies on the presence
|
||||
# of the log tables (which are CSV-based)
|
||||
--source include/have_csv.inc
|
||||
|
|
|
@ -585,6 +585,16 @@ show variables like 'ssl%';
|
|||
select @@log_queries_not_using_indexes;
|
||||
show variables like 'log_queries_not_using_indexes';
|
||||
|
||||
#
|
||||
# Bug#20908: Crash if select @@""
|
||||
#
|
||||
--error ER_PARSE_ERROR
|
||||
select @@"";
|
||||
--error ER_PARSE_ERROR
|
||||
select @@&;
|
||||
--error ER_PARSE_ERROR
|
||||
select @@@;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# This is at the very after the versioned tests, since it involves doing
|
||||
|
@ -620,3 +630,4 @@ set global server_id =@my_server_id;
|
|||
set global slow_launch_time =@my_slow_launch_time;
|
||||
set global storage_engine =@my_storage_engine;
|
||||
set global thread_cache_size =@my_thread_cache_size;
|
||||
|
||||
|
|
|
@ -2720,8 +2720,51 @@ DROP VIEW t1,v1;
|
|||
SHOW TABLES;
|
||||
|
||||
DROP TABLE t1;
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug #21261: Wrong access rights was required for an insert to a view
|
||||
#
|
||||
CREATE DATABASE bug21261DB;
|
||||
USE bug21261DB;
|
||||
CONNECT (root,localhost,root,,bug21261DB);
|
||||
CONNECTION root;
|
||||
|
||||
CREATE TABLE t1 (x INT);
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
|
||||
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
|
||||
CREATE TABLE t2 (y INT);
|
||||
GRANT SELECT ON t2 TO 'user21261'@'localhost';
|
||||
|
||||
CONNECT (user21261, localhost, user21261,, bug21261DB);
|
||||
CONNECTION user21261;
|
||||
INSERT INTO v1 (x) VALUES (5);
|
||||
UPDATE v1 SET x=1;
|
||||
CONNECTION root;
|
||||
GRANT SELECT ON v1 TO 'user21261'@'localhost';
|
||||
GRANT SELECT ON t1 TO 'user21261'@'localhost';
|
||||
CONNECTION user21261;
|
||||
UPDATE v1,t2 SET x=1 WHERE x=y;
|
||||
CONNECTION root;
|
||||
SELECT * FROM t1;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
|
||||
DROP USER 'user21261'@'localhost';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug21261DB;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug #15950: NOW() optimized away in VIEWs
|
||||
#
|
||||
create table t1 (f1 datetime);
|
||||
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
|
||||
#
|
||||
|
@ -2797,45 +2840,3 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
# Bug #21261: Wrong access rights was required for an insert to a view
|
||||
#
|
||||
CREATE DATABASE bug21261DB;
|
||||
USE bug21261DB;
|
||||
CONNECT (root,localhost,root,,bug21261DB);
|
||||
CONNECTION root;
|
||||
|
||||
CREATE TABLE t1 (x INT);
|
||||
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
|
||||
GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
|
||||
GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
|
||||
CREATE TABLE t2 (y INT);
|
||||
GRANT SELECT ON t2 TO 'user21261'@'localhost';
|
||||
|
||||
CONNECT (user21261, localhost, user21261,, bug21261DB);
|
||||
CONNECTION user21261;
|
||||
INSERT INTO v1 (x) VALUES (5);
|
||||
UPDATE v1 SET x=1;
|
||||
CONNECTION root;
|
||||
GRANT SELECT ON v1 TO 'user21261'@'localhost';
|
||||
GRANT SELECT ON t1 TO 'user21261'@'localhost';
|
||||
CONNECTION user21261;
|
||||
UPDATE v1,t2 SET x=1 WHERE x=y;
|
||||
CONNECTION root;
|
||||
SELECT * FROM t1;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
|
||||
DROP USER 'user21261'@'localhost';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug21261DB;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug #15950: NOW() optimized away in VIEWs
|
||||
#
|
||||
create table t1 (f1 datetime);
|
||||
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -18,3 +18,42 @@ create table nu (a int);
|
|||
drop table nu;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #20789: Merge Subtable Rename Causes Crash
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `t2` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE `mt` (
|
||||
`TIM` datetime NOT NULL,
|
||||
`VAL` double default NULL
|
||||
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
|
||||
UNION=(`t1`,`t2`);
|
||||
|
||||
# insert into the merge table and thus open it.
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
|
||||
# Alter one of the tables that are part of the merge table
|
||||
ALTER TABLE `t2` RENAME TO `t`;
|
||||
|
||||
# Insert into the merge table that has just been altered
|
||||
--error 1015
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
--error 1015
|
||||
select * from mt;
|
||||
|
||||
FLUSH TABLES;
|
||||
--error 1017
|
||||
select * from mt;
|
||||
|
||||
# Alter one of the tables that are part of the merge table
|
||||
ALTER TABLE `t` RENAME TO `t2`;
|
||||
INSERT INTO mt VALUES ('2006-01-01',0);
|
||||
select * from mt;
|
||||
|
||||
|
|
|
@ -36,48 +36,51 @@
|
|||
|
||||
uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
|
||||
{
|
||||
uint readbytes,save_count;
|
||||
uint readbytes, save_count;
|
||||
DBUG_ENTER("my_read");
|
||||
DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %u MyFlags: %d",
|
||||
Filedes, Buffer, Count, MyFlags));
|
||||
save_count=Count;
|
||||
Filedes, Buffer, Count, MyFlags));
|
||||
save_count= Count;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
errno=0; /* Linux doesn't reset this */
|
||||
if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
|
||||
errno= 0; /* Linux doesn't reset this */
|
||||
if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
|
||||
{
|
||||
my_errno=errno ? errno : -1;
|
||||
my_errno= errno ? errno : -1;
|
||||
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
|
||||
readbytes,Count,Filedes,my_errno));
|
||||
readbytes, Count, Filedes, my_errno));
|
||||
#ifdef THREAD
|
||||
if (readbytes == 0 && errno == EINTR)
|
||||
continue; /* Interrupted */
|
||||
if ((int) readbytes <= 0 && errno == EINTR)
|
||||
{
|
||||
DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
|
||||
continue; /* Interrupted */
|
||||
}
|
||||
#endif
|
||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||
{
|
||||
if ((int) readbytes == -1)
|
||||
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
||||
my_filename(Filedes),my_errno);
|
||||
else if (MyFlags & (MY_NABP | MY_FNABP))
|
||||
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
||||
my_filename(Filedes),my_errno);
|
||||
if ((int) readbytes == -1)
|
||||
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
||||
my_filename(Filedes),my_errno);
|
||||
else if (MyFlags & (MY_NABP | MY_FNABP))
|
||||
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
||||
my_filename(Filedes),my_errno);
|
||||
}
|
||||
if ((int) readbytes == -1 ||
|
||||
((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
|
||||
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
|
||||
((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
|
||||
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
|
||||
if (readbytes > 0 && (MyFlags & MY_FULL_IO))
|
||||
{
|
||||
Buffer+=readbytes;
|
||||
Count-=readbytes;
|
||||
continue;
|
||||
Buffer+= readbytes;
|
||||
Count-= readbytes;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (MyFlags & (MY_NABP | MY_FNABP))
|
||||
readbytes=0; /* Ok on read */
|
||||
readbytes= 0; /* Ok on read */
|
||||
else if (MyFlags & MY_FULL_IO)
|
||||
readbytes=save_count;
|
||||
readbytes= save_count;
|
||||
break;
|
||||
}
|
||||
DBUG_RETURN(readbytes);
|
||||
|
|
18
server-tools/CMakeLists.txt
Executable file
18
server-tools/CMakeLists.txt
Executable file
|
@ -0,0 +1,18 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER)
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql
|
||||
${PROJECT_SOURCE_DIR}/extra/yassl/include)
|
||||
|
||||
ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc
|
||||
instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc
|
||||
mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc
|
||||
thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp
|
||||
user_management_commands.cc
|
||||
../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c
|
||||
../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c
|
||||
../../libmysql/errmsg.c)
|
||||
|
||||
ADD_DEPENDENCIES(mysqlmanager GenError)
|
||||
TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)
|
|
@ -1509,7 +1509,6 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
|
|||
mysql->options.ssl_ca= strdup_if_not_null(ca);
|
||||
mysql->options.ssl_capath= strdup_if_not_null(capath);
|
||||
mysql->options.ssl_cipher= strdup_if_not_null(cipher);
|
||||
mysql->options.ssl_verify_server_cert= FALSE; /* Off by default */
|
||||
#endif /* HAVE_OPENSSL */
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -2198,7 +2197,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
DBUG_PRINT("info", ("IO layer change done!"));
|
||||
|
||||
/* Verify server cert */
|
||||
if (mysql->options.ssl_verify_server_cert &&
|
||||
if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
|
||||
ssl_verify_server_cert(mysql->net.vio, mysql->host))
|
||||
{
|
||||
set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
|
||||
|
@ -2945,7 +2944,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
|
|||
mysql->reconnect= *(my_bool *) arg;
|
||||
break;
|
||||
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
|
||||
mysql->options.ssl_verify_server_cert= *(my_bool *) arg;
|
||||
if (!arg || test(*(uint*) arg))
|
||||
mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
|
||||
else
|
||||
mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
|
||||
break;
|
||||
default:
|
||||
DBUG_RETURN(1);
|
||||
|
|
11
sql/examples/CMakeLists.txt
Executable file
11
sql/examples/CMakeLists.txt
Executable file
|
@ -0,0 +1,11 @@
|
|||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/include
|
||||
${CMAKE_SOURCE_DIR}/regex)
|
||||
|
||||
IF(WITH_EXAMPLE_STORAGE_ENGINE)
|
||||
ADD_LIBRARY(example ha_example.cc)
|
||||
ADD_DEPENDENCIES(example GenError)
|
||||
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
|
|
@ -442,13 +442,17 @@ int main(int argc,char **argv)
|
|||
if (get_options(argc,(char **) argv))
|
||||
exit(1);
|
||||
|
||||
/* Broken up to indicate that it's not advice to you, gentle reader. */
|
||||
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
|
||||
|
||||
printf("/* Copyright (C) 2001-2004 MySQL AB\n\
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
|
||||
and you are welcome to modify and redistribute it under the GPL license\n\
|
||||
\n*/\n\n");
|
||||
|
||||
printf("/* This code is generated by gen_lex_hash.cc that seeks for\
|
||||
a perfect\nhash function */\n\n");
|
||||
/* Broken up to indicate that it's not advice to you, gentle reader. */
|
||||
printf("/* Do " "not " "edit " "this " "file! This is generated by "
|
||||
"gen_lex_hash.cc\nthat seeks for a perfect hash function */\n\n");
|
||||
printf("#include \"lex.h\"\n\n");
|
||||
|
||||
calc_length();
|
||||
|
@ -468,6 +472,14 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
|
|||
{\n\
|
||||
register uchar *hash_map;\n\
|
||||
register const char *cur_str= s;\n\
|
||||
\n\
|
||||
if (len == 0) {\n\
|
||||
DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\
|
||||
return(NULL);\n\
|
||||
}\n"
|
||||
);
|
||||
|
||||
printf("\
|
||||
if (function){\n\
|
||||
if (len>sql_functions_max_len) return 0;\n\
|
||||
hash_map= sql_functions_map;\n\
|
||||
|
@ -498,7 +510,10 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
|
|||
cur_struct= uint4korr(hash_map+\n\
|
||||
(((uint16)cur_struct + cur_char - first_char)*4));\n\
|
||||
cur_str++;\n\
|
||||
}\n\
|
||||
}\n"
|
||||
);
|
||||
|
||||
printf("\
|
||||
}else{\n\
|
||||
if (len>symbols_max_len) return 0;\n\
|
||||
hash_map= symbols_map;\n\
|
||||
|
|
|
@ -3567,7 +3567,7 @@ int handler::ha_external_lock(THD *thd, int lock_type)
|
|||
int handler::ha_reset()
|
||||
{
|
||||
DBUG_ENTER("ha_reset");
|
||||
/* Check that we have called all proper delallocation functions */
|
||||
/* Check that we have called all proper deallocation functions */
|
||||
DBUG_ASSERT((byte*) table->def_read_set.bitmap +
|
||||
table->s->column_bitmap_size ==
|
||||
(byte*) table->def_write_set.bitmap);
|
||||
|
|
|
@ -124,6 +124,7 @@ String *Item_func_md5::val_str(String *str)
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String * sptr= args[0]->val_str(str);
|
||||
str->set_charset(&my_charset_bin);
|
||||
if (sptr)
|
||||
{
|
||||
my_MD5_CTX context;
|
||||
|
@ -170,6 +171,7 @@ String *Item_func_sha::val_str(String *str)
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String * sptr= args[0]->val_str(str);
|
||||
str->set_charset(&my_charset_bin);
|
||||
if (sptr) /* If we got value different from NULL */
|
||||
{
|
||||
SHA1_CONTEXT context; /* Context used to generate SHA1 hash */
|
||||
|
@ -1605,7 +1607,7 @@ String *Item_func_encrypt::val_str(String *str)
|
|||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
str->set(tmp,(uint) strlen(tmp),res->charset());
|
||||
str->set(tmp, (uint) strlen(tmp), &my_charset_bin);
|
||||
str->copy();
|
||||
pthread_mutex_unlock(&LOCK_crypt);
|
||||
return str;
|
||||
|
@ -2041,7 +2043,7 @@ String *Item_func_make_set::val_str(String *str)
|
|||
return &my_empty_string;
|
||||
result= &tmp_str;
|
||||
}
|
||||
if (tmp_str.append(',') || tmp_str.append(*res))
|
||||
if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
|
||||
return &my_empty_string;
|
||||
}
|
||||
}
|
||||
|
@ -2719,8 +2721,12 @@ String* Item_func_export_set::val_str(String* str)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
sep_buf.set(STRING_WITH_LEN(","), default_charset());
|
||||
sep = &sep_buf;
|
||||
{
|
||||
/* errors is not checked - assume "," can always be converted */
|
||||
uint errors;
|
||||
sep_buf.copy(STRING_WITH_LEN(","), &my_charset_bin, collation.collation, &errors);
|
||||
sep = &sep_buf;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0); // cannot happen
|
||||
|
|
|
@ -43,7 +43,10 @@ class Item_func_md5 :public Item_str_func
|
|||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_md5(Item *a) :Item_str_func(a) {}
|
||||
Item_func_md5(Item *a) :Item_str_func(a)
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "md5"; }
|
||||
|
@ -54,7 +57,10 @@ public:
|
|||
class Item_func_sha :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_sha(Item *a) :Item_str_func(a) {}
|
||||
Item_func_sha(Item *a) :Item_str_func(a)
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "sha"; }
|
||||
|
@ -333,9 +339,21 @@ public:
|
|||
class Item_func_encrypt :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
|
||||
/* Encapsulate common constructor actions */
|
||||
void constructor_helper()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
public:
|
||||
Item_func_encrypt(Item *a) :Item_str_func(a) {}
|
||||
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
||||
Item_func_encrypt(Item *a) :Item_str_func(a)
|
||||
{
|
||||
constructor_helper();
|
||||
}
|
||||
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b)
|
||||
{
|
||||
constructor_helper();
|
||||
}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
|
||||
const char *func_name() const { return "encrypt"; }
|
||||
|
|
|
@ -326,8 +326,6 @@ static char *my_bind_addr_str;
|
|||
static char *default_collation_name;
|
||||
static char *default_storage_engine_str;
|
||||
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
|
||||
static char mysql_data_home_buff[2];
|
||||
static struct passwd *user_info;
|
||||
static I_List<THD> thread_cache;
|
||||
|
||||
static pthread_cond_t COND_thread_cache, COND_flush_thread_cache;
|
||||
|
@ -508,7 +506,8 @@ key_map key_map_full(0); // Will be initialized later
|
|||
|
||||
const char *opt_date_time_formats[3];
|
||||
|
||||
char *mysql_data_home= mysql_real_data_home;
|
||||
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
|
||||
struct passwd *user_info;
|
||||
char server_version[SERVER_VERSION_LENGTH];
|
||||
char *mysqld_unix_port, *opt_mysql_tmpdir;
|
||||
const char **errmesg; /* Error messages */
|
||||
|
@ -6215,7 +6214,7 @@ The minimum value for this variable is 4096.",
|
|||
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
|
||||
(gptr*) &global_system_variables.tmp_table_size,
|
||||
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 32*1024*1024L, 1024, ~0L, 0, 1, 0},
|
||||
REQUIRED_ARG, 16*1024*1024L, 1024, ~0L, 0, 1, 0}, /* See max_heap_table_size . */
|
||||
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
|
||||
"Allocation block size for transactions to be stored in binary log",
|
||||
(gptr*) &global_system_variables.trans_alloc_block_size,
|
||||
|
@ -7592,10 +7591,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
}
|
||||
switch (method-1) {
|
||||
case 0:
|
||||
method_conv= MI_STATS_METHOD_NULLS_EQUAL;
|
||||
method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
|
||||
break;
|
||||
case 1:
|
||||
method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
|
||||
method_conv= MI_STATS_METHOD_NULLS_EQUAL;
|
||||
break;
|
||||
case 2:
|
||||
method_conv= MI_STATS_METHOD_IGNORE_NULLS;
|
||||
|
|
|
@ -859,7 +859,7 @@ my_real_read(NET *net, ulong *complen)
|
|||
#endif /* EXTRA_DEBUG */
|
||||
}
|
||||
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
|
||||
if (vio_should_retry(net->vio))
|
||||
if (vio_errno(net->vio) == SOCKET_EINTR)
|
||||
{
|
||||
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
|
||||
continue;
|
||||
|
|
|
@ -5379,14 +5379,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (user_name->host.length > HOSTNAME_LENGTH ||
|
||||
user_name->user.length > USERNAME_LENGTH)
|
||||
{
|
||||
append_user(&wrong_users, user_name);
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
Search all in-memory structures and grant tables
|
||||
for a mention of the new user name.
|
||||
|
@ -5579,8 +5571,6 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
}
|
||||
if (!find_acl_user(lex_user->host.str, lex_user->user.str, TRUE))
|
||||
{
|
||||
sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' does not "
|
||||
"exists", lex_user->user.str, lex_user->host.str);
|
||||
result= -1;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1145,16 +1145,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||
}
|
||||
info->updated++;
|
||||
/*
|
||||
If ON DUP KEY UPDATE updates a row instead of inserting one, and
|
||||
there is an auto_increment column, then SELECT LAST_INSERT_ID()
|
||||
returns the id of the updated row:
|
||||
If ON DUP KEY UPDATE updates a row instead of inserting one, it's
|
||||
like a regular UPDATE statement: it should not affect the value of a
|
||||
next SELECT LAST_INSERT_ID() or mysql_insert_id().
|
||||
Except if LAST_INSERT_ID(#) was in the INSERT query, which is
|
||||
handled separately by THD::arg_of_last_insert_id_function.
|
||||
*/
|
||||
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
|
||||
if (table->next_number_field)
|
||||
{
|
||||
longlong field_val= table->next_number_field->val_int();
|
||||
thd->record_first_successful_insert_id_in_cur_stmt(field_val);
|
||||
table->file->adjust_next_insert_id_after_explicit_value(field_val);
|
||||
}
|
||||
table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
|
||||
trg_error= (table->triggers &&
|
||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||
TRG_ACTION_AFTER, TRUE));
|
||||
|
|
|
@ -663,8 +663,9 @@ int MYSQLlex(void *arg, void *yythd)
|
|||
*/
|
||||
|
||||
if ((yylval->lex_str.str[0]=='_') &&
|
||||
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1,
|
||||
MY_CS_PRIMARY,MYF(0))))
|
||||
(lex->underscore_charset=
|
||||
get_charset_by_csname(yylval->lex_str.str + 1,
|
||||
MY_CS_PRIMARY,MYF(0))))
|
||||
return(UNDERSCORE_CHARSET);
|
||||
return(result_state); // IDENT or IDENT_QUOTED
|
||||
|
||||
|
@ -1047,6 +1048,8 @@ int MYSQLlex(void *arg, void *yythd)
|
|||
if (c == '.')
|
||||
lex->next_state=MY_LEX_IDENT_SEP;
|
||||
length= (uint) (lex->ptr - lex->tok_start)-1;
|
||||
if (length == 0)
|
||||
return(ABORT_SYM); // Names must be nonempty.
|
||||
if ((tokval= find_keyword(lex,length,0)))
|
||||
{
|
||||
yyUnget(); // Put back 'c'
|
||||
|
|
|
@ -895,7 +895,7 @@ typedef struct st_lex : public Query_tables_list
|
|||
XID *xid;
|
||||
gptr yacc_yyss,yacc_yyvs;
|
||||
THD *thd;
|
||||
CHARSET_INFO *charset;
|
||||
CHARSET_INFO *charset, *underscore_charset;
|
||||
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
||||
TABLE_LIST *leaf_tables_insert;
|
||||
/* Position (first character index) of SELECT of CREATE VIEW statement */
|
||||
|
|
|
@ -67,7 +67,6 @@ static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
|
|||
static void decrease_user_connections(USER_CONN *uc);
|
||||
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
|
||||
static bool check_multi_update_lock(THD *thd);
|
||||
static void remove_escape(char *name);
|
||||
static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
|
||||
|
||||
const char *any_db="*any*"; // Special symbol for check_access
|
||||
|
@ -1442,7 +1441,6 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name)
|
|||
}
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(files_charset_info, tbl_name);
|
||||
remove_escape(table_list->table_name);
|
||||
|
||||
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT)))
|
||||
DBUG_RETURN(1);
|
||||
|
@ -1909,7 +1907,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
general_log_print(thd, command, "%s %s", table_list.table_name, fields);
|
||||
if (lower_case_table_names)
|
||||
my_casedn_str(files_charset_info, table_list.table_name);
|
||||
remove_escape(table_list.table_name); // This can't have wildcards
|
||||
|
||||
if (check_access(thd,SELECT_ACL,table_list.db,&table_list.grant.privilege,
|
||||
0, 0, test(table_list.schema_table)))
|
||||
|
@ -2299,7 +2296,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
|
|||
DBUG_RETURN(1);
|
||||
}
|
||||
db= lex->select_lex.db;
|
||||
remove_escape(db); // Fix escaped '_'
|
||||
if (check_db_name(db))
|
||||
{
|
||||
my_error(ER_WRONG_DB_NAME, MYF(0), db);
|
||||
|
@ -2338,8 +2334,6 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
|
|||
lex->query_tables_last= query_tables_last;
|
||||
TABLE_LIST *table_list= (TABLE_LIST*) sel->table_list.first;
|
||||
char *db= table_list->db;
|
||||
remove_escape(db); // Fix escaped '_'
|
||||
remove_escape(table_list->table_name);
|
||||
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,
|
||||
&table_list->grant.privilege, 0, 0,
|
||||
test(table_list->schema_table)))
|
||||
|
@ -6288,36 +6282,6 @@ add_proc_to_list(THD* thd, Item *item)
|
|||
}
|
||||
|
||||
|
||||
/* Fix escaping of _, % and \ in database and table names (for ODBC) */
|
||||
|
||||
static void remove_escape(char *name)
|
||||
{
|
||||
if (!*name) // For empty DB names
|
||||
return;
|
||||
char *to;
|
||||
#ifdef USE_MB
|
||||
char *strend=name+(uint) strlen(name);
|
||||
#endif
|
||||
for (to=name; *name ; name++)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
int l;
|
||||
if (use_mb(system_charset_info) &&
|
||||
(l = my_ismbchar(system_charset_info, name, strend)))
|
||||
{
|
||||
while (l--)
|
||||
*to++ = *name++;
|
||||
name--;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (*name == '\\' && name[1])
|
||||
name++; // Skip '\\'
|
||||
*to++= *name;
|
||||
}
|
||||
*to=0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** save order by and tables in own lists
|
||||
****************************************************************************/
|
||||
|
|
|
@ -1916,7 +1916,8 @@ void mysql_stmt_prepare(THD *thd, const char *packet, uint packet_length)
|
|||
thd->stmt_map.erase(stmt);
|
||||
}
|
||||
else
|
||||
general_log_print(thd, COM_STMT_PREPARE, "[%lu] %s", stmt->id, packet);
|
||||
general_log_print(thd, COM_STMT_PREPARE, "[%lu] %.*b", stmt->id,
|
||||
stmt->query_length, stmt->query);
|
||||
|
||||
/* check_prepared_statemnt sends the metadata packet in case of success */
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2291,7 +2292,8 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
|
|||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
||||
if (error == 0)
|
||||
general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %s", stmt->id, thd->query);
|
||||
general_log_print(thd, COM_STMT_EXECUTE, "[%lu] %.*b", stmt->id,
|
||||
thd->query_length, thd->query);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
|
|
|
@ -7268,6 +7268,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
|||
left_item->collation.collation == value->collation.collation))
|
||||
{
|
||||
Item *tmp=value->new_item();
|
||||
tmp->collation.set(right_item->collation);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
thd->change_item_tree(args + 1, tmp);
|
||||
|
@ -7290,6 +7292,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
|||
right_item->collation.collation == value->collation.collation))
|
||||
{
|
||||
Item *tmp=value->new_item();
|
||||
tmp->collation.set(left_item->collation);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
thd->change_item_tree(args, tmp);
|
||||
|
|
|
@ -1228,9 +1228,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
store_key_options(thd, packet, table, key_info);
|
||||
if (key_info->parser)
|
||||
{
|
||||
packet->append(" WITH PARSER ", 13);
|
||||
packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER "));
|
||||
append_identifier(thd, packet, key_info->parser->name.str,
|
||||
key_info->parser->name.length);
|
||||
packet->append(STRING_WITH_LEN(" */ "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,9 +1257,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
|
||||
if ((for_str= file->get_tablespace_name(thd)))
|
||||
{
|
||||
packet->append(" TABLESPACE ");
|
||||
packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE "));
|
||||
packet->append(for_str, strlen(for_str));
|
||||
packet->append(" STORAGE DISK");
|
||||
packet->append(STRING_WITH_LEN(" STORAGE DISK */"));
|
||||
my_free(for_str, MYF(0));
|
||||
}
|
||||
|
||||
|
@ -1297,7 +1298,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||
|
||||
if(create_info.auto_increment_value > 1)
|
||||
{
|
||||
packet->append(" AUTO_INCREMENT=", 16);
|
||||
packet->append(STRING_WITH_LEN(" AUTO_INCREMENT="));
|
||||
end= longlong10_to_str(create_info.auto_increment_value, buff,10);
|
||||
packet->append(buff, (uint) (end - buff));
|
||||
}
|
||||
|
|
|
@ -238,6 +238,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
|||
0 No conversion needed
|
||||
1 Either character set conversion or adding leading zeros
|
||||
(e.g. for UCS-2) must be done
|
||||
|
||||
NOTE
|
||||
to_cs may be NULL for "no conversion" if the system variable
|
||||
character_set_results is NULL.
|
||||
*/
|
||||
|
||||
bool String::needs_conversion(uint32 arg_length,
|
||||
|
@ -246,7 +250,8 @@ bool String::needs_conversion(uint32 arg_length,
|
|||
uint32 *offset)
|
||||
{
|
||||
*offset= 0;
|
||||
if ((to_cs == &my_charset_bin) ||
|
||||
if (!to_cs ||
|
||||
(to_cs == &my_charset_bin) ||
|
||||
(to_cs == from_cs) ||
|
||||
my_charset_same(from_cs, to_cs) ||
|
||||
((from_cs == &my_charset_bin) &&
|
||||
|
|
|
@ -2224,6 +2224,40 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
Convert the default value from client character
|
||||
set into the column character set if necessary.
|
||||
*/
|
||||
if (sql_field->def &&
|
||||
save_cs != sql_field->def->collation.collation &&
|
||||
(sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
|
||||
sql_field->sql_type == FIELD_TYPE_STRING ||
|
||||
sql_field->sql_type == FIELD_TYPE_SET ||
|
||||
sql_field->sql_type == FIELD_TYPE_ENUM))
|
||||
{
|
||||
Query_arena backup_arena;
|
||||
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
||||
if (need_to_change_arena)
|
||||
{
|
||||
/* Asser that we don't do that at every PS execute */
|
||||
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
|
||||
thd->stmt_arena->is_first_sp_execute());
|
||||
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
|
||||
}
|
||||
|
||||
sql_field->def= sql_field->def->safe_charset_converter(save_cs);
|
||||
|
||||
if (need_to_change_arena)
|
||||
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
|
||||
|
||||
if (sql_field->def == NULL)
|
||||
{
|
||||
/* Could not convert */
|
||||
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (sql_field->sql_type == FIELD_TYPE_SET ||
|
||||
sql_field->sql_type == FIELD_TYPE_ENUM)
|
||||
{
|
||||
|
@ -2285,35 +2319,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
sql_field->interval_list.empty(); // Don't need interval_list anymore
|
||||
}
|
||||
|
||||
/*
|
||||
Convert the default value from client character
|
||||
set into the column character set if necessary.
|
||||
*/
|
||||
if (sql_field->def && cs != sql_field->def->collation.collation)
|
||||
{
|
||||
Query_arena backup_arena;
|
||||
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
||||
if (need_to_change_arena)
|
||||
{
|
||||
/* Asser that we don't do that at every PS execute */
|
||||
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
|
||||
thd->stmt_arena->is_first_sp_execute());
|
||||
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
|
||||
}
|
||||
|
||||
sql_field->def= sql_field->def->safe_charset_converter(cs);
|
||||
|
||||
if (need_to_change_arena)
|
||||
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
|
||||
|
||||
if (sql_field->def == NULL)
|
||||
{
|
||||
/* Could not convert */
|
||||
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (sql_field->sql_type == FIELD_TYPE_SET)
|
||||
{
|
||||
uint32 field_length;
|
||||
|
|
|
@ -8902,7 +8902,7 @@ text_literal:
|
|||
| NCHAR_STRING
|
||||
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
|
||||
| UNDERSCORE_CHARSET TEXT_STRING
|
||||
{ $$ = new Item_string($2.str,$2.length,Lex->charset); }
|
||||
{ $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
|
||||
| text_literal TEXT_STRING_literal
|
||||
{ ((Item_string*) $1)->append($2.str,$2.length); }
|
||||
;
|
||||
|
@ -8980,7 +8980,7 @@ literal:
|
|||
(String*) 0;
|
||||
$$= new Item_string(str ? str->ptr() : "",
|
||||
str ? str->length() : 0,
|
||||
Lex->charset);
|
||||
Lex->underscore_charset);
|
||||
}
|
||||
| UNDERSCORE_CHARSET BIN_NUM
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#ifdef HAVE_STACKTRACE
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
|
||||
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
|
||||
|
||||
|
@ -44,7 +45,29 @@ void safe_print_str(const char* name, const char* val, int max_len)
|
|||
}
|
||||
|
||||
#ifdef TARGET_OS_LINUX
|
||||
#define SIGRETURN_FRAME_COUNT 2
|
||||
|
||||
#ifdef __i386__
|
||||
#define SIGRETURN_FRAME_OFFSET 17
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define SIGRETURN_FRAME_OFFSET 23
|
||||
#endif
|
||||
|
||||
static my_bool is_nptl;
|
||||
|
||||
/* Check if we are using NPTL or LinuxThreads on Linux */
|
||||
void check_thread_lib(void)
|
||||
{
|
||||
char buf[5];
|
||||
|
||||
#ifdef _CS_GNU_LIBPTHREAD_VERSION
|
||||
confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));
|
||||
is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf));
|
||||
#else
|
||||
is_nptl = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__alpha__) && defined(__GNUC__)
|
||||
/*
|
||||
|
@ -90,7 +113,7 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
|
|||
void print_stacktrace(gptr stack_bottom, ulong thread_stack)
|
||||
{
|
||||
uchar** fp;
|
||||
uint frame_count = 0;
|
||||
uint frame_count = 0, sigreturn_frame_count;
|
||||
#if defined(__alpha__) && defined(__GNUC__)
|
||||
uint32* pc;
|
||||
#endif
|
||||
|
@ -100,28 +123,27 @@ void print_stacktrace(gptr stack_bottom, ulong thread_stack)
|
|||
Attempting backtrace. You can use the following information to find out\n\
|
||||
where mysqld died. If you see no messages after this, something went\n\
|
||||
terribly wrong...\n");
|
||||
#ifdef __i386__
|
||||
#ifdef __i386__
|
||||
__asm __volatile__ ("movl %%ebp,%0"
|
||||
:"=r"(fp)
|
||||
:"r"(fp));
|
||||
if (!fp)
|
||||
{
|
||||
fprintf(stderr, "frame pointer (ebp) is NULL, did you compile with\n\
|
||||
-fomit-frame-pointer? Aborting backtrace!\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef __x86_64__
|
||||
__asm __volatile__ ("movq %%rbp,%0"
|
||||
:"=r"(fp)
|
||||
:"r"(fp));
|
||||
#endif
|
||||
#if defined(__alpha__) && defined(__GNUC__)
|
||||
__asm __volatile__ ("mov $30,%0"
|
||||
:"=r"(fp)
|
||||
:"r"(fp));
|
||||
#endif
|
||||
if (!fp)
|
||||
{
|
||||
fprintf(stderr, "frame pointer (fp) is NULL, did you compile with\n\
|
||||
fprintf(stderr, "frame pointer is NULL, did you compile with\n\
|
||||
-fomit-frame-pointer? Aborting backtrace!\n");
|
||||
return;
|
||||
}
|
||||
#endif /* __alpha__ */
|
||||
|
||||
if (!stack_bottom || (gptr) stack_bottom > (gptr) &fp)
|
||||
{
|
||||
|
@ -151,13 +173,16 @@ terribly wrong...\n");
|
|||
:"r"(pc));
|
||||
#endif /* __alpha__ */
|
||||
|
||||
/* We are 1 frame above signal frame with NPTL and 2 frames above with LT */
|
||||
sigreturn_frame_count = is_nptl ? 1 : 2;
|
||||
|
||||
while (fp < (uchar**) stack_bottom)
|
||||
{
|
||||
#ifdef __i386__
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
uchar** new_fp = (uchar**)*fp;
|
||||
fprintf(stderr, "%p\n", frame_count == SIGRETURN_FRAME_COUNT ?
|
||||
*(fp+17) : *(fp+1));
|
||||
#endif /* __386__ */
|
||||
fprintf(stderr, "%p\n", frame_count == sigreturn_frame_count ?
|
||||
*(fp + SIGRETURN_FRAME_OFFSET) : *(fp + 1));
|
||||
#endif /* defined(__386__) || defined(__x86_64__) */
|
||||
|
||||
#if defined(__alpha__) && defined(__GNUC__)
|
||||
uchar** new_fp = find_prev_fp(pc, fp);
|
||||
|
|
|
@ -19,16 +19,20 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifdef TARGET_OS_LINUX
|
||||
#if defined(HAVE_STACKTRACE) || (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
|
||||
#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
|
||||
#undef HAVE_STACKTRACE
|
||||
#define HAVE_STACKTRACE
|
||||
|
||||
extern char* __bss_start;
|
||||
extern char* heap_start;
|
||||
|
||||
#define init_stacktrace() { heap_start = (char*) &__bss_start; }
|
||||
#define init_stacktrace() do { \
|
||||
heap_start = (char*) &__bss_start; \
|
||||
check_thread_lib(); \
|
||||
} while(0);
|
||||
void print_stacktrace(gptr stack_bottom, ulong thread_stack);
|
||||
void safe_print_str(const char* name, const char* val, int max_len);
|
||||
void check_thread_lib(void);
|
||||
#endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */
|
||||
#endif /* TARGET_OS_LINUX */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -92,9 +92,9 @@ btr_pcur_store_position(
|
|||
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
|
||||
MTR_MEMO_PAGE_S_FIX)
|
||||
|| mtr_memo_contains(mtr, buf_block_align(page),
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
MTR_MEMO_PAGE_S_FIX)
|
||||
|| mtr_memo_contains(mtr, buf_block_align(page),
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_a(cursor->latch_mode != BTR_NO_LATCHES);
|
||||
|
||||
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
|
||||
|
@ -133,14 +133,13 @@ btr_pcur_store_position(
|
|||
}
|
||||
|
||||
cursor->old_stored = BTR_PCUR_OLD_STORED;
|
||||
cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec,
|
||||
&cursor->old_n_fields,
|
||||
&cursor->old_rec_buf,
|
||||
&cursor->buf_size);
|
||||
cursor->old_rec = dict_tree_copy_rec_order_prefix
|
||||
(tree, rec, &cursor->old_n_fields,
|
||||
&cursor->old_rec_buf, &cursor->buf_size);
|
||||
|
||||
cursor->block_when_stored = buf_block_align(page);
|
||||
cursor->modify_clock = buf_block_get_modify_clock(
|
||||
cursor->block_when_stored);
|
||||
cursor->modify_clock = buf_block_get_modify_clock
|
||||
(cursor->block_when_stored);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -165,7 +164,7 @@ btr_pcur_copy_stored_position(
|
|||
pcur_receive->old_rec_buf = mem_alloc(pcur_donate->buf_size);
|
||||
|
||||
ut_memcpy(pcur_receive->old_rec_buf, pcur_donate->old_rec_buf,
|
||||
pcur_donate->buf_size);
|
||||
pcur_donate->buf_size);
|
||||
pcur_receive->old_rec = pcur_receive->old_rec_buf
|
||||
+ (pcur_donate->old_rec - pcur_donate->old_rec_buf);
|
||||
}
|
||||
|
@ -206,8 +205,8 @@ btr_pcur_restore_position(
|
|||
mem_heap_t* heap;
|
||||
|
||||
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|
||||
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
|
||||
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
|
||||
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
|
||||
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
|
||||
ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
|
||||
if (cursor->trx_if_known) {
|
||||
trx_print(stderr, cursor->trx_if_known, 0);
|
||||
|
@ -216,19 +215,20 @@ btr_pcur_restore_position(
|
|||
ut_error;
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|
||||
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
|
||||
if (UNIV_UNLIKELY
|
||||
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|
||||
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
|
||||
|
||||
/* In these cases we do not try an optimistic restoration,
|
||||
but always do a search */
|
||||
|
||||
btr_cur_open_at_index_side(
|
||||
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
|
||||
btr_pcur_get_btr_cur(cursor)->index, latch_mode,
|
||||
btr_pcur_get_btr_cur(cursor), mtr);
|
||||
btr_cur_open_at_index_side
|
||||
(cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
|
||||
btr_pcur_get_btr_cur(cursor)->index, latch_mode,
|
||||
btr_pcur_get_btr_cur(cursor), mtr);
|
||||
|
||||
cursor->block_when_stored =
|
||||
buf_block_align(btr_pcur_get_page(cursor));
|
||||
cursor->block_when_stored
|
||||
= buf_block_align(btr_pcur_get_page(cursor));
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
@ -239,12 +239,13 @@ btr_pcur_restore_position(
|
|||
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
|
||||
|
||||
if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
|
||||
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
|
||||
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
|
||||
/* Try optimistic restoration */
|
||||
|
||||
if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode,
|
||||
cursor->block_when_stored, page,
|
||||
cursor->modify_clock, mtr))) {
|
||||
if (UNIV_LIKELY
|
||||
(buf_page_optimistic_get(latch_mode,
|
||||
cursor->block_when_stored, page,
|
||||
cursor->modify_clock, mtr))) {
|
||||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
|
@ -262,14 +263,16 @@ btr_pcur_restore_position(
|
|||
index = btr_pcur_get_btr_cur(cursor)->index;
|
||||
|
||||
heap = mem_heap_create(256);
|
||||
offsets1 = rec_get_offsets(cursor->old_rec,
|
||||
index, NULL,
|
||||
cursor->old_n_fields, &heap);
|
||||
offsets2 = rec_get_offsets(rec, index, NULL,
|
||||
cursor->old_n_fields, &heap);
|
||||
offsets1 = rec_get_offsets
|
||||
(cursor->old_rec, index, NULL,
|
||||
cursor->old_n_fields, &heap);
|
||||
offsets2 = rec_get_offsets
|
||||
(rec, index, NULL,
|
||||
cursor->old_n_fields, &heap);
|
||||
|
||||
ut_ad(cmp_rec_rec(cursor->old_rec,
|
||||
rec, offsets1, offsets2, index) == 0);
|
||||
ut_ad(!cmp_rec_rec(cursor->old_rec,
|
||||
rec, offsets1, offsets2,
|
||||
index));
|
||||
mem_heap_free(heap);
|
||||
#endif /* UNIV_DEBUG */
|
||||
return(TRUE);
|
||||
|
@ -285,7 +288,7 @@ btr_pcur_restore_position(
|
|||
|
||||
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
|
||||
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
|
||||
cursor->old_n_fields, heap);
|
||||
cursor->old_n_fields, heap);
|
||||
|
||||
/* Save the old search mode of the cursor */
|
||||
old_mode = cursor->search_mode;
|
||||
|
@ -300,26 +303,27 @@ btr_pcur_restore_position(
|
|||
}
|
||||
|
||||
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
|
||||
mode, latch_mode, cursor, 0, mtr);
|
||||
mode, latch_mode, cursor, 0, mtr);
|
||||
|
||||
/* Restore the old search mode */
|
||||
cursor->search_mode = old_mode;
|
||||
|
||||
if (cursor->rel_pos == BTR_PCUR_ON
|
||||
&& btr_pcur_is_on_user_rec(cursor, mtr)
|
||||
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
|
||||
rec_get_offsets(btr_pcur_get_rec(cursor),
|
||||
btr_pcur_get_btr_cur(cursor)->index,
|
||||
NULL, ULINT_UNDEFINED, &heap))) {
|
||||
&& btr_pcur_is_on_user_rec(cursor, mtr)
|
||||
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
|
||||
rec_get_offsets
|
||||
(btr_pcur_get_rec(cursor),
|
||||
btr_pcur_get_btr_cur(cursor)->index,
|
||||
NULL, ULINT_UNDEFINED, &heap))) {
|
||||
|
||||
/* We have to store the NEW value for the modify clock, since
|
||||
the cursor can now be on a different page! But we can retain
|
||||
the value of old_rec */
|
||||
|
||||
cursor->block_when_stored =
|
||||
buf_block_align(btr_pcur_get_page(cursor));
|
||||
cursor->modify_clock =
|
||||
buf_block_get_modify_clock(cursor->block_when_stored);
|
||||
cursor->block_when_stored = buf_block_align
|
||||
(btr_pcur_get_page(cursor));
|
||||
cursor->modify_clock = buf_block_get_modify_clock
|
||||
(cursor->block_when_stored);
|
||||
cursor->old_stored = BTR_PCUR_OLD_STORED;
|
||||
|
||||
mem_heap_free(heap);
|
||||
|
@ -467,14 +471,14 @@ btr_pcur_move_backward_from_page(
|
|||
space = buf_frame_get_space_id(page);
|
||||
|
||||
if (btr_pcur_is_before_first_on_page(cursor, mtr)
|
||||
&& (prev_page_no != FIL_NULL)) {
|
||||
&& (prev_page_no != FIL_NULL)) {
|
||||
|
||||
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
|
||||
|
||||
btr_leaf_page_release(page, latch_mode, mtr);
|
||||
|
||||
page_cur_set_after_last(prev_page,
|
||||
btr_pcur_get_page_cur(cursor));
|
||||
btr_pcur_get_page_cur(cursor));
|
||||
} else if (prev_page_no != FIL_NULL) {
|
||||
|
||||
/* The repositioned cursor did not end on an infimum record on
|
||||
|
|
|
@ -231,19 +231,19 @@ btr_search_info_update_hash(
|
|||
}
|
||||
|
||||
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
|
||||
cursor->low_match, cursor->low_bytes);
|
||||
cursor->low_match, cursor->low_bytes);
|
||||
|
||||
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp <= 0)
|
||||
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
|
||||
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
|
||||
|
||||
goto set_new_recomm;
|
||||
}
|
||||
|
||||
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
|
||||
cursor->up_match, cursor->up_bytes);
|
||||
cursor->up_match, cursor->up_bytes);
|
||||
|
||||
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp > 0)
|
||||
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
|
||||
|| (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
|
||||
|
||||
goto set_new_recomm;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ set_new_recomm:
|
|||
info->hash_analysis = 0;
|
||||
|
||||
cmp = ut_pair_cmp(cursor->up_match, cursor->up_bytes,
|
||||
cursor->low_match, cursor->low_bytes);
|
||||
cursor->low_match, cursor->low_bytes);
|
||||
if (cmp == 0) {
|
||||
info->n_hash_potential = 0;
|
||||
|
||||
|
@ -328,7 +328,7 @@ btr_search_update_block_hash_info(
|
|||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||
ut_ad(rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_SHARED)
|
||||
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
|
||||
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(cursor);
|
||||
|
||||
|
@ -338,15 +338,15 @@ btr_search_update_block_hash_info(
|
|||
ut_a(info->magic_n == BTR_SEARCH_MAGIC_N);
|
||||
|
||||
if ((block->n_hash_helps > 0)
|
||||
&& (info->n_hash_potential > 0)
|
||||
&& (block->n_fields == info->n_fields)
|
||||
&& (block->n_bytes == info->n_bytes)
|
||||
&& (block->side == info->side)) {
|
||||
&& (info->n_hash_potential > 0)
|
||||
&& (block->n_fields == info->n_fields)
|
||||
&& (block->n_bytes == info->n_bytes)
|
||||
&& (block->side == info->side)) {
|
||||
|
||||
if ((block->is_hashed)
|
||||
&& (block->curr_n_fields == info->n_fields)
|
||||
&& (block->curr_n_bytes == info->n_bytes)
|
||||
&& (block->curr_side == info->side)) {
|
||||
&& (block->curr_n_fields == info->n_fields)
|
||||
&& (block->curr_n_bytes == info->n_bytes)
|
||||
&& (block->curr_side == info->side)) {
|
||||
|
||||
/* The search would presumably have succeeded using
|
||||
the hash index */
|
||||
|
@ -367,15 +367,15 @@ btr_search_update_block_hash_info(
|
|||
}
|
||||
|
||||
if ((block->n_hash_helps > page_get_n_recs(block->frame)
|
||||
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
|
||||
&& (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
|
||||
/ BTR_SEARCH_PAGE_BUILD_LIMIT)
|
||||
&& (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
|
||||
|
||||
if ((!block->is_hashed)
|
||||
|| (block->n_hash_helps
|
||||
> 2 * page_get_n_recs(block->frame))
|
||||
|| (block->n_fields != block->curr_n_fields)
|
||||
|| (block->n_bytes != block->curr_n_bytes)
|
||||
|| (block->side != block->curr_side)) {
|
||||
|| (block->n_hash_helps
|
||||
> 2 * page_get_n_recs(block->frame))
|
||||
|| (block->n_fields != block->curr_n_fields)
|
||||
|| (block->n_bytes != block->curr_n_bytes)
|
||||
|| (block->side != block->curr_side)) {
|
||||
|
||||
/* Build a new hash index on the page */
|
||||
|
||||
|
@ -410,16 +410,16 @@ btr_search_update_hash_ref(
|
|||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(buf_block_align(btr_cur_get_rec(cursor)) == block);
|
||||
ut_a(!block->is_hashed || block->index == cursor->index);
|
||||
|
||||
if (block->is_hashed
|
||||
&& (info->n_hash_potential > 0)
|
||||
&& (block->curr_n_fields == info->n_fields)
|
||||
&& (block->curr_n_bytes == info->n_bytes)
|
||||
&& (block->curr_side == info->side)) {
|
||||
&& (info->n_hash_potential > 0)
|
||||
&& (block->curr_n_fields == info->n_fields)
|
||||
&& (block->curr_n_bytes == info->n_bytes)
|
||||
&& (block->curr_side == info->side)) {
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
@ -432,8 +432,9 @@ btr_search_update_hash_ref(
|
|||
}
|
||||
|
||||
tree_id = ((cursor->index)->tree)->id;
|
||||
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index,
|
||||
offsets_, ULINT_UNDEFINED, &heap),
|
||||
fold = rec_fold(rec,
|
||||
rec_get_offsets(rec, cursor->index, offsets_,
|
||||
ULINT_UNDEFINED, &heap),
|
||||
block->curr_n_fields,
|
||||
block->curr_n_bytes, tree_id);
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -516,10 +517,10 @@ btr_search_info_update_slow(
|
|||
params2 = params + btr_search_this_is_zero;
|
||||
|
||||
btr_search_build_page_hash_index(cursor->index,
|
||||
block->frame,
|
||||
params2[0],
|
||||
params2[1],
|
||||
params2[2]);
|
||||
block->frame,
|
||||
params2[0],
|
||||
params2[1],
|
||||
params2[2]);
|
||||
mem_free(params);
|
||||
}
|
||||
}
|
||||
|
@ -568,9 +569,9 @@ btr_search_check_guess(
|
|||
bytes = 0;
|
||||
|
||||
offsets = rec_get_offsets(rec, cursor->index, offsets,
|
||||
n_unique, &heap);
|
||||
n_unique, &heap);
|
||||
cmp = page_cmp_dtuple_rec_with_match(tuple, rec,
|
||||
offsets, &match, &bytes);
|
||||
offsets, &match, &bytes);
|
||||
|
||||
if (mode == PAGE_CUR_GE) {
|
||||
if (cmp == 1) {
|
||||
|
@ -617,16 +618,16 @@ btr_search_check_guess(
|
|||
prev_rec = page_rec_get_prev(rec);
|
||||
|
||||
if (page_rec_is_infimum(prev_rec)) {
|
||||
success = btr_page_get_prev(
|
||||
buf_frame_align(prev_rec), mtr) == FIL_NULL;
|
||||
success = btr_page_get_prev
|
||||
(buf_frame_align(prev_rec), mtr) == FIL_NULL;
|
||||
|
||||
goto exit_func;
|
||||
}
|
||||
|
||||
offsets = rec_get_offsets(prev_rec, cursor->index, offsets,
|
||||
n_unique, &heap);
|
||||
n_unique, &heap);
|
||||
cmp = page_cmp_dtuple_rec_with_match(tuple, prev_rec,
|
||||
offsets, &match, &bytes);
|
||||
offsets, &match, &bytes);
|
||||
if (mode == PAGE_CUR_GE) {
|
||||
success = cmp == 1;
|
||||
} else {
|
||||
|
@ -642,8 +643,8 @@ btr_search_check_guess(
|
|||
next_rec = page_rec_get_next(rec);
|
||||
|
||||
if (page_rec_is_supremum(next_rec)) {
|
||||
if (btr_page_get_next(
|
||||
buf_frame_align(next_rec), mtr) == FIL_NULL) {
|
||||
if (btr_page_get_next
|
||||
(buf_frame_align(next_rec), mtr) == FIL_NULL) {
|
||||
|
||||
cursor->up_match = 0;
|
||||
success = TRUE;
|
||||
|
@ -653,9 +654,9 @@ btr_search_check_guess(
|
|||
}
|
||||
|
||||
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
|
||||
n_unique, &heap);
|
||||
n_unique, &heap);
|
||||
cmp = page_cmp_dtuple_rec_with_match(tuple, next_rec,
|
||||
offsets, &match, &bytes);
|
||||
offsets, &match, &bytes);
|
||||
if (mode == PAGE_CUR_LE) {
|
||||
success = cmp == -1;
|
||||
cursor->up_match = match;
|
||||
|
@ -709,7 +710,7 @@ btr_search_guess_on_hash(
|
|||
#endif
|
||||
ut_ad(index && info && tuple && cursor && mtr);
|
||||
ut_ad((latch_mode == BTR_SEARCH_LEAF)
|
||||
|| (latch_mode == BTR_MODIFY_LEAF));
|
||||
|| (latch_mode == BTR_MODIFY_LEAF));
|
||||
|
||||
/* Note that, for efficiency, the struct info may not be protected by
|
||||
any latch here! */
|
||||
|
@ -730,7 +731,7 @@ btr_search_guess_on_hash(
|
|||
}
|
||||
|
||||
if (UNIV_UNLIKELY(tuple_n_fields == cursor->n_fields)
|
||||
&& (cursor->n_bytes > 0)) {
|
||||
&& (cursor->n_bytes > 0)) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
@ -762,10 +763,10 @@ btr_search_guess_on_hash(
|
|||
|
||||
if (UNIV_LIKELY(!has_search_latch)) {
|
||||
|
||||
if (UNIV_UNLIKELY(!buf_page_get_known_nowait(latch_mode, page,
|
||||
if (UNIV_UNLIKELY
|
||||
(!buf_page_get_known_nowait(latch_mode, page,
|
||||
BUF_MAKE_YOUNG,
|
||||
__FILE__, __LINE__,
|
||||
mtr))) {
|
||||
__FILE__, __LINE__, mtr))) {
|
||||
goto failure_unlock;
|
||||
}
|
||||
|
||||
|
@ -801,10 +802,11 @@ btr_search_guess_on_hash(
|
|||
record to determine if our guess for the cursor position is
|
||||
right. */
|
||||
if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0)
|
||||
|| !btr_search_check_guess(cursor,
|
||||
can_only_compare_to_cursor_rec, tuple, mode, mtr)) {
|
||||
|| !btr_search_check_guess(cursor,
|
||||
can_only_compare_to_cursor_rec,
|
||||
tuple, mode, mtr)) {
|
||||
if (UNIV_LIKELY(!has_search_latch)) {
|
||||
btr_leaf_page_release(page, latch_mode, mtr);
|
||||
btr_leaf_page_release(page, latch_mode, mtr);
|
||||
}
|
||||
|
||||
goto failure;
|
||||
|
@ -827,9 +829,9 @@ btr_search_guess_on_hash(
|
|||
btr_leaf_page_release(page, latch_mode, mtr);
|
||||
|
||||
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
|
||||
&cursor2, 0, mtr);
|
||||
&cursor2, 0, mtr);
|
||||
if (mode == PAGE_CUR_GE
|
||||
&& page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
|
||||
&& page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
|
||||
|
||||
/* If mode is PAGE_CUR_GE, then the binary search
|
||||
in the index tree may actually take us to the supremum
|
||||
|
@ -838,7 +840,7 @@ btr_search_guess_on_hash(
|
|||
info->last_hash_succ = FALSE;
|
||||
|
||||
btr_pcur_open_on_user_rec(index, tuple, mode, latch_mode,
|
||||
&pcur, mtr);
|
||||
&pcur, mtr);
|
||||
ut_ad(btr_pcur_get_rec(&pcur) == btr_cur_get_rec(cursor));
|
||||
} else {
|
||||
ut_ad(btr_cur_get_rec(&cursor2) == btr_cur_get_rec(cursor));
|
||||
|
@ -854,7 +856,7 @@ btr_search_guess_on_hash(
|
|||
btr_search_n_succ++;
|
||||
#endif
|
||||
if (UNIV_LIKELY(!has_search_latch)
|
||||
&& buf_block_peek_if_too_old(block)) {
|
||||
&& buf_block_peek_if_too_old(block)) {
|
||||
|
||||
buf_page_make_young(page);
|
||||
}
|
||||
|
@ -931,8 +933,8 @@ retry:
|
|||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|
||||
|| (block->buf_fix_count == 0));
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|
||||
|| (block->buf_fix_count == 0));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
n_fields = block->curr_n_fields;
|
||||
|
@ -972,7 +974,7 @@ retry:
|
|||
/* FIXME: in a mixed tree, not all records may have enough
|
||||
ordering fields: */
|
||||
offsets = rec_get_offsets(rec, index, offsets,
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
|
||||
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
|
||||
|
||||
|
@ -1006,7 +1008,7 @@ next_rec:
|
|||
ut_a(block->index == index);
|
||||
|
||||
if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
|
||||
|| UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
|
||||
|| UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
|
||||
|
||||
/* Someone else has meanwhile built a new hash index on the
|
||||
page, with different parameters */
|
||||
|
@ -1029,8 +1031,10 @@ cleanup:
|
|||
/* Corruption */
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Corruption of adaptive hash index. After dropping\n"
|
||||
"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
|
||||
" InnoDB: Corruption of adaptive hash index."
|
||||
" After dropping\n"
|
||||
"InnoDB: the hash index to a page of %s,"
|
||||
" still %lu hash nodes remain.\n",
|
||||
index->name, (ulong) block->n_pointers);
|
||||
rw_lock_x_unlock(&btr_search_latch);
|
||||
|
||||
|
@ -1124,14 +1128,14 @@ btr_search_build_page_hash_index(
|
|||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
rw_lock_s_lock(&btr_search_latch);
|
||||
|
||||
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|
||||
|| (block->curr_n_bytes != n_bytes)
|
||||
|| (block->curr_side != side))) {
|
||||
|| (block->curr_n_bytes != n_bytes)
|
||||
|| (block->curr_side != side))) {
|
||||
|
||||
rw_lock_s_unlock(&btr_search_latch);
|
||||
|
||||
|
@ -1155,8 +1159,8 @@ btr_search_build_page_hash_index(
|
|||
}
|
||||
|
||||
if (dict_index_get_n_unique_in_tree(index) < n_fields
|
||||
|| (dict_index_get_n_unique_in_tree(index) == n_fields
|
||||
&& n_bytes > 0)) {
|
||||
|| (dict_index_get_n_unique_in_tree(index) == n_fields
|
||||
&& n_bytes > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1178,7 @@ btr_search_build_page_hash_index(
|
|||
rec = page_rec_get_next(rec);
|
||||
|
||||
offsets = rec_get_offsets(rec, index, offsets,
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
|
||||
if (!page_rec_is_supremum(rec)) {
|
||||
ut_a(n_fields <= rec_offs_n_fields(offsets));
|
||||
|
@ -1211,9 +1215,9 @@ btr_search_build_page_hash_index(
|
|||
}
|
||||
|
||||
offsets = rec_get_offsets(next_rec, index, offsets,
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
next_fold = rec_fold(next_rec, offsets, n_fields,
|
||||
n_bytes, tree_id);
|
||||
n_bytes, tree_id);
|
||||
|
||||
if (fold != next_fold) {
|
||||
/* Insert an entry into the hash index */
|
||||
|
@ -1239,8 +1243,8 @@ btr_search_build_page_hash_index(
|
|||
rw_lock_x_lock(&btr_search_latch);
|
||||
|
||||
if (block->is_hashed && ((block->curr_n_fields != n_fields)
|
||||
|| (block->curr_n_bytes != n_bytes)
|
||||
|| (block->curr_side != side))) {
|
||||
|| (block->curr_n_bytes != n_bytes)
|
||||
|| (block->curr_side != side))) {
|
||||
goto exit_func;
|
||||
}
|
||||
|
||||
|
@ -1327,7 +1331,7 @@ btr_search_move_or_delete_hash_entries(
|
|||
ut_a(n_fields + n_bytes > 0);
|
||||
|
||||
btr_search_build_page_hash_index(index, new_page, n_fields,
|
||||
n_bytes, side);
|
||||
n_bytes, side);
|
||||
ut_a(n_fields == block->curr_n_fields);
|
||||
ut_a(n_bytes == block->curr_n_bytes);
|
||||
ut_a(side == block->curr_side);
|
||||
|
@ -1378,8 +1382,8 @@ btr_search_update_hash_on_delete(
|
|||
|
||||
tree_id = cursor->index->tree->id;
|
||||
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
|
||||
ULINT_UNDEFINED, &heap), block->curr_n_fields,
|
||||
block->curr_n_bytes, tree_id);
|
||||
ULINT_UNDEFINED, &heap),
|
||||
block->curr_n_fields, block->curr_n_bytes, tree_id);
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
@ -1423,14 +1427,14 @@ btr_search_update_hash_node_on_insert(
|
|||
rw_lock_x_lock(&btr_search_latch);
|
||||
|
||||
if ((cursor->flag == BTR_CUR_HASH)
|
||||
&& (cursor->n_fields == block->curr_n_fields)
|
||||
&& (cursor->n_bytes == block->curr_n_bytes)
|
||||
&& (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
|
||||
&& (cursor->n_fields == block->curr_n_fields)
|
||||
&& (cursor->n_bytes == block->curr_n_bytes)
|
||||
&& (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
|
||||
|
||||
table = btr_search_sys->hash_index;
|
||||
|
||||
ha_search_and_update_if_found(table, cursor->fold, rec,
|
||||
page_rec_get_next(rec));
|
||||
page_rec_get_next(rec));
|
||||
|
||||
rw_lock_x_unlock(&btr_search_latch);
|
||||
} else {
|
||||
|
@ -1498,19 +1502,19 @@ btr_search_update_hash_on_insert(
|
|||
next_rec = page_rec_get_next(ins_rec);
|
||||
|
||||
offsets = rec_get_offsets(ins_rec, cursor->index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
ULINT_UNDEFINED, &heap);
|
||||
ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, tree_id);
|
||||
|
||||
if (!page_rec_is_supremum(next_rec)) {
|
||||
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
next_fold = rec_fold(next_rec, offsets, n_fields,
|
||||
n_bytes, tree_id);
|
||||
n_bytes, tree_id);
|
||||
}
|
||||
|
||||
if (!page_rec_is_infimum(rec)) {
|
||||
offsets = rec_get_offsets(rec, cursor->index, offsets,
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
n_fields + (n_bytes > 0), &heap);
|
||||
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
|
||||
} else {
|
||||
if (side == BTR_SEARCH_LEFT_SIDE) {
|
||||
|
@ -1570,11 +1574,11 @@ check_next_rec:
|
|||
if (side == BTR_SEARCH_RIGHT_SIDE) {
|
||||
|
||||
ha_insert_for_fold(table, ins_fold, ins_rec);
|
||||
/*
|
||||
/*
|
||||
fputs("Hash insert for ", stderr);
|
||||
dict_index_name_print(stderr, cursor->index);
|
||||
fprintf(stderr, " fold %lu\n", ins_fold);
|
||||
*/
|
||||
*/
|
||||
} else {
|
||||
ha_insert_for_fold(table, next_fold, next_rec);
|
||||
}
|
||||
|
@ -1633,12 +1637,13 @@ btr_search_validate(void)
|
|||
block = buf_block_align(node->data);
|
||||
page = buf_frame_align(node->data);
|
||||
offsets = rec_get_offsets((rec_t*) node->data,
|
||||
block->index, offsets,
|
||||
block->curr_n_fields
|
||||
+ (block->curr_n_bytes > 0), &heap);
|
||||
block->index, offsets,
|
||||
block->curr_n_fields
|
||||
+ (block->curr_n_bytes > 0),
|
||||
&heap);
|
||||
|
||||
if (!block->is_hashed
|
||||
|| node->fold != rec_fold((rec_t*)(node->data),
|
||||
if (!block->is_hashed || node->fold
|
||||
!= rec_fold((rec_t*)(node->data),
|
||||
offsets,
|
||||
block->curr_n_fields,
|
||||
block->curr_n_bytes,
|
||||
|
@ -1647,28 +1652,36 @@ btr_search_validate(void)
|
|||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error in an adaptive hash index pointer to page %lu\n"
|
||||
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
|
||||
" InnoDB: Error in an adaptive hash"
|
||||
" index pointer to page %lu\n"
|
||||
"InnoDB: ptr mem address %p"
|
||||
" index id %lu %lu,"
|
||||
" node fold %lu, rec fold %lu\n",
|
||||
(ulong) buf_frame_get_page_no(page),
|
||||
node->data,
|
||||
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
|
||||
(ulong) ut_dulint_get_low(btr_page_get_index_id(page)),
|
||||
(ulong) ut_dulint_get_high
|
||||
(btr_page_get_index_id(page)),
|
||||
(ulong) ut_dulint_get_low
|
||||
(btr_page_get_index_id(page)),
|
||||
(ulong) node->fold,
|
||||
(ulong) rec_fold((rec_t*)(node->data),
|
||||
offsets,
|
||||
block->curr_n_fields,
|
||||
block->curr_n_bytes,
|
||||
btr_page_get_index_id(page)));
|
||||
offsets,
|
||||
block->curr_n_fields,
|
||||
block->curr_n_bytes,
|
||||
btr_page_get_index_id
|
||||
(page)));
|
||||
|
||||
fputs("InnoDB: Record ", stderr);
|
||||
rec_print_new(stderr, (rec_t*)node->data,
|
||||
offsets);
|
||||
offsets);
|
||||
fprintf(stderr, "\nInnoDB: on that page."
|
||||
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
|
||||
"side %lu\n",
|
||||
page, (ulong) block->is_hashed,
|
||||
(ulong) block->curr_n_fields,
|
||||
(ulong) block->curr_n_bytes, (ulong) block->curr_side);
|
||||
" Page mem address %p, is hashed %lu,"
|
||||
" n fields %lu, n bytes %lu\n"
|
||||
"InnoDB: side %lu\n",
|
||||
(void*) page, (ulong) block->is_hashed,
|
||||
(ulong) block->curr_n_fields,
|
||||
(ulong) block->curr_n_bytes,
|
||||
(ulong) block->curr_side);
|
||||
|
||||
if (n_page_dumps < 20) {
|
||||
buf_page_print(page);
|
||||
|
|
|
@ -160,8 +160,8 @@ and the io-operation for loading the page is queued. The io-handler thread
|
|||
releases the X-lock on the frame and resets the io_fix field
|
||||
when the io operation completes.
|
||||
|
||||
A thread may request the above operation using the buf_page_get-
|
||||
function. It may then continue to request a lock on the frame.
|
||||
A thread may request the above operation using the function
|
||||
buf_page_get(). It may then continue to request a lock on the frame.
|
||||
The lock is granted when the io-handler releases the x-lock.
|
||||
|
||||
Read-ahead
|
||||
|
@ -253,10 +253,10 @@ buf_calc_page_new_checksum(
|
|||
there we store the old formula checksum. */
|
||||
|
||||
checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
|
||||
+ ut_fold_binary(page + FIL_PAGE_DATA,
|
||||
UNIV_PAGE_SIZE - FIL_PAGE_DATA
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
|
||||
+ ut_fold_binary(page + FIL_PAGE_DATA,
|
||||
UNIV_PAGE_SIZE - FIL_PAGE_DATA
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
checksum = checksum & 0xFFFFFFFFUL;
|
||||
|
||||
return(checksum);
|
||||
|
@ -302,11 +302,11 @@ buf_page_is_corrupted(
|
|||
dulint current_lsn;
|
||||
#endif
|
||||
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
|
||||
/* Stored log sequence numbers at the start and the end
|
||||
of page do not match */
|
||||
of page do not match */
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -314,22 +314,28 @@ buf_page_is_corrupted(
|
|||
#ifndef UNIV_HOTBACKUP
|
||||
if (recv_lsn_checks_on && log_peek_lsn(¤t_lsn)) {
|
||||
if (ut_dulint_cmp(current_lsn,
|
||||
mach_read_from_8(read_buf + FIL_PAGE_LSN))
|
||||
< 0) {
|
||||
mach_read_from_8(read_buf + FIL_PAGE_LSN))
|
||||
< 0) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: page %lu log sequence number %lu %lu\n"
|
||||
"InnoDB: is in the future! Current system log sequence number %lu %lu.\n"
|
||||
"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
|
||||
"InnoDB: tablespace but not the InnoDB log files. See\n"
|
||||
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
|
||||
"InnoDB: for more information.\n",
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
|
||||
(ulong) ut_dulint_get_high(
|
||||
mach_read_from_8(read_buf + FIL_PAGE_LSN)),
|
||||
(ulong) ut_dulint_get_low(
|
||||
mach_read_from_8(read_buf + FIL_PAGE_LSN)),
|
||||
" InnoDB: Error: page %lu log sequence number"
|
||||
" %lu %lu\n"
|
||||
"InnoDB: is in the future! Current system "
|
||||
"log sequence number %lu %lu.\n"
|
||||
"InnoDB: Your database may be corrupt or "
|
||||
"you may have copied the InnoDB\n"
|
||||
"InnoDB: tablespace but not the InnoDB "
|
||||
"log files. See\n"
|
||||
"InnoDB: http://dev.mysql.com/doc/refman/"
|
||||
"5.1/en/forcing-recovery.html\n"
|
||||
"InnoDB: for more information.\n",
|
||||
(ulong) mach_read_from_4(read_buf
|
||||
+ FIL_PAGE_OFFSET),
|
||||
(ulong) ut_dulint_get_high
|
||||
(mach_read_from_8(read_buf + FIL_PAGE_LSN)),
|
||||
(ulong) ut_dulint_get_low
|
||||
(mach_read_from_8(read_buf + FIL_PAGE_LSN)),
|
||||
(ulong) ut_dulint_get_high(current_lsn),
|
||||
(ulong) ut_dulint_get_low(current_lsn));
|
||||
}
|
||||
|
@ -344,8 +350,9 @@ buf_page_is_corrupted(
|
|||
if (srv_use_checksums) {
|
||||
old_checksum = buf_calc_page_old_checksum(read_buf);
|
||||
|
||||
old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
old_checksum_field = mach_read_from_4
|
||||
(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
|
||||
/* There are 2 valid formulas for old_checksum_field:
|
||||
|
||||
|
@ -356,22 +363,22 @@ buf_page_is_corrupted(
|
|||
there. */
|
||||
|
||||
if (old_checksum_field != mach_read_from_4(read_buf
|
||||
+ FIL_PAGE_LSN)
|
||||
&& old_checksum_field != old_checksum
|
||||
&& old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
|
||||
+ FIL_PAGE_LSN)
|
||||
&& old_checksum_field != old_checksum
|
||||
&& old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
checksum = buf_calc_page_new_checksum(read_buf);
|
||||
checksum_field = mach_read_from_4(read_buf +
|
||||
FIL_PAGE_SPACE_OR_CHKSUM);
|
||||
checksum_field = mach_read_from_4(read_buf
|
||||
+ FIL_PAGE_SPACE_OR_CHKSUM);
|
||||
|
||||
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
|
||||
(always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
|
||||
|
||||
if (checksum_field != 0 && checksum_field != checksum
|
||||
&& checksum_field != BUF_NO_CHECKSUM_MAGIC) {
|
||||
&& checksum_field != BUF_NO_CHECKSUM_MAGIC) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -398,37 +405,41 @@ buf_page_print(
|
|||
ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
|
||||
fputs("InnoDB: End of page dump\n", stderr);
|
||||
|
||||
checksum = srv_use_checksums ?
|
||||
buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
|
||||
old_checksum = srv_use_checksums ?
|
||||
buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
|
||||
checksum = srv_use_checksums
|
||||
? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
|
||||
old_checksum = srv_use_checksums
|
||||
? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n"
|
||||
"InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n",
|
||||
(ulong) checksum, (ulong) old_checksum,
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
|
||||
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM));
|
||||
fprintf(stderr,
|
||||
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn at page end %lu\n"
|
||||
"InnoDB: Page number (if stored to page already) %lu,\n"
|
||||
"InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) %lu\n",
|
||||
" InnoDB: Page checksum %lu, prior-to-4.0.14-form"
|
||||
" checksum %lu\n"
|
||||
"InnoDB: stored checksum %lu, prior-to-4.0.14-form"
|
||||
" stored checksum %lu\n"
|
||||
"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn"
|
||||
" at page end %lu\n"
|
||||
"InnoDB: Page number (if stored to page already) %lu,\n"
|
||||
"InnoDB: space id (if created with >= MySQL-4.1.1"
|
||||
" and stored already) %lu\n",
|
||||
(ulong) checksum, (ulong) old_checksum,
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
|
||||
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM),
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN),
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN + 4),
|
||||
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
|
||||
(ulong) mach_read_from_4(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
|
||||
(ulong) mach_read_from_4(read_buf
|
||||
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
|
||||
|
||||
if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE)
|
||||
== TRX_UNDO_INSERT) {
|
||||
== TRX_UNDO_INSERT) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Page may be an insert undo log page\n");
|
||||
} else if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR
|
||||
+ TRX_UNDO_PAGE_TYPE)
|
||||
== TRX_UNDO_UPDATE) {
|
||||
+ TRX_UNDO_PAGE_TYPE)
|
||||
== TRX_UNDO_UPDATE) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Page may be an update undo log page\n");
|
||||
}
|
||||
|
@ -436,17 +447,20 @@ buf_page_print(
|
|||
switch (fil_page_get_type(read_buf)) {
|
||||
case FIL_PAGE_INDEX:
|
||||
fprintf(stderr,
|
||||
"InnoDB: Page may be an index page where index id is %lu %lu\n",
|
||||
(ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)),
|
||||
(ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf)));
|
||||
"InnoDB: Page may be an index page where"
|
||||
" index id is %lu %lu\n",
|
||||
(ulong) ut_dulint_get_high
|
||||
(btr_page_get_index_id(read_buf)),
|
||||
(ulong) ut_dulint_get_low
|
||||
(btr_page_get_index_id(read_buf)));
|
||||
|
||||
/* If the code is in ibbackup, dict_sys may be uninitialized,
|
||||
i.e., NULL */
|
||||
|
||||
if (dict_sys != NULL) {
|
||||
|
||||
index = dict_index_find_on_id_low(
|
||||
btr_page_get_index_id(read_buf));
|
||||
index = dict_index_find_on_id_low
|
||||
(btr_page_get_index_id(read_buf));
|
||||
if (index) {
|
||||
fputs("InnoDB: (", stderr);
|
||||
dict_index_name_print(stderr, NULL, index);
|
||||
|
@ -459,35 +473,35 @@ buf_page_print(
|
|||
break;
|
||||
case FIL_PAGE_IBUF_FREE_LIST:
|
||||
fputs("InnoDB: Page may be an insert buffer free list page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_ALLOCATED:
|
||||
fputs("InnoDB: Page may be a freshly allocated page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_IBUF_BITMAP:
|
||||
fputs("InnoDB: Page may be an insert buffer bitmap page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_SYS:
|
||||
fputs("InnoDB: Page may be a system page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_TRX_SYS:
|
||||
fputs("InnoDB: Page may be a transaction system page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_FSP_HDR:
|
||||
fputs("InnoDB: Page may be a file space header page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_XDES:
|
||||
fputs("InnoDB: Page may be an extent descriptor page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
case FIL_PAGE_TYPE_BLOB:
|
||||
fputs("InnoDB: Page may be a BLOB page\n",
|
||||
stderr);
|
||||
stderr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -561,9 +575,12 @@ buf_pool_init(
|
|||
|
||||
if (n_frames > curr_size) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n"
|
||||
"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n"
|
||||
"InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames);
|
||||
"InnoDB: AWE: Error: you must specify in my.cnf"
|
||||
" .._awe_mem_mb larger\n"
|
||||
"InnoDB: than .._buffer_pool_size. Now the former"
|
||||
" is %lu pages,\n"
|
||||
"InnoDB: the latter %lu pages.\n",
|
||||
(ulong) curr_size, (ulong) n_frames);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -571,7 +588,7 @@ buf_pool_init(
|
|||
buf_pool = mem_alloc(sizeof(buf_pool_t));
|
||||
|
||||
/* 1. Initialize general fields
|
||||
---------------------------- */
|
||||
---------------------------- */
|
||||
mutex_create(&buf_pool->mutex, SYNC_BUF_POOL);
|
||||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
@ -581,8 +598,8 @@ buf_pool_init(
|
|||
/* Allocate the virtual address space window, i.e., the
|
||||
buffer pool frames */
|
||||
|
||||
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
|
||||
UNIV_PAGE_SIZE * (n_frames + 1));
|
||||
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window
|
||||
(UNIV_PAGE_SIZE * (n_frames + 1));
|
||||
|
||||
/* Allocate the physical memory for AWE and the AWE info array
|
||||
for buf_pool */
|
||||
|
@ -590,23 +607,26 @@ buf_pool_init(
|
|||
if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n"
|
||||
"InnoDB: Trying to allocate %lu database pages.\n",
|
||||
(ulong) curr_size);
|
||||
"InnoDB: AWE: Error: physical memory must be"
|
||||
" allocated in full megabytes.\n"
|
||||
"InnoDB: Trying to allocate %lu"
|
||||
" database pages.\n",
|
||||
(ulong) curr_size);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
|
||||
curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) {
|
||||
curr_size
|
||||
/ ((1024 * 1024)
|
||||
/ UNIV_PAGE_SIZE))) {
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
/*----------------------------------------*/
|
||||
} else {
|
||||
buf_pool->frame_mem = os_mem_alloc_large(
|
||||
UNIV_PAGE_SIZE * (n_frames + 1),
|
||||
TRUE, FALSE);
|
||||
buf_pool->frame_mem = os_mem_alloc_large
|
||||
(UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
|
||||
}
|
||||
|
||||
if (buf_pool->frame_mem == NULL) {
|
||||
|
@ -639,9 +659,10 @@ buf_pool_init(
|
|||
the window */
|
||||
|
||||
os_awe_map_physical_mem_to_window(buf_pool->frame_zero,
|
||||
n_frames *
|
||||
(UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE),
|
||||
buf_pool->awe_info);
|
||||
n_frames
|
||||
* (UNIV_PAGE_SIZE
|
||||
/ OS_AWE_X86_PAGE_SIZE),
|
||||
buf_pool->awe_info);
|
||||
/*----------------------------------------*/
|
||||
}
|
||||
|
||||
|
@ -697,7 +718,7 @@ buf_pool_init(
|
|||
buf_pool->n_pages_awe_remapped_old = 0;
|
||||
|
||||
/* 2. Initialize flushing fields
|
||||
---------------------------- */
|
||||
---------------------------- */
|
||||
UT_LIST_INIT(buf_pool->flush_list);
|
||||
|
||||
for (i = BUF_FLUSH_LRU; i <= BUF_FLUSH_LIST; i++) {
|
||||
|
@ -712,7 +733,7 @@ buf_pool_init(
|
|||
buf_pool->freed_page_clock = 0;
|
||||
|
||||
/* 3. Initialize LRU fields
|
||||
---------------------------- */
|
||||
---------------------------- */
|
||||
UT_LIST_INIT(buf_pool->LRU);
|
||||
|
||||
buf_pool->LRU_old = NULL;
|
||||
|
@ -738,7 +759,8 @@ buf_pool_init(
|
|||
frames */
|
||||
|
||||
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,8 +771,8 @@ buf_pool_init(
|
|||
mutex_exit(&(buf_pool->mutex));
|
||||
|
||||
if (srv_use_adaptive_hash_indexes) {
|
||||
btr_search_sys_create(
|
||||
curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64);
|
||||
btr_search_sys_create(curr_size * UNIV_PAGE_SIZE
|
||||
/ sizeof(void*) / 64);
|
||||
} else {
|
||||
/* Create only a small dummy system */
|
||||
btr_search_sys_create(1000);
|
||||
|
@ -792,35 +814,36 @@ buf_awe_map_page_to_frame(
|
|||
|
||||
while (bck) {
|
||||
if (bck->state == BUF_BLOCK_FILE_PAGE
|
||||
&& (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
|
||||
&& (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
|
||||
|
||||
/* We have to skip this */
|
||||
bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck);
|
||||
} else {
|
||||
/* We can map block to the frame of bck */
|
||||
|
||||
os_awe_map_physical_mem_to_window(
|
||||
bck->frame,
|
||||
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
|
||||
block->awe_info);
|
||||
os_awe_map_physical_mem_to_window
|
||||
(bck->frame,
|
||||
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
|
||||
block->awe_info);
|
||||
|
||||
block->frame = bck->frame;
|
||||
|
||||
*(buf_pool->blocks_of_frames
|
||||
+ (((ulint)(block->frame
|
||||
- buf_pool->frame_zero))
|
||||
>> UNIV_PAGE_SIZE_SHIFT))
|
||||
+ (((ulint)(block->frame
|
||||
- buf_pool->frame_zero))
|
||||
>> UNIV_PAGE_SIZE_SHIFT))
|
||||
= block;
|
||||
|
||||
bck->frame = NULL;
|
||||
UT_LIST_REMOVE(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
bck);
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
bck);
|
||||
|
||||
if (add_to_mapped_list) {
|
||||
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
block);
|
||||
UT_LIST_ADD_FIRST
|
||||
(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
block);
|
||||
}
|
||||
|
||||
buf_pool->n_pages_awe_remapped++;
|
||||
|
@ -830,8 +853,8 @@ buf_awe_map_page_to_frame(
|
|||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
|
||||
"InnoDB: awe_LRU_free_mapped list length %lu\n",
|
||||
"InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
|
||||
"InnoDB: awe_LRU_free_mapped list length %lu\n",
|
||||
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
|
||||
|
||||
ut_a(0);
|
||||
|
@ -864,7 +887,7 @@ buf_block_make_young(
|
|||
buf_block_t* block) /* in: block to make younger */
|
||||
{
|
||||
if (buf_pool->freed_page_clock >= block->freed_page_clock
|
||||
+ 1 + (buf_pool->curr_size / 1024)) {
|
||||
+ 1 + (buf_pool->curr_size / 1024)) {
|
||||
|
||||
/* There has been freeing activity in the LRU list:
|
||||
best to move to the head of the LRU list */
|
||||
|
@ -1118,11 +1141,11 @@ buf_page_get_gen(
|
|||
|
||||
ut_ad(mtr);
|
||||
ut_ad((rw_latch == RW_S_LATCH)
|
||||
|| (rw_latch == RW_X_LATCH)
|
||||
|| (rw_latch == RW_NO_LATCH));
|
||||
|| (rw_latch == RW_X_LATCH)
|
||||
|| (rw_latch == RW_NO_LATCH));
|
||||
ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
|
||||
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|
||||
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
|
||||
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
|
||||
#ifndef UNIV_LOG_DEBUG
|
||||
ut_ad(!ibuf_inside() || ibuf_page(space, offset));
|
||||
#endif
|
||||
|
@ -1136,7 +1159,7 @@ loop:
|
|||
block = buf_block_align(guess);
|
||||
|
||||
if ((offset != block->offset) || (space != block->space)
|
||||
|| (block->state != BUF_BLOCK_FILE_PAGE)) {
|
||||
|| (block->state != BUF_BLOCK_FILE_PAGE)) {
|
||||
|
||||
block = NULL;
|
||||
}
|
||||
|
@ -1229,12 +1252,12 @@ loop:
|
|||
if (mode == BUF_GET_NOWAIT) {
|
||||
if (rw_latch == RW_S_LATCH) {
|
||||
success = rw_lock_s_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_S_FIX;
|
||||
} else {
|
||||
ut_ad(rw_latch == RW_X_LATCH);
|
||||
success = rw_lock_x_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_X_FIX;
|
||||
}
|
||||
|
||||
|
@ -1331,8 +1354,8 @@ buf_page_optimistic_get_func(
|
|||
/* If AWE is used, block may have a different frame now, e.g., NULL */
|
||||
|
||||
if (UNIV_UNLIKELY(block->state != BUF_BLOCK_FILE_PAGE)
|
||||
|| UNIV_UNLIKELY(block->frame != guess)) {
|
||||
exit_func:
|
||||
|| UNIV_UNLIKELY(block->frame != guess)) {
|
||||
exit_func:
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
||||
return(FALSE);
|
||||
|
@ -1357,11 +1380,11 @@ buf_page_optimistic_get_func(
|
|||
|
||||
if (rw_latch == RW_S_LATCH) {
|
||||
success = rw_lock_s_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_S_FIX;
|
||||
} else {
|
||||
success = rw_lock_x_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_X_FIX;
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1437,7 @@ buf_page_optimistic_get_func(
|
|||
read-ahead */
|
||||
|
||||
buf_read_ahead_linear(buf_frame_get_space_id(guess),
|
||||
buf_frame_get_page_no(guess));
|
||||
buf_frame_get_page_no(guess));
|
||||
}
|
||||
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
|
@ -1482,11 +1505,11 @@ buf_page_get_known_nowait(
|
|||
|
||||
if (rw_latch == RW_S_LATCH) {
|
||||
success = rw_lock_s_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_S_FIX;
|
||||
} else {
|
||||
success = rw_lock_x_lock_func_nowait(&(block->lock),
|
||||
file, line);
|
||||
file, line);
|
||||
fix_type = MTR_MEMO_PAGE_X_FIX;
|
||||
}
|
||||
|
||||
|
@ -1519,7 +1542,7 @@ buf_page_get_known_nowait(
|
|||
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a((mode == BUF_KEEP_OLD)
|
||||
|| (ibuf_count_get(block->space, block->offset) == 0));
|
||||
|| (ibuf_count_get(block->space, block->offset) == 0));
|
||||
#endif
|
||||
buf_pool->n_page_gets++;
|
||||
|
||||
|
@ -1598,7 +1621,8 @@ buf_page_init(
|
|||
|
||||
if (buf_page_hash_get(space, offset)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: page %lu %lu already found from the hash table\n",
|
||||
"InnoDB: Error: page %lu %lu already found"
|
||||
" in the hash table\n",
|
||||
(ulong) space,
|
||||
(ulong) offset);
|
||||
#ifdef UNIV_DEBUG
|
||||
|
@ -1611,7 +1635,7 @@ buf_page_init(
|
|||
}
|
||||
|
||||
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
|
||||
buf_page_address_fold(space, offset), block);
|
||||
buf_page_address_fold(space, offset), block);
|
||||
|
||||
block->freed_page_clock = 0;
|
||||
|
||||
|
@ -1686,27 +1710,28 @@ buf_page_init_for_read(
|
|||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (fil_tablespace_deleted_or_being_deleted_in_mem(space,
|
||||
tablespace_version)) {
|
||||
if (fil_tablespace_deleted_or_being_deleted_in_mem
|
||||
(space, tablespace_version)) {
|
||||
*err = DB_TABLESPACE_DELETED;
|
||||
}
|
||||
|
||||
if (*err == DB_TABLESPACE_DELETED
|
||||
|| NULL != buf_page_hash_get(space, offset)) {
|
||||
|| NULL != buf_page_hash_get(space, offset)) {
|
||||
|
||||
/* The page belongs to a space which has been deleted or is
|
||||
being deleted, or the page is already in buf_pool, return */
|
||||
/* The page belongs to a space which has been
|
||||
deleted or is being deleted, or the page is
|
||||
already in buf_pool, return */
|
||||
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
buf_block_free(block);
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
buf_block_free(block);
|
||||
|
||||
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
|
||||
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
|
||||
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ut_ad(block);
|
||||
|
||||
|
@ -1866,23 +1891,24 @@ buf_page_io_complete(
|
|||
/* If this page is not uninitialized and not in the
|
||||
doublewrite buffer, then the page number and space id
|
||||
should be the same as in block. */
|
||||
ulint read_page_no = mach_read_from_4((block->frame)
|
||||
+ FIL_PAGE_OFFSET);
|
||||
ulint read_space_id = mach_read_from_4((block->frame)
|
||||
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
ulint read_page_no = mach_read_from_4
|
||||
(block->frame + FIL_PAGE_OFFSET);
|
||||
ulint read_space_id = mach_read_from_4
|
||||
(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
|
||||
if (!block->space && trx_doublewrite_page_inside(
|
||||
block->offset)) {
|
||||
if (!block->space
|
||||
&& trx_doublewrite_page_inside(block->offset)) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: reading page %lu\n"
|
||||
"InnoDB: which is in the doublewrite buffer!\n",
|
||||
" InnoDB: Error: reading page %lu\n"
|
||||
"InnoDB: which is in the"
|
||||
" doublewrite buffer!\n",
|
||||
(ulong) block->offset);
|
||||
} else if (!read_space_id && !read_page_no) {
|
||||
/* This is likely an uninitialized page. */
|
||||
} else if ((block->space && block->space != read_space_id)
|
||||
|| block->offset != read_page_no) {
|
||||
|| block->offset != read_page_no) {
|
||||
/* We did not compare space_id to read_space_id
|
||||
if block->space == 0, because the field on the
|
||||
page may contain garbage in MySQL < 4.1.1,
|
||||
|
@ -1890,59 +1916,73 @@ buf_page_io_complete(
|
|||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: space id and page n:o stored in the page\n"
|
||||
"InnoDB: read in are %lu:%lu, should be %lu:%lu!\n",
|
||||
" InnoDB: Error: space id and page n:o"
|
||||
" stored in the page\n"
|
||||
"InnoDB: read in are %lu:%lu,"
|
||||
" should be %lu:%lu!\n",
|
||||
(ulong) read_space_id, (ulong) read_page_no,
|
||||
(ulong) block->space, (ulong) block->offset);
|
||||
}
|
||||
/* From version 3.23.38 up we store the page checksum
|
||||
to the 4 first bytes of the page end lsn field */
|
||||
to the 4 first bytes of the page end lsn field */
|
||||
|
||||
if (buf_page_is_corrupted(block->frame)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Database page corruption on disk or a failed\n"
|
||||
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
|
||||
"InnoDB: Database page corruption on disk"
|
||||
" or a failed\n"
|
||||
"InnoDB: file read of page %lu.\n",
|
||||
(ulong) block->offset);
|
||||
|
||||
fputs(
|
||||
"InnoDB: You may have to recover from a backup.\n", stderr);
|
||||
fputs("InnoDB: You may have to recover"
|
||||
" from a backup.\n", stderr);
|
||||
|
||||
buf_page_print(block->frame);
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Database page corruption on disk or a failed\n"
|
||||
"InnoDB: file read of page %lu.\n", (ulong) block->offset);
|
||||
fputs(
|
||||
"InnoDB: You may have to recover from a backup.\n", stderr);
|
||||
fputs(
|
||||
"InnoDB: It is also possible that your operating\n"
|
||||
"InnoDB: system has corrupted its own file cache\n"
|
||||
"InnoDB: and rebooting your computer removes the\n"
|
||||
"InnoDB: error.\n"
|
||||
"InnoDB: If the corrupt page is an index page\n"
|
||||
"InnoDB: you can also try to fix the corruption\n"
|
||||
"InnoDB: by dumping, dropping, and reimporting\n"
|
||||
"InnoDB: the corrupt table. You can use CHECK\n"
|
||||
"InnoDB: TABLE to scan your table for corruption.\n"
|
||||
"InnoDB: See also "
|
||||
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
|
||||
"InnoDB: about forcing recovery.\n", stderr);
|
||||
"InnoDB: Database page corruption on disk"
|
||||
" or a failed\n"
|
||||
"InnoDB: file read of page %lu.\n",
|
||||
(ulong) block->offset);
|
||||
fputs("InnoDB: You may have to recover"
|
||||
" from a backup.\n", stderr);
|
||||
fputs("InnoDB: It is also possible that"
|
||||
" your operating\n"
|
||||
"InnoDB: system has corrupted its"
|
||||
" own file cache\n"
|
||||
"InnoDB: and rebooting your computer"
|
||||
" removes the\n"
|
||||
"InnoDB: error.\n"
|
||||
"InnoDB: If the corrupt page is an index page\n"
|
||||
"InnoDB: you can also try to"
|
||||
" fix the corruption\n"
|
||||
"InnoDB: by dumping, dropping,"
|
||||
" and reimporting\n"
|
||||
"InnoDB: the corrupt table."
|
||||
" You can use CHECK\n"
|
||||
"InnoDB: TABLE to scan your"
|
||||
" table for corruption.\n"
|
||||
"InnoDB: See also"
|
||||
" http://dev.mysql.com/doc/refman/5.1/en/"
|
||||
"forcing-recovery.html\n"
|
||||
"InnoDB: about forcing recovery.\n", stderr);
|
||||
|
||||
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
|
||||
fputs(
|
||||
"InnoDB: Ending processing because of a corrupt database page.\n",
|
||||
stderr);
|
||||
fputs("InnoDB: Ending processing because of"
|
||||
" a corrupt database page.\n",
|
||||
stderr);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (recv_recovery_is_on()) {
|
||||
recv_recover_page(FALSE, TRUE, block->frame,
|
||||
block->space, block->offset);
|
||||
block->space, block->offset);
|
||||
}
|
||||
|
||||
if (!recv_no_ibuf_operations) {
|
||||
ibuf_merge_or_delete_for_page(block->frame,
|
||||
block->space, block->offset, TRUE);
|
||||
ibuf_merge_or_delete_for_page
|
||||
(block->frame, block->space,
|
||||
block->offset, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2058,25 +2098,25 @@ buf_validate(void)
|
|||
if (block->state == BUF_BLOCK_FILE_PAGE) {
|
||||
|
||||
ut_a(buf_page_hash_get(block->space,
|
||||
block->offset) == block);
|
||||
block->offset) == block);
|
||||
n_page++;
|
||||
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a((block->io_fix == BUF_IO_READ)
|
||||
|| ibuf_count_get(block->space, block->offset)
|
||||
== 0);
|
||||
|| ibuf_count_get(block->space, block->offset)
|
||||
== 0);
|
||||
#endif
|
||||
if (block->io_fix == BUF_IO_WRITE) {
|
||||
|
||||
if (block->flush_type == BUF_FLUSH_LRU) {
|
||||
n_lru_flush++;
|
||||
ut_a(rw_lock_is_locked(&(block->lock),
|
||||
RW_LOCK_SHARED));
|
||||
} else if (block->flush_type ==
|
||||
BUF_FLUSH_LIST) {
|
||||
ut_a(rw_lock_is_locked
|
||||
(&block->lock, RW_LOCK_SHARED));
|
||||
} else if (block->flush_type
|
||||
== BUF_FLUSH_LIST) {
|
||||
n_list_flush++;
|
||||
} else if (block->flush_type ==
|
||||
BUF_FLUSH_SINGLE_PAGE) {
|
||||
} else if (block->flush_type
|
||||
== BUF_FLUSH_SINGLE_PAGE) {
|
||||
n_single_flush++;
|
||||
} else {
|
||||
ut_error;
|
||||
|
@ -2085,14 +2125,14 @@ buf_validate(void)
|
|||
} else if (block->io_fix == BUF_IO_READ) {
|
||||
|
||||
ut_a(rw_lock_is_locked(&(block->lock),
|
||||
RW_LOCK_EX));
|
||||
RW_LOCK_EX));
|
||||
}
|
||||
|
||||
n_lru++;
|
||||
|
||||
if (ut_dulint_cmp(block->oldest_modification,
|
||||
ut_dulint_zero) > 0) {
|
||||
n_flush++;
|
||||
ut_dulint_zero) > 0) {
|
||||
n_flush++;
|
||||
}
|
||||
|
||||
} else if (block->state == BUF_BLOCK_NOT_USED) {
|
||||
|
@ -2101,14 +2141,16 @@ buf_validate(void)
|
|||
}
|
||||
|
||||
if (n_lru + n_free > buf_pool->curr_size) {
|
||||
fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free);
|
||||
fprintf(stderr, "n LRU %lu, n free %lu\n",
|
||||
(ulong) n_lru, (ulong) n_free);
|
||||
ut_error;
|
||||
}
|
||||
|
||||
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
|
||||
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
|
||||
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
|
||||
(ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) n_free);
|
||||
(ulong) UT_LIST_GET_LEN(buf_pool->free),
|
||||
(ulong) n_free);
|
||||
ut_error;
|
||||
}
|
||||
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
|
||||
|
@ -2233,9 +2275,9 @@ Returns the number of latched pages in the buffer pool. */
|
|||
ulint
|
||||
buf_get_latched_pages_number(void)
|
||||
{
|
||||
buf_block_t* block;
|
||||
ulint i;
|
||||
ulint fixed_pages_number = 0;
|
||||
buf_block_t* block;
|
||||
ulint i;
|
||||
ulint fixed_pages_number = 0;
|
||||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
|
@ -2243,9 +2285,10 @@ buf_get_latched_pages_number(void)
|
|||
|
||||
block = buf_pool_get_nth_block(buf_pool, i);
|
||||
|
||||
if (((block->buf_fix_count != 0) || (block->io_fix != 0)) &&
|
||||
block->magic_n == BUF_BLOCK_MAGIC_N )
|
||||
if (((block->buf_fix_count != 0) || (block->io_fix != 0))
|
||||
&& block->magic_n == BUF_BLOCK_MAGIC_N) {
|
||||
fixed_pages_number++;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
@ -2261,9 +2304,9 @@ buf_get_n_pending_ios(void)
|
|||
/*=======================*/
|
||||
{
|
||||
return(buf_pool->n_pend_reads
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LRU]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LIST]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LRU]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LIST]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -2280,7 +2323,7 @@ buf_get_modified_ratio_pct(void)
|
|||
|
||||
ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
|
||||
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU)
|
||||
+ UT_LIST_GET_LEN(buf_pool->free));
|
||||
+ UT_LIST_GET_LEN(buf_pool->free));
|
||||
|
||||
/* 1 + is there to avoid division by zero */
|
||||
|
||||
|
@ -2308,12 +2351,14 @@ buf_print_io(
|
|||
|
||||
if (srv_use_awe) {
|
||||
fprintf(stderr,
|
||||
"AWE: Buffer pool memory frames %lu\n",
|
||||
(ulong) buf_pool->n_frames);
|
||||
"AWE: Buffer pool memory frames %lu\n",
|
||||
(ulong) buf_pool->n_frames);
|
||||
|
||||
fprintf(stderr,
|
||||
"AWE: Database pages and free buffers mapped in frames %lu\n",
|
||||
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
|
||||
"AWE: Database pages and free buffers"
|
||||
" mapped in frames %lu\n",
|
||||
(ulong)
|
||||
UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
|
||||
}
|
||||
fprintf(file,
|
||||
"Buffer pool size %lu\n"
|
||||
|
@ -2328,14 +2373,14 @@ buf_print_io(
|
|||
(ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
|
||||
(ulong) buf_pool->n_pend_reads,
|
||||
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU]
|
||||
+ buf_pool->init_flush[BUF_FLUSH_LRU],
|
||||
+ buf_pool->init_flush[BUF_FLUSH_LRU],
|
||||
(ulong) buf_pool->n_flush[BUF_FLUSH_LIST]
|
||||
+ buf_pool->init_flush[BUF_FLUSH_LIST],
|
||||
+ buf_pool->init_flush[BUF_FLUSH_LIST],
|
||||
(ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
|
||||
|
||||
current_time = time(NULL);
|
||||
time_elapsed = 0.001 + difftime(current_time,
|
||||
buf_pool->last_printout_time);
|
||||
buf_pool->last_printout_time);
|
||||
buf_pool->last_printout_time = current_time;
|
||||
|
||||
fprintf(file,
|
||||
|
@ -2353,19 +2398,21 @@ buf_print_io(
|
|||
|
||||
if (srv_use_awe) {
|
||||
fprintf(file, "AWE: %.2f page remaps/s\n",
|
||||
(buf_pool->n_pages_awe_remapped
|
||||
- buf_pool->n_pages_awe_remapped_old)
|
||||
(buf_pool->n_pages_awe_remapped
|
||||
- buf_pool->n_pages_awe_remapped_old)
|
||||
/ time_elapsed);
|
||||
}
|
||||
|
||||
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
|
||||
fprintf(file, "Buffer pool hit rate %lu / 1000\n",
|
||||
(ulong) (1000 -
|
||||
((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
|
||||
/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
|
||||
(ulong)
|
||||
(1000 - ((1000 * (buf_pool->n_pages_read
|
||||
- buf_pool->n_pages_read_old))
|
||||
/ (buf_pool->n_page_gets
|
||||
- buf_pool->n_page_gets_old))));
|
||||
} else {
|
||||
fputs("No buffer pool page gets since the last printout\n",
|
||||
file);
|
||||
file);
|
||||
}
|
||||
|
||||
buf_pool->n_page_gets_old = buf_pool->n_page_gets;
|
||||
|
@ -2416,7 +2463,8 @@ buf_all_freed(void)
|
|||
|
||||
fprintf(stderr,
|
||||
"Page %lu %lu still fixed or dirty\n",
|
||||
(ulong) block->space, (ulong) block->offset);
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
ut_error;
|
||||
}
|
||||
}
|
||||
|
@ -2441,8 +2489,8 @@ buf_pool_check_no_pending_io(void)
|
|||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (buf_pool->n_pend_reads + buf_pool->n_flush[BUF_FLUSH_LRU]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LIST]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
|
||||
+ buf_pool->n_flush[BUF_FLUSH_LIST]
|
||||
+ buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
|
||||
ret = FALSE;
|
||||
} else {
|
||||
ret = TRUE;
|
||||
|
|
|
@ -55,10 +55,9 @@ buf_flush_insert_into_flush_list(
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|
||||
|| (ut_dulint_cmp(
|
||||
(UT_LIST_GET_FIRST(buf_pool->flush_list))
|
||||
->oldest_modification,
|
||||
block->oldest_modification) <= 0));
|
||||
|| (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list))
|
||||
->oldest_modification,
|
||||
block->oldest_modification) <= 0));
|
||||
|
||||
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
|
||||
|
||||
|
@ -86,7 +85,7 @@ buf_flush_insert_sorted_into_flush_list(
|
|||
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
|
||||
|
||||
while (b && (ut_dulint_cmp(b->oldest_modification,
|
||||
block->oldest_modification) > 0)) {
|
||||
block->oldest_modification) > 0)) {
|
||||
prev_b = b;
|
||||
b = UT_LIST_GET_NEXT(flush_list, b);
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ buf_flush_insert_sorted_into_flush_list(
|
|||
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
|
||||
} else {
|
||||
UT_LIST_INSERT_AFTER(flush_list, buf_pool->flush_list, prev_b,
|
||||
block);
|
||||
block);
|
||||
}
|
||||
|
||||
ut_ad(buf_flush_validate_low());
|
||||
|
@ -118,7 +117,8 @@ buf_flush_ready_for_replace(
|
|||
if (block->state != BUF_BLOCK_FILE_PAGE) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: buffer block state %lu in the LRU list!\n",
|
||||
" InnoDB: Error: buffer block state %lu"
|
||||
" in the LRU list!\n",
|
||||
(ulong)block->state);
|
||||
ut_print_buf(stderr, block, sizeof(buf_block_t));
|
||||
|
||||
|
@ -126,8 +126,8 @@ buf_flush_ready_for_replace(
|
|||
}
|
||||
|
||||
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
||||
|| (block->buf_fix_count != 0)
|
||||
|| (block->io_fix != 0)) {
|
||||
|| (block->buf_fix_count != 0)
|
||||
|| (block->io_fix != 0)) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ buf_flush_ready_for_flush(
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
||||
&& (block->io_fix == 0)) {
|
||||
&& (block->io_fix == 0)) {
|
||||
if (flush_type != BUF_FLUSH_LRU) {
|
||||
|
||||
return(TRUE);
|
||||
|
@ -202,10 +202,10 @@ buf_flush_write_complete(
|
|||
}
|
||||
|
||||
/* fprintf(stderr, "n pending flush %lu\n",
|
||||
buf_pool->n_flush[block->flush_type]); */
|
||||
buf_pool->n_flush[block->flush_type]); */
|
||||
|
||||
if ((buf_pool->n_flush[block->flush_type] == 0)
|
||||
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
|
||||
&& (buf_pool->init_flush[block->flush_type] == FALSE)) {
|
||||
|
||||
/* The running flush batch has ended */
|
||||
|
||||
|
@ -255,27 +255,33 @@ buf_flush_buffered_writes(void)
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
|
||||
"InnoDB: before posting to the doublewrite buffer.\n");
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written"
|
||||
" seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match!"
|
||||
" Noticed in the buffer pool\n"
|
||||
"InnoDB: before posting to the"
|
||||
" doublewrite buffer.\n");
|
||||
}
|
||||
|
||||
if (block->check_index_page_at_flush
|
||||
&& !page_simple_validate(block->frame)) {
|
||||
&& !page_simple_validate(block->frame)) {
|
||||
|
||||
buf_page_print(block->frame);
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Apparent corruption of an index page n:o %lu in space %lu\n"
|
||||
"InnoDB: to be written to data file. We intentionally crash server\n"
|
||||
"InnoDB: to prevent corrupt data from ending up in data\n"
|
||||
"InnoDB: files.\n",
|
||||
(ulong) block->offset, (ulong) block->space);
|
||||
" InnoDB: Apparent corruption of an"
|
||||
" index page n:o %lu in space %lu\n"
|
||||
"InnoDB: to be written to data file."
|
||||
" We intentionally crash server\n"
|
||||
"InnoDB: to prevent corrupt data"
|
||||
" from ending up in data\n"
|
||||
"InnoDB: files.\n",
|
||||
(ulong) block->offset, (ulong) block->space);
|
||||
|
||||
ut_error;
|
||||
}
|
||||
|
@ -292,47 +298,54 @@ buf_flush_buffered_writes(void)
|
|||
}
|
||||
|
||||
fil_io(OS_FILE_WRITE,
|
||||
TRUE, TRX_SYS_SPACE,
|
||||
trx_doublewrite->block1, 0, len,
|
||||
(void*)trx_doublewrite->write_buf, NULL);
|
||||
TRUE, TRX_SYS_SPACE,
|
||||
trx_doublewrite->block1, 0, len,
|
||||
(void*)trx_doublewrite->write_buf, NULL);
|
||||
|
||||
write_buf = trx_doublewrite->write_buf;
|
||||
|
||||
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
|
||||
if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
!= mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n");
|
||||
" InnoDB: ERROR: The page to be written"
|
||||
" seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match!"
|
||||
" Noticed in the doublewrite block1.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
len = (trx_doublewrite->first_free
|
||||
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
|
||||
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
|
||||
|
||||
fil_io(OS_FILE_WRITE,
|
||||
TRUE, TRX_SYS_SPACE,
|
||||
trx_doublewrite->block2, 0, len,
|
||||
(void*)(trx_doublewrite->write_buf
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
|
||||
NULL);
|
||||
TRUE, TRX_SYS_SPACE,
|
||||
trx_doublewrite->block2, 0, len,
|
||||
(void*)(trx_doublewrite->write_buf
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
|
||||
* UNIV_PAGE_SIZE),
|
||||
NULL);
|
||||
|
||||
write_buf = trx_doublewrite->write_buf
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
|
||||
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
|
||||
len2 += UNIV_PAGE_SIZE) {
|
||||
len2 += UNIV_PAGE_SIZE) {
|
||||
if (mach_read_from_4(write_buf + len2
|
||||
+ FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(write_buf + len2
|
||||
+ UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
+ FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(write_buf + len2
|
||||
+ UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM
|
||||
+ 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n");
|
||||
" InnoDB: ERROR: The page to be"
|
||||
" written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match!"
|
||||
" Noticed in"
|
||||
" the doublewrite block2.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,14 +362,18 @@ buf_flush_buffered_writes(void)
|
|||
block = trx_doublewrite->buf_block_arr[i];
|
||||
|
||||
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
|
||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: The page to be written seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
|
||||
"InnoDB: after posting and flushing the doublewrite buffer.\n"
|
||||
"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
|
||||
" InnoDB: ERROR: The page to be written"
|
||||
" seems corrupt!\n"
|
||||
"InnoDB: The lsn fields do not match!"
|
||||
" Noticed in the buffer pool\n"
|
||||
"InnoDB: after posting and flushing"
|
||||
" the doublewrite buffer.\n"
|
||||
"InnoDB: Page buf fix count %lu,"
|
||||
" io fix %lu, state %lu\n",
|
||||
(ulong)block->buf_fix_count,
|
||||
(ulong)block->io_fix,
|
||||
(ulong)block->state);
|
||||
|
@ -364,8 +381,8 @@ buf_flush_buffered_writes(void)
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
}
|
||||
|
||||
/* Wake possible simulated aio thread to actually post the
|
||||
|
@ -405,7 +422,7 @@ try_again:
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (trx_doublewrite->first_free
|
||||
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
mutex_exit(&(trx_doublewrite->mutex));
|
||||
|
||||
buf_flush_buffered_writes();
|
||||
|
@ -414,15 +431,15 @@ try_again:
|
|||
}
|
||||
|
||||
ut_memcpy(trx_doublewrite->write_buf
|
||||
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
|
||||
block->frame, UNIV_PAGE_SIZE);
|
||||
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
|
||||
block->frame, UNIV_PAGE_SIZE);
|
||||
|
||||
trx_doublewrite->buf_block_arr[trx_doublewrite->first_free] = block;
|
||||
|
||||
trx_doublewrite->first_free++;
|
||||
|
||||
if (trx_doublewrite->first_free
|
||||
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
>= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
|
||||
mutex_exit(&(trx_doublewrite->mutex));
|
||||
|
||||
buf_flush_buffered_writes();
|
||||
|
@ -448,7 +465,7 @@ buf_flush_init_for_writing(
|
|||
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
|
||||
|
||||
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
|
||||
newest_lsn);
|
||||
newest_lsn);
|
||||
/* Write the page number and the space id */
|
||||
|
||||
mach_write_to_4(page + FIL_PAGE_OFFSET, page_no);
|
||||
|
@ -457,8 +474,9 @@ buf_flush_init_for_writing(
|
|||
/* Store the new formula checksum */
|
||||
|
||||
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
|
||||
srv_use_checksums ?
|
||||
buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
|
||||
srv_use_checksums
|
||||
? buf_calc_page_new_checksum(page)
|
||||
: BUF_NO_CHECKSUM_MAGIC);
|
||||
|
||||
/* We overwrite the first 4 bytes of the end lsn field to store
|
||||
the old formula checksum. Since it depends also on the field
|
||||
|
@ -466,8 +484,9 @@ buf_flush_init_for_writing(
|
|||
new formula checksum. */
|
||||
|
||||
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
|
||||
srv_use_checksums ?
|
||||
buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
|
||||
srv_use_checksums
|
||||
? buf_calc_page_old_checksum(page)
|
||||
: BUF_NO_CHECKSUM_MAGIC);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -493,21 +512,21 @@ buf_flush_write_block_low(
|
|||
#ifdef UNIV_LOG_DEBUG
|
||||
if (!univ_log_debug_warned) {
|
||||
univ_log_debug_warned = TRUE;
|
||||
fputs(
|
||||
"Warning: cannot force log to disk if UNIV_LOG_DEBUG is defined!\n"
|
||||
"Crash recovery will not work!\n",
|
||||
stderr);
|
||||
fputs("Warning: cannot force log to disk if"
|
||||
" UNIV_LOG_DEBUG is defined!\n"
|
||||
"Crash recovery will not work!\n",
|
||||
stderr);
|
||||
}
|
||||
#else
|
||||
/* Force the log to the disk before writing the modified block */
|
||||
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
|
||||
#endif
|
||||
buf_flush_init_for_writing(block->frame, block->newest_modification,
|
||||
block->space, block->offset);
|
||||
block->space, block->offset);
|
||||
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
} else {
|
||||
buf_flush_post_to_doublewrite_buf(block);
|
||||
}
|
||||
|
@ -532,7 +551,7 @@ buf_flush_try_page(
|
|||
ibool locked;
|
||||
|
||||
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
|
||||
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
|
||||
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
|
||||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
|
@ -541,7 +560,7 @@ buf_flush_try_page(
|
|||
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (flush_type == BUF_FLUSH_LIST
|
||||
&& block && buf_flush_ready_for_flush(block, flush_type)) {
|
||||
&& block && buf_flush_ready_for_flush(block, flush_type)) {
|
||||
|
||||
block->io_fix = BUF_IO_WRITE;
|
||||
|
||||
|
@ -600,7 +619,7 @@ buf_flush_try_page(
|
|||
return(1);
|
||||
|
||||
} else if (flush_type == BUF_FLUSH_LRU && block
|
||||
&& buf_flush_ready_for_flush(block, flush_type)) {
|
||||
&& buf_flush_ready_for_flush(block, flush_type)) {
|
||||
|
||||
/* VERY IMPORTANT:
|
||||
Because any thread may call the LRU flush, even when owning
|
||||
|
@ -647,7 +666,7 @@ buf_flush_try_page(
|
|||
return(1);
|
||||
|
||||
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE && block
|
||||
&& buf_flush_ready_for_flush(block, flush_type)) {
|
||||
&& buf_flush_ready_for_flush(block, flush_type)) {
|
||||
|
||||
block->io_fix = BUF_IO_WRITE;
|
||||
|
||||
|
@ -680,9 +699,10 @@ buf_flush_try_page(
|
|||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints) {
|
||||
fprintf(stderr,
|
||||
"Flushing single page space %lu, page no %lu \n",
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
"Flushing single page space %lu,"
|
||||
" page no %lu \n",
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
|
@ -739,7 +759,7 @@ buf_flush_try_neighbors(
|
|||
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (block && flush_type == BUF_FLUSH_LRU && i != offset
|
||||
&& !block->old) {
|
||||
&& !block->old) {
|
||||
|
||||
/* We avoid flushing 'non-old' blocks in an LRU flush,
|
||||
because the flushed blocks are soon freed */
|
||||
|
@ -748,7 +768,7 @@ buf_flush_try_neighbors(
|
|||
}
|
||||
|
||||
if (block && buf_flush_ready_for_flush(block, flush_type)
|
||||
&& (i == offset || block->buf_fix_count == 0)) {
|
||||
&& (i == offset || block->buf_fix_count == 0)) {
|
||||
/* We only try to flush those neighbors != offset
|
||||
where the buf fix count is zero, as we then know that
|
||||
we probably can latch the page without a semaphore
|
||||
|
@ -806,13 +826,13 @@ buf_flush_batch(
|
|||
ibool found;
|
||||
|
||||
ut_ad((flush_type == BUF_FLUSH_LRU)
|
||||
|| (flush_type == BUF_FLUSH_LIST));
|
||||
|| (flush_type == BUF_FLUSH_LIST));
|
||||
ut_ad((flush_type != BUF_FLUSH_LIST)
|
||||
|| sync_thread_levels_empty_gen(TRUE));
|
||||
|| sync_thread_levels_empty_gen(TRUE));
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if ((buf_pool->n_flush[flush_type] > 0)
|
||||
|| (buf_pool->init_flush[flush_type] == TRUE)) {
|
||||
|| (buf_pool->init_flush[flush_type] == TRUE)) {
|
||||
|
||||
/* There is already a flush batch of the same type running */
|
||||
|
||||
|
@ -840,8 +860,8 @@ buf_flush_batch(
|
|||
|
||||
block = UT_LIST_GET_LAST(buf_pool->flush_list);
|
||||
if (!block
|
||||
|| (ut_dulint_cmp(block->oldest_modification,
|
||||
lsn_limit) >= 0)) {
|
||||
|| (ut_dulint_cmp(block->oldest_modification,
|
||||
lsn_limit) >= 0)) {
|
||||
/* We have flushed enough */
|
||||
|
||||
break;
|
||||
|
@ -870,9 +890,8 @@ buf_flush_batch(
|
|||
old_page_count = page_count;
|
||||
|
||||
/* Try to flush also all the neighbors */
|
||||
page_count +=
|
||||
buf_flush_try_neighbors(space, offset,
|
||||
flush_type);
|
||||
page_count += buf_flush_try_neighbors
|
||||
(space, offset, flush_type);
|
||||
/* fprintf(stderr,
|
||||
"Flush type %lu, page no %lu, neighb %lu\n",
|
||||
flush_type, offset,
|
||||
|
@ -900,7 +919,7 @@ buf_flush_batch(
|
|||
(buf_pool->init_flush)[flush_type] = FALSE;
|
||||
|
||||
if ((buf_pool->n_flush[flush_type] == 0)
|
||||
&& (buf_pool->init_flush[flush_type] == FALSE)) {
|
||||
&& (buf_pool->init_flush[flush_type] == FALSE)) {
|
||||
|
||||
/* The running flush batch has ended */
|
||||
|
||||
|
@ -914,7 +933,7 @@ buf_flush_batch(
|
|||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints && page_count > 0) {
|
||||
ut_a(flush_type == BUF_FLUSH_LRU
|
||||
|| flush_type == BUF_FLUSH_LIST);
|
||||
|| flush_type == BUF_FLUSH_LIST);
|
||||
fprintf(stderr, flush_type == BUF_FLUSH_LRU
|
||||
? "Flushed %lu pages in LRU flush\n"
|
||||
: "Flushed %lu pages in flush list flush\n",
|
||||
|
@ -923,7 +942,7 @@ buf_flush_batch(
|
|||
#endif /* UNIV_DEBUG */
|
||||
|
||||
if (page_count != ULINT_UNDEFINED)
|
||||
srv_buf_pool_flushed+= page_count;
|
||||
srv_buf_pool_flushed+= page_count;
|
||||
|
||||
return(page_count);
|
||||
}
|
||||
|
@ -963,9 +982,9 @@ buf_flush_LRU_recommendation(void)
|
|||
block = UT_LIST_GET_LAST(buf_pool->LRU);
|
||||
|
||||
while ((block != NULL)
|
||||
&& (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
|
||||
+ BUF_FLUSH_EXTRA_MARGIN)
|
||||
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) {
|
||||
&& (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
|
||||
+ BUF_FLUSH_EXTRA_MARGIN)
|
||||
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) {
|
||||
|
||||
if (buf_flush_ready_for_replace(block)) {
|
||||
n_replaceable++;
|
||||
|
@ -984,7 +1003,7 @@ buf_flush_LRU_recommendation(void)
|
|||
}
|
||||
|
||||
return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN
|
||||
- n_replaceable);
|
||||
- n_replaceable);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -1005,7 +1024,7 @@ buf_flush_free_margin(void)
|
|||
|
||||
if (n_to_flush > 0) {
|
||||
n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
|
||||
ut_dulint_zero);
|
||||
ut_dulint_zero);
|
||||
if (n_flushed == ULINT_UNDEFINED) {
|
||||
/* There was an LRU type flush batch already running;
|
||||
let us wait for it to end */
|
||||
|
@ -1039,7 +1058,7 @@ buf_flush_validate_low(void)
|
|||
|
||||
if (block) {
|
||||
ut_a(ut_dulint_cmp(om, block->oldest_modification)
|
||||
>= 0);
|
||||
>= 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ scan_again:
|
|||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
if (block->space == id
|
||||
&& (block->buf_fix_count > 0 || block->io_fix != 0)) {
|
||||
&& (block->buf_fix_count > 0 || block->io_fix != 0)) {
|
||||
|
||||
/* We cannot remove this page during this scan yet;
|
||||
maybe the system is currently reading it in, or
|
||||
|
@ -103,8 +103,8 @@ scan_again:
|
|||
if (block->space == id) {
|
||||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints) {
|
||||
printf(
|
||||
"Dropping space %lu page %lu\n",
|
||||
fprintf(stderr,
|
||||
"Dropping space %lu page %lu\n",
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
}
|
||||
|
@ -118,19 +118,19 @@ scan_again:
|
|||
an S-latch on the page */
|
||||
|
||||
btr_search_drop_page_hash_when_freed(id,
|
||||
page_no);
|
||||
page_no);
|
||||
goto scan_again;
|
||||
}
|
||||
|
||||
if (0 != ut_dulint_cmp(block->oldest_modification,
|
||||
ut_dulint_zero)) {
|
||||
ut_dulint_zero)) {
|
||||
|
||||
/* Remove from the flush list of modified
|
||||
blocks */
|
||||
block->oldest_modification = ut_dulint_zero;
|
||||
|
||||
UT_LIST_REMOVE(flush_list,
|
||||
buf_pool->flush_list, block);
|
||||
buf_pool->flush_list, block);
|
||||
}
|
||||
|
||||
/* Remove from the LRU list */
|
||||
|
@ -216,7 +216,8 @@ buf_LRU_search_and_free_block(
|
|||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints) {
|
||||
fprintf(stderr,
|
||||
"Putting space %lu page %lu to free list\n",
|
||||
"Putting space %lu page %lu"
|
||||
" to free list\n",
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
}
|
||||
|
@ -246,8 +247,8 @@ buf_LRU_search_and_free_block(
|
|||
distance++;
|
||||
|
||||
if (!freed && n_iterations <= 10
|
||||
&& distance > 100 + (n_iterations * buf_pool->curr_size)
|
||||
/ 10) {
|
||||
&& distance > 100 + (n_iterations * buf_pool->curr_size)
|
||||
/ 10) {
|
||||
buf_pool->LRU_flush_ended = 0;
|
||||
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
@ -309,7 +310,7 @@ buf_LRU_buf_pool_running_out(void)
|
|||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -340,23 +341,28 @@ loop:
|
|||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: ERROR: over 95 percent of the buffer pool is occupied by\n"
|
||||
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
|
||||
"InnoDB: transactions do not set too many row locks.\n"
|
||||
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
|
||||
"InnoDB: the buffer pool bigger?\n"
|
||||
"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
|
||||
"InnoDB: on Linux!\n",
|
||||
(ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
|
||||
" InnoDB: ERROR: over 95 percent of the buffer pool"
|
||||
" is occupied by\n"
|
||||
"InnoDB: lock heaps or the adaptive hash index!"
|
||||
" Check that your\n"
|
||||
"InnoDB: transactions do not set too many row locks.\n"
|
||||
"InnoDB: Your buffer pool size is %lu MB."
|
||||
" Maybe you should make\n"
|
||||
"InnoDB: the buffer pool bigger?\n"
|
||||
"InnoDB: We intentionally generate a seg fault"
|
||||
" to print a stack trace\n"
|
||||
"InnoDB: on Linux!\n",
|
||||
(ulong) (buf_pool->curr_size
|
||||
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
|
||||
|
||||
ut_error;
|
||||
|
||||
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
|
||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
|
||||
|
||||
if (!buf_lru_switched_on_innodb_mon) {
|
||||
|
||||
|
@ -366,14 +372,20 @@ loop:
|
|||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: WARNING: over 67 percent of the buffer pool is occupied by\n"
|
||||
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
|
||||
"InnoDB: transactions do not set too many row locks.\n"
|
||||
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
|
||||
"InnoDB: the buffer pool bigger?\n"
|
||||
"InnoDB: Starting the InnoDB Monitor to print diagnostics, including\n"
|
||||
"InnoDB: lock heap and hash index sizes.\n",
|
||||
(ulong) (buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
|
||||
" InnoDB: WARNING: over 67 percent of"
|
||||
" the buffer pool is occupied by\n"
|
||||
"InnoDB: lock heaps or the adaptive"
|
||||
" hash index! Check that your\n"
|
||||
"InnoDB: transactions do not set too many"
|
||||
" row locks.\n"
|
||||
"InnoDB: Your buffer pool size is %lu MB."
|
||||
" Maybe you should make\n"
|
||||
"InnoDB: the buffer pool bigger?\n"
|
||||
"InnoDB: Starting the InnoDB Monitor to print"
|
||||
" diagnostics, including\n"
|
||||
"InnoDB: lock heap and hash index sizes.\n",
|
||||
(ulong) (buf_pool->curr_size
|
||||
/ (1024 * 1024 / UNIV_PAGE_SIZE)));
|
||||
|
||||
buf_lru_switched_on_innodb_mon = TRUE;
|
||||
srv_print_innodb_monitor = TRUE;
|
||||
|
@ -405,7 +417,8 @@ loop:
|
|||
/* Remove from the list of mapped pages */
|
||||
|
||||
UT_LIST_REMOVE(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped,
|
||||
block);
|
||||
} else {
|
||||
/* We map the page to a frame; second param
|
||||
FALSE below because we do not want it to be
|
||||
|
@ -440,18 +453,25 @@ loop:
|
|||
if (n_iterations > 30) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: difficult to find free blocks from\n"
|
||||
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
|
||||
"InnoDB: increasing the buffer pool size.\n"
|
||||
"InnoDB: It is also possible that in your Unix version\n"
|
||||
"InnoDB: fsync is very slow, or completely frozen inside\n"
|
||||
"InnoDB: the OS kernel. Then upgrading to a newer version\n"
|
||||
"InnoDB: of your operating system may help. Look at the\n"
|
||||
"InnoDB: number of fsyncs in diagnostic info below.\n"
|
||||
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
|
||||
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
|
||||
"InnoDB: Starting InnoDB Monitor to print further\n"
|
||||
"InnoDB: diagnostics to the standard output.\n",
|
||||
"InnoDB: Warning: difficult to find free blocks from\n"
|
||||
"InnoDB: the buffer pool (%lu search iterations)!"
|
||||
" Consider\n"
|
||||
"InnoDB: increasing the buffer pool size.\n"
|
||||
"InnoDB: It is also possible that"
|
||||
" in your Unix version\n"
|
||||
"InnoDB: fsync is very slow, or"
|
||||
" completely frozen inside\n"
|
||||
"InnoDB: the OS kernel. Then upgrading to"
|
||||
" a newer version\n"
|
||||
"InnoDB: of your operating system may help."
|
||||
" Look at the\n"
|
||||
"InnoDB: number of fsyncs in diagnostic info below.\n"
|
||||
"InnoDB: Pending flushes (fsync) log: %lu;"
|
||||
" buffer pool: %lu\n"
|
||||
"InnoDB: %lu OS file reads, %lu OS file writes,"
|
||||
" %lu OS fsyncs\n"
|
||||
"InnoDB: Starting InnoDB Monitor to print further\n"
|
||||
"InnoDB: diagnostics to the standard output.\n",
|
||||
(ulong) n_iterations,
|
||||
(ulong) fil_n_pending_log_flushes,
|
||||
(ulong) fil_n_pending_tablespace_flushes,
|
||||
|
@ -522,20 +542,20 @@ buf_LRU_old_adjust_len(void)
|
|||
|
||||
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
|
||||
|
||||
buf_pool->LRU_old = UT_LIST_GET_PREV(LRU,
|
||||
buf_pool->LRU_old);
|
||||
buf_pool->LRU_old = UT_LIST_GET_PREV
|
||||
(LRU, buf_pool->LRU_old);
|
||||
(buf_pool->LRU_old)->old = TRUE;
|
||||
buf_pool->LRU_old_len++;
|
||||
|
||||
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
|
||||
|
||||
(buf_pool->LRU_old)->old = FALSE;
|
||||
buf_pool->LRU_old = UT_LIST_GET_NEXT(LRU,
|
||||
buf_pool->LRU_old);
|
||||
buf_pool->LRU_old = UT_LIST_GET_NEXT
|
||||
(LRU, buf_pool->LRU_old);
|
||||
buf_pool->LRU_old_len--;
|
||||
} else {
|
||||
ut_a(buf_pool->LRU_old); /* Check that we did not
|
||||
fall out of the LRU list */
|
||||
fall out of the LRU list */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +633,7 @@ buf_LRU_remove_block(
|
|||
/* Remove from the list of mapped pages */
|
||||
|
||||
UT_LIST_REMOVE(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
}
|
||||
|
||||
/* If the LRU list is so short that LRU_old not defined, return */
|
||||
|
@ -672,7 +692,7 @@ buf_LRU_add_block_to_end_low(
|
|||
/* Add to the list of mapped pages */
|
||||
|
||||
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
}
|
||||
|
||||
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
|
||||
|
@ -729,7 +749,7 @@ buf_LRU_add_block_low(
|
|||
TRUE */
|
||||
|
||||
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
}
|
||||
|
||||
if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) {
|
||||
|
@ -740,7 +760,7 @@ buf_LRU_add_block_low(
|
|||
block->freed_page_clock = buf_pool->freed_page_clock;
|
||||
} else {
|
||||
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old,
|
||||
block);
|
||||
block);
|
||||
buf_pool->LRU_old_len++;
|
||||
|
||||
/* We copy the LRU position field of the previous block
|
||||
|
@ -822,7 +842,7 @@ buf_LRU_block_free_non_file_page(
|
|||
ut_ad(block);
|
||||
|
||||
ut_a((block->state == BUF_BLOCK_MEMORY)
|
||||
|| (block->state == BUF_BLOCK_READY_FOR_USE));
|
||||
|| (block->state == BUF_BLOCK_READY_FOR_USE));
|
||||
|
||||
ut_a(block->n_pointers == 0);
|
||||
ut_a(!block->in_free_list);
|
||||
|
@ -840,7 +860,7 @@ buf_LRU_block_free_non_file_page(
|
|||
/* Add to the list of mapped pages */
|
||||
|
||||
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
buf_pool->awe_LRU_free_mapped, block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -875,16 +895,21 @@ buf_LRU_block_remove_hashed_page(
|
|||
|
||||
if (block != buf_page_hash_get(block->space, block->offset)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: page %lu %lu not found from the hash table\n",
|
||||
"InnoDB: Error: page %lu %lu not found"
|
||||
" in the hash table\n",
|
||||
(ulong) block->space,
|
||||
(ulong) block->offset);
|
||||
if (buf_page_hash_get(block->space, block->offset)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n",
|
||||
(void*) buf_page_hash_get(block->space, block->offset),
|
||||
(ulong) buf_page_hash_get(block->space, block->offset)->space,
|
||||
(ulong) buf_page_hash_get(block->space, block->offset)->offset,
|
||||
(void*) block);
|
||||
"InnoDB: In hash table we find block"
|
||||
" %p of %lu %lu which is not %p\n",
|
||||
(void*) buf_page_hash_get
|
||||
(block->space, block->offset),
|
||||
(ulong) buf_page_hash_get
|
||||
(block->space, block->offset)->space,
|
||||
(ulong) buf_page_hash_get
|
||||
(block->space, block->offset)->offset,
|
||||
(void*) block);
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
|
@ -897,8 +922,8 @@ buf_LRU_block_remove_hashed_page(
|
|||
}
|
||||
|
||||
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
|
||||
buf_page_address_fold(block->space, block->offset),
|
||||
block);
|
||||
buf_page_address_fold(block->space, block->offset),
|
||||
block);
|
||||
|
||||
block->state = BUF_BLOCK_REMOVE_HASH;
|
||||
}
|
||||
|
@ -1009,7 +1034,8 @@ buf_LRU_print(void)
|
|||
ut_ad(buf_pool);
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
|
||||
fprintf(stderr, "Pool ulint clock %lu\n",
|
||||
(ulong) buf_pool->ulint_clock);
|
||||
|
||||
block = UT_LIST_GET_FIRST(buf_pool->LRU);
|
||||
|
||||
|
@ -1033,7 +1059,7 @@ buf_LRU_print(void)
|
|||
}
|
||||
|
||||
if (ut_dulint_cmp(block->oldest_modification,
|
||||
ut_dulint_zero) > 0) {
|
||||
ut_dulint_zero) > 0) {
|
||||
fputs("modif. ", stderr);
|
||||
}
|
||||
|
||||
|
@ -1042,7 +1068,8 @@ buf_LRU_print(void)
|
|||
fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
|
||||
(ulong) block->LRU_position,
|
||||
(ulong) fil_page_get_type(frame),
|
||||
(ulong) ut_dulint_get_low(btr_page_get_index_id(frame)));
|
||||
(ulong) ut_dulint_get_low
|
||||
(btr_page_get_index_id(frame)));
|
||||
|
||||
block = UT_LIST_GET_NEXT(LRU, block);
|
||||
if (++len == 10) {
|
||||
|
|
|
@ -81,32 +81,21 @@ buf_read_page_low(
|
|||
mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
|
||||
|
||||
if (trx_doublewrite && space == TRX_SYS_SPACE
|
||||
&& ( (offset >= trx_doublewrite->block1
|
||||
&& offset < trx_doublewrite->block1
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|
||||
|| (offset >= trx_doublewrite->block2
|
||||
&& offset < trx_doublewrite->block2
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
|
||||
&& ( (offset >= trx_doublewrite->block1
|
||||
&& offset < trx_doublewrite->block1
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|
||||
|| (offset >= trx_doublewrite->block2
|
||||
&& offset < trx_doublewrite->block2
|
||||
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Warning: trying to read doublewrite buffer page %lu\n",
|
||||
" InnoDB: Warning: trying to read"
|
||||
" doublewrite buffer page %lu\n",
|
||||
(ulong) offset);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef UNIV_LOG_DEBUG
|
||||
if (space % 2 == 1) {
|
||||
/* We are updating a replicate space while holding the
|
||||
log mutex: the read must be handled before other reads
|
||||
which might incur ibuf operations and thus write to the log */
|
||||
|
||||
fputs("Log debug: reading replicate page in sync mode\n",
|
||||
stderr);
|
||||
|
||||
sync = TRUE;
|
||||
}
|
||||
#endif
|
||||
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
|
||||
|
||||
/* Trx sys header is so low in the latching order that we play
|
||||
|
@ -123,7 +112,7 @@ buf_read_page_low(
|
|||
pool for read, then DISCARD cannot proceed until the read has
|
||||
completed */
|
||||
block = buf_page_init_for_read(err, mode, space, tablespace_version,
|
||||
offset);
|
||||
offset);
|
||||
if (block == NULL) {
|
||||
|
||||
return(0);
|
||||
|
@ -133,17 +122,17 @@ buf_read_page_low(
|
|||
if (buf_debug_prints) {
|
||||
fprintf(stderr,
|
||||
"Posting read request for page %lu, sync %lu\n",
|
||||
(ulong) offset,
|
||||
(ulong) sync);
|
||||
(ulong) offset,
|
||||
(ulong) sync);
|
||||
}
|
||||
#endif
|
||||
|
||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
*err = fil_io(OS_FILE_READ | wake_later,
|
||||
sync, space,
|
||||
offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
sync, space,
|
||||
offset, 0, UNIV_PAGE_SIZE,
|
||||
(void*)block->frame, (void*)block);
|
||||
ut_a(*err == DB_SUCCESS);
|
||||
|
||||
if (sync) {
|
||||
|
@ -208,9 +197,9 @@ buf_read_ahead_random(
|
|||
tablespace_version = fil_space_get_version(space);
|
||||
|
||||
low = (offset / BUF_READ_AHEAD_RANDOM_AREA)
|
||||
* BUF_READ_AHEAD_RANDOM_AREA;
|
||||
* BUF_READ_AHEAD_RANDOM_AREA;
|
||||
high = (offset / BUF_READ_AHEAD_RANDOM_AREA + 1)
|
||||
* BUF_READ_AHEAD_RANDOM_AREA;
|
||||
* BUF_READ_AHEAD_RANDOM_AREA;
|
||||
if (high > fil_space_get_size(space)) {
|
||||
|
||||
high = fil_space_get_size(space);
|
||||
|
@ -224,8 +213,8 @@ buf_read_ahead_random(
|
|||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (buf_pool->n_pend_reads >
|
||||
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
if (buf_pool->n_pend_reads
|
||||
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
||||
return(0);
|
||||
|
@ -238,8 +227,8 @@ buf_read_ahead_random(
|
|||
block = buf_page_hash_get(space, i);
|
||||
|
||||
if ((block)
|
||||
&& (block->LRU_position > LRU_recent_limit)
|
||||
&& block->accessed) {
|
||||
&& (block->LRU_position > LRU_recent_limit)
|
||||
&& block->accessed) {
|
||||
|
||||
recent_blocks++;
|
||||
}
|
||||
|
@ -268,15 +257,18 @@ buf_read_ahead_random(
|
|||
mode: hence FALSE as the first parameter */
|
||||
|
||||
if (!ibuf_bitmap_page(i)) {
|
||||
count += buf_read_page_low(&err, FALSE, ibuf_mode
|
||||
| OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version, i);
|
||||
count += buf_read_page_low
|
||||
(&err, FALSE,
|
||||
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version, i);
|
||||
if (err == DB_TABLESPACE_DELETED) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Warning: in random readahead trying to access tablespace\n"
|
||||
"InnoDB: %lu page no. %lu,\n"
|
||||
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
|
||||
" InnoDB: Warning: in random"
|
||||
" readahead trying to access\n"
|
||||
"InnoDB: tablespace %lu page %lu,\n"
|
||||
"InnoDB: but the tablespace does not"
|
||||
" exist or is just being dropped.\n",
|
||||
(ulong) space, (ulong) i);
|
||||
}
|
||||
}
|
||||
|
@ -292,8 +284,8 @@ buf_read_ahead_random(
|
|||
if (buf_debug_prints && (count > 0)) {
|
||||
fprintf(stderr,
|
||||
"Random read-ahead space %lu offset %lu pages %lu\n",
|
||||
(ulong) space, (ulong) offset,
|
||||
(ulong) count);
|
||||
(ulong) space, (ulong) offset,
|
||||
(ulong) count);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
|
@ -329,14 +321,16 @@ buf_read_page(
|
|||
switches: hence TRUE */
|
||||
|
||||
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
|
||||
tablespace_version, offset);
|
||||
tablespace_version, offset);
|
||||
srv_buf_pool_reads+= count2;
|
||||
if (err == DB_TABLESPACE_DELETED) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n"
|
||||
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
|
||||
(ulong) space, (ulong) offset);
|
||||
" InnoDB: Error: trying to access"
|
||||
" tablespace %lu page no. %lu,\n"
|
||||
"InnoDB: but the tablespace does not exist"
|
||||
" or is just being dropped.\n",
|
||||
(ulong) space, (ulong) offset);
|
||||
}
|
||||
|
||||
/* Flush pages from the end of the LRU list if necessary */
|
||||
|
@ -407,9 +401,9 @@ buf_read_ahead_linear(
|
|||
}
|
||||
|
||||
low = (offset / BUF_READ_AHEAD_LINEAR_AREA)
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
high = (offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
|
||||
if ((offset != low) && (offset != high - 1)) {
|
||||
/* This is not a border page of the area: return */
|
||||
|
@ -432,8 +426,8 @@ buf_read_ahead_linear(
|
|||
return(0);
|
||||
}
|
||||
|
||||
if (buf_pool->n_pend_reads >
|
||||
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
if (buf_pool->n_pend_reads
|
||||
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
||||
return(0);
|
||||
|
@ -459,9 +453,9 @@ buf_read_ahead_linear(
|
|||
fail_count++;
|
||||
|
||||
} else if (pred_block
|
||||
&& (ut_ulint_cmp(block->LRU_position,
|
||||
pred_block->LRU_position)
|
||||
!= asc_or_desc)) {
|
||||
&& (ut_ulint_cmp(block->LRU_position,
|
||||
pred_block->LRU_position)
|
||||
!= asc_or_desc)) {
|
||||
/* Accesses not in the right order */
|
||||
|
||||
fail_count++;
|
||||
|
@ -469,8 +463,8 @@ buf_read_ahead_linear(
|
|||
}
|
||||
}
|
||||
|
||||
if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
|
||||
BUF_READ_AHEAD_LINEAR_THRESHOLD) {
|
||||
if (fail_count > BUF_READ_AHEAD_LINEAR_AREA
|
||||
- BUF_READ_AHEAD_LINEAR_THRESHOLD) {
|
||||
/* Too many failures: return */
|
||||
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
@ -518,9 +512,9 @@ buf_read_ahead_linear(
|
|||
}
|
||||
|
||||
low = (new_offset / BUF_READ_AHEAD_LINEAR_AREA)
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
high = (new_offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
* BUF_READ_AHEAD_LINEAR_AREA;
|
||||
|
||||
if ((new_offset != low) && (new_offset != high - 1)) {
|
||||
/* This is not a border page of the area: return */
|
||||
|
@ -555,16 +549,19 @@ buf_read_ahead_linear(
|
|||
aio mode: hence FALSE as the first parameter */
|
||||
|
||||
if (!ibuf_bitmap_page(i)) {
|
||||
count += buf_read_page_low(&err, FALSE, ibuf_mode
|
||||
| OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version, i);
|
||||
count += buf_read_page_low
|
||||
(&err, FALSE,
|
||||
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version, i);
|
||||
if (err == DB_TABLESPACE_DELETED) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Warning: in linear readahead trying to access tablespace\n"
|
||||
"InnoDB: %lu page no. %lu,\n"
|
||||
"InnoDB: but the tablespace does not exist or is just being dropped.\n",
|
||||
(ulong) space, (ulong) i);
|
||||
" InnoDB: Warning: in"
|
||||
" linear readahead trying to access\n"
|
||||
"InnoDB: tablespace %lu page %lu,\n"
|
||||
"InnoDB: but the tablespace does not"
|
||||
" exist or is just being dropped.\n",
|
||||
(ulong) space, (ulong) i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,8 +578,8 @@ buf_read_ahead_linear(
|
|||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints && (count > 0)) {
|
||||
fprintf(stderr,
|
||||
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
|
||||
(ulong) space, (ulong) offset, (ulong) count);
|
||||
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
|
||||
(ulong) space, (ulong) offset, (ulong) count);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
|
@ -618,26 +615,24 @@ buf_read_ibuf_merge_pages(
|
|||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a(n_stored < UNIV_PAGE_SIZE);
|
||||
#endif
|
||||
while (buf_pool->n_pend_reads >
|
||||
buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
while (buf_pool->n_pend_reads
|
||||
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
|
||||
os_thread_sleep(500000);
|
||||
}
|
||||
|
||||
for (i = 0; i < n_stored; i++) {
|
||||
if ((i + 1 == n_stored) && sync) {
|
||||
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
|
||||
space_ids[i], space_versions[i], page_nos[i]);
|
||||
} else {
|
||||
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE,
|
||||
space_ids[i], space_versions[i], page_nos[i]);
|
||||
}
|
||||
buf_read_page_low(&err,
|
||||
(i + 1 == n_stored) && sync,
|
||||
BUF_READ_ANY_PAGE,
|
||||
space_ids[i], space_versions[i],
|
||||
page_nos[i]);
|
||||
|
||||
if (err == DB_TABLESPACE_DELETED) {
|
||||
/* We have deleted or are deleting the single-table
|
||||
tablespace: remove the entries for that page */
|
||||
|
||||
ibuf_merge_or_delete_for_page(NULL, space_ids[i],
|
||||
page_nos[i], FALSE);
|
||||
page_nos[i], FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,7 +645,7 @@ buf_read_ibuf_merge_pages(
|
|||
if (buf_debug_prints) {
|
||||
fprintf(stderr,
|
||||
"Ibuf merge read-ahead space %lu pages %lu\n",
|
||||
(ulong) space_ids[0], (ulong) n_stored);
|
||||
(ulong) space_ids[0], (ulong) n_stored);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
}
|
||||
|
@ -691,11 +686,14 @@ buf_read_recv_pages(
|
|||
|
||||
if (count > 100) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
|
||||
"InnoDB: reads to the buffer pool to be finished.\n"
|
||||
"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
|
||||
(ulong) buf_pool->n_pend_reads,
|
||||
(ulong)os_file_n_pending_preads);
|
||||
"InnoDB: Error: InnoDB has waited for"
|
||||
" 50 seconds for pending\n"
|
||||
"InnoDB: reads to the buffer pool to"
|
||||
" be finished.\n"
|
||||
"InnoDB: Number of pending reads %lu,"
|
||||
" pending pread calls %lu\n",
|
||||
(ulong) buf_pool->n_pend_reads,
|
||||
(ulong)os_file_n_pending_preads);
|
||||
|
||||
os_aio_print_debug = TRUE;
|
||||
}
|
||||
|
@ -704,12 +702,14 @@ buf_read_recv_pages(
|
|||
os_aio_print_debug = FALSE;
|
||||
|
||||
if ((i + 1 == n_stored) && sync) {
|
||||
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
|
||||
tablespace_version, page_nos[i]);
|
||||
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
|
||||
space, tablespace_version,
|
||||
page_nos[i]);
|
||||
} else {
|
||||
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
|
||||
| OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version, page_nos[i]);
|
||||
| OS_AIO_SIMULATED_WAKE_LATER,
|
||||
space, tablespace_version,
|
||||
page_nos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,8 @@ buf_read_recv_pages(
|
|||
#ifdef UNIV_DEBUG
|
||||
if (buf_debug_prints) {
|
||||
fprintf(stderr,
|
||||
"Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
|
||||
"Recovery applies read-ahead pages %lu\n",
|
||||
(ulong) n_stored);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
}
|
||||
|
|
|
@ -189,10 +189,10 @@ dfield_check_typed_no_assert(
|
|||
dfield_t* field) /* in: data field */
|
||||
{
|
||||
if (dfield_get_type(field)->mtype > DATA_MYSQL
|
||||
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|
||||
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: data field type %lu, len %lu\n",
|
||||
"InnoDB: Error: data field type %lu, len %lu\n",
|
||||
(ulong) dfield_get_type(field)->mtype,
|
||||
(ulong) dfield_get_len(field));
|
||||
return(FALSE);
|
||||
|
@ -215,9 +215,9 @@ dtuple_check_typed_no_assert(
|
|||
|
||||
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: index entry has %lu fields\n",
|
||||
"InnoDB: Error: index entry has %lu fields\n",
|
||||
(ulong) dtuple_get_n_fields(tuple));
|
||||
dump:
|
||||
dump:
|
||||
fputs("InnoDB: Tuple contents: ", stderr);
|
||||
dtuple_print(stderr, tuple);
|
||||
putc('\n', stderr);
|
||||
|
@ -247,10 +247,10 @@ dfield_check_typed(
|
|||
dfield_t* field) /* in: data field */
|
||||
{
|
||||
if (dfield_get_type(field)->mtype > DATA_MYSQL
|
||||
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|
||||
|| dfield_get_type(field)->mtype < DATA_VARCHAR) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: data field type %lu, len %lu\n",
|
||||
"InnoDB: Error: data field type %lu, len %lu\n",
|
||||
(ulong) dfield_get_type(field)->mtype,
|
||||
(ulong) dfield_get_len(field));
|
||||
|
||||
|
@ -319,8 +319,8 @@ dtuple_validate(
|
|||
for (j = 0; j < len; j++) {
|
||||
|
||||
data_dummy += *data; /* fool the compiler not
|
||||
to optimize out this
|
||||
code */
|
||||
to optimize out this
|
||||
code */
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
@ -433,15 +433,20 @@ dfield_print_also_hex(
|
|||
|
||||
/*****************************************************************
|
||||
Print a dfield value using ut_print_buf. */
|
||||
|
||||
static
|
||||
void
|
||||
dfield_print_raw(
|
||||
/*=============*/
|
||||
FILE* f, /* in: output stream */
|
||||
dfield_t* dfield) /* in: dfield */
|
||||
{
|
||||
if (dfield->len != UNIV_SQL_NULL) {
|
||||
ut_print_buf(f, dfield->data, dfield->len);
|
||||
ulint len = dfield->len;
|
||||
if (len != UNIV_SQL_NULL) {
|
||||
ulint print_len = ut_min(len, 1000);
|
||||
ut_print_buf(f, dfield->data, print_len);
|
||||
if (len != print_len) {
|
||||
fprintf(f, "(total %lu bytes)", (ulong) len);
|
||||
}
|
||||
} else {
|
||||
fputs(" SQL NULL", f);
|
||||
}
|
||||
|
@ -513,14 +518,15 @@ dtuple_convert_big_rec(
|
|||
|
||||
if (UNIV_UNLIKELY(size > 1000000000)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size);
|
||||
"InnoDB: Warning: tuple size very big: %lu\n",
|
||||
(ulong) size);
|
||||
fputs("InnoDB: Tuple contents: ", stderr);
|
||||
dtuple_print(stderr, entry);
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
|
||||
* sizeof(big_rec_field_t) + 1000);
|
||||
* sizeof(big_rec_field_t) + 1000);
|
||||
|
||||
vector = mem_heap_alloc(heap, sizeof(big_rec_t));
|
||||
|
||||
|
@ -534,13 +540,13 @@ dtuple_convert_big_rec(
|
|||
n_fields = 0;
|
||||
|
||||
while (rec_get_converted_size(index, entry)
|
||||
>= ut_min(page_get_free_space_of_empty(
|
||||
dict_table_is_comp(index->table)) / 2,
|
||||
REC_MAX_DATA_SIZE)) {
|
||||
>= ut_min(page_get_free_space_of_empty
|
||||
(dict_table_is_comp(index->table)) / 2,
|
||||
REC_MAX_DATA_SIZE)) {
|
||||
|
||||
longest = 0;
|
||||
for (i = dict_index_get_n_unique_in_tree(index);
|
||||
i < dtuple_get_n_fields(entry); i++) {
|
||||
i < dtuple_get_n_fields(entry); i++) {
|
||||
|
||||
/* Skip over fields which already are externally
|
||||
stored */
|
||||
|
@ -559,8 +565,8 @@ dtuple_convert_big_rec(
|
|||
|
||||
dfield = dtuple_get_nth_field(entry, i);
|
||||
|
||||
if (dfield->len != UNIV_SQL_NULL &&
|
||||
dfield->len > longest) {
|
||||
if (dfield->len != UNIV_SQL_NULL
|
||||
&& dfield->len > longest) {
|
||||
|
||||
longest = dfield->len;
|
||||
|
||||
|
@ -577,7 +583,7 @@ dtuple_convert_big_rec(
|
|||
#endif
|
||||
|
||||
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
|
||||
+ DICT_MAX_INDEX_COL_LEN) {
|
||||
+ DICT_MAX_INDEX_COL_LEN) {
|
||||
/* Cannot shorten more */
|
||||
|
||||
mem_heap_free(heap);
|
||||
|
@ -602,24 +608,24 @@ dtuple_convert_big_rec(
|
|||
ut_a(dfield->len > DICT_MAX_INDEX_COL_LEN);
|
||||
|
||||
vector->fields[n_fields].len = dfield->len
|
||||
- DICT_MAX_INDEX_COL_LEN;
|
||||
- DICT_MAX_INDEX_COL_LEN;
|
||||
|
||||
vector->fields[n_fields].data = mem_heap_alloc(heap,
|
||||
vector->fields[n_fields].len);
|
||||
vector->fields[n_fields].data = mem_heap_alloc
|
||||
(heap, vector->fields[n_fields].len);
|
||||
|
||||
/* Copy data (from the end of field) to big rec vector */
|
||||
|
||||
ut_memcpy(vector->fields[n_fields].data,
|
||||
((byte*)dfield->data) + dfield->len
|
||||
- vector->fields[n_fields].len,
|
||||
vector->fields[n_fields].len);
|
||||
((byte*)dfield->data) + dfield->len
|
||||
- vector->fields[n_fields].len,
|
||||
vector->fields[n_fields].len);
|
||||
dfield->len = dfield->len - vector->fields[n_fields].len
|
||||
+ BTR_EXTERN_FIELD_REF_SIZE;
|
||||
+ BTR_EXTERN_FIELD_REF_SIZE;
|
||||
|
||||
/* Set the extern field reference in dfield to zero */
|
||||
memset(((byte*)dfield->data)
|
||||
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
|
||||
0, BTR_EXTERN_FIELD_REF_SIZE);
|
||||
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
|
||||
0, BTR_EXTERN_FIELD_REF_SIZE);
|
||||
n_fields++;
|
||||
}
|
||||
|
||||
|
@ -646,15 +652,15 @@ dtuple_convert_back_big_rec(
|
|||
for (i = 0; i < vector->n_fields; i++) {
|
||||
|
||||
dfield = dtuple_get_nth_field(entry,
|
||||
vector->fields[i].field_no);
|
||||
vector->fields[i].field_no);
|
||||
/* Copy data from big rec vector */
|
||||
|
||||
ut_memcpy(((byte*)dfield->data)
|
||||
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
|
||||
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
|
||||
vector->fields[i].data,
|
||||
vector->fields[i].len);
|
||||
dfield->len = dfield->len + vector->fields[i].len
|
||||
- BTR_EXTERN_FIELD_REF_SIZE;
|
||||
- BTR_EXTERN_FIELD_REF_SIZE;
|
||||
}
|
||||
|
||||
mem_heap_free(vector->heap);
|
||||
|
|
|
@ -67,9 +67,9 @@ dtype_get_at_most_n_mbchars(
|
|||
|
||||
if (dtype->mbminlen != dtype->mbmaxlen) {
|
||||
ut_a(!(prefix_len % dtype->mbmaxlen));
|
||||
return(innobase_get_at_most_n_mbchars(
|
||||
dtype_get_charset_coll(dtype->prtype),
|
||||
prefix_len, data_len, str));
|
||||
return(innobase_get_at_most_n_mbchars
|
||||
(dtype_get_charset_coll(dtype->prtype),
|
||||
prefix_len, data_len, str));
|
||||
}
|
||||
|
||||
if (prefix_len < data_len) {
|
||||
|
@ -98,8 +98,8 @@ dtype_is_string_type(
|
|||
ulint mtype) /* in: InnoDB main data type code: DATA_CHAR, ... */
|
||||
{
|
||||
if (mtype <= DATA_BLOB
|
||||
|| mtype == DATA_MYSQL
|
||||
|| mtype == DATA_VARMYSQL) {
|
||||
|| mtype == DATA_MYSQL
|
||||
|| mtype == DATA_VARMYSQL) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ dtype_is_binary_string_type(
|
|||
ulint prtype) /* in: precise type */
|
||||
{
|
||||
if ((mtype == DATA_FIXBINARY)
|
||||
|| (mtype == DATA_BINARY)
|
||||
|| (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
|
||||
|| (mtype == DATA_BINARY)
|
||||
|| (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ dtype_is_non_binary_string_type(
|
|||
ulint prtype) /* in: precise type */
|
||||
{
|
||||
if (dtype_is_string_type(mtype) == TRUE
|
||||
&& dtype_is_binary_string_type(mtype, prtype) == FALSE) {
|
||||
&& dtype_is_binary_string_type(mtype, prtype) == FALSE) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -258,9 +258,9 @@ dtype_print(
|
|||
len = type->len;
|
||||
|
||||
if ((type->mtype == DATA_SYS)
|
||||
|| (type->mtype == DATA_VARCHAR)
|
||||
|| (type->mtype == DATA_CHAR)) {
|
||||
putc(' ', stderr);
|
||||
|| (type->mtype == DATA_VARCHAR)
|
||||
|| (type->mtype == DATA_CHAR)) {
|
||||
putc(' ', stderr);
|
||||
if (prtype == DATA_ROW_ID) {
|
||||
fputs("DATA_ROW_ID", stderr);
|
||||
len = DATA_ROW_ID_LEN;
|
||||
|
@ -317,9 +317,9 @@ dtype_get_max_size(
|
|||
case DATA_BINARY:
|
||||
case DATA_DECIMAL:
|
||||
case DATA_VARMYSQL:
|
||||
return(type->len);
|
||||
return(type->len);
|
||||
case DATA_BLOB:
|
||||
return(ULINT_MAX);
|
||||
return(ULINT_MAX);
|
||||
default:
|
||||
ut_error;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ dict_hdr_get(
|
|||
ut_ad(mtr);
|
||||
|
||||
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
|
||||
RW_X_LATCH, mtr);
|
||||
RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
@ -59,7 +59,7 @@ dict_hdr_get_new_id(
|
|||
mtr_t mtr;
|
||||
|
||||
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
|
||||
|| (type == DICT_HDR_MIX_ID));
|
||||
|| (type == DICT_HDR_MIX_ID));
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
|
@ -122,7 +122,7 @@ dict_hdr_create(
|
|||
/* Create the dictionary header file block in a new, allocated file
|
||||
segment in the system tablespace */
|
||||
page = fseg_create(DICT_HDR_SPACE, 0,
|
||||
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
|
||||
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
|
||||
|
||||
hdr_page_no = buf_frame_get_page_no(page);
|
||||
|
||||
|
@ -133,70 +133,70 @@ dict_hdr_create(
|
|||
/* Start counting row, table, index, and tree ids from
|
||||
DICT_HDR_FIRST_ID */
|
||||
mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
|
||||
mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
|
||||
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
|
||||
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||
|
||||
/* Create the B-tree roots for the clustered indexes of the basic
|
||||
system tables */
|
||||
|
||||
/*--------------------------*/
|
||||
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
|
||||
DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
|
||||
DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no,
|
||||
MLOG_4BYTES, mtr);
|
||||
MLOG_4BYTES, mtr);
|
||||
/*--------------------------*/
|
||||
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE,
|
||||
DICT_TABLE_IDS_ID, FALSE, mtr);
|
||||
DICT_TABLE_IDS_ID, FALSE, mtr);
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
mlog_write_ulint(dict_header + DICT_HDR_TABLE_IDS, root_page_no,
|
||||
MLOG_4BYTES, mtr);
|
||||
MLOG_4BYTES, mtr);
|
||||
/*--------------------------*/
|
||||
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
|
||||
DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
|
||||
DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
mlog_write_ulint(dict_header + DICT_HDR_COLUMNS, root_page_no,
|
||||
MLOG_4BYTES, mtr);
|
||||
MLOG_4BYTES, mtr);
|
||||
/*--------------------------*/
|
||||
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
|
||||
DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
|
||||
DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
mlog_write_ulint(dict_header + DICT_HDR_INDEXES, root_page_no,
|
||||
MLOG_4BYTES, mtr);
|
||||
MLOG_4BYTES, mtr);
|
||||
/*--------------------------*/
|
||||
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
|
||||
DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
|
||||
DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
mlog_write_ulint(dict_header + DICT_HDR_FIELDS, root_page_no,
|
||||
MLOG_4BYTES, mtr);
|
||||
MLOG_4BYTES, mtr);
|
||||
/*--------------------------*/
|
||||
|
||||
return(TRUE);
|
||||
|
@ -236,11 +236,11 @@ dict_boot(void)
|
|||
..._MARGIN, it will immediately be updated to the disk-based
|
||||
header. */
|
||||
|
||||
dict_sys->row_id = ut_dulint_add(
|
||||
ut_dulint_align_up(
|
||||
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID, &mtr),
|
||||
DICT_HDR_ROW_ID_WRITE_MARGIN),
|
||||
DICT_HDR_ROW_ID_WRITE_MARGIN);
|
||||
dict_sys->row_id = ut_dulint_add
|
||||
(ut_dulint_align_up(mtr_read_dulint
|
||||
(dict_hdr + DICT_HDR_ROW_ID, &mtr),
|
||||
DICT_HDR_ROW_ID_WRITE_MARGIN),
|
||||
DICT_HDR_ROW_ID_WRITE_MARGIN);
|
||||
|
||||
/* Insert into the dictionary cache the descriptions of the basic
|
||||
system tables */
|
||||
|
@ -262,23 +262,27 @@ dict_boot(void)
|
|||
dict_sys->sys_tables = table;
|
||||
|
||||
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
|
||||
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
|
||||
DICT_HDR_SPACE,
|
||||
DICT_UNIQUE | DICT_CLUSTERED, 1);
|
||||
|
||||
dict_mem_index_add_field(index, "NAME", 0);
|
||||
|
||||
index->id = DICT_TABLES_ID;
|
||||
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
|
||||
dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr));
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint
|
||||
(dict_hdr + DICT_HDR_TABLES,
|
||||
MLOG_4BYTES, &mtr));
|
||||
ut_a(success);
|
||||
/*-------------------------*/
|
||||
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
|
||||
DICT_HDR_SPACE, DICT_UNIQUE, 1);
|
||||
DICT_HDR_SPACE, DICT_UNIQUE, 1);
|
||||
dict_mem_index_add_field(index, "ID", 0);
|
||||
|
||||
index->id = DICT_TABLE_IDS_ID;
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
|
||||
dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr));
|
||||
success = dict_index_add_to_cache(table, index,
|
||||
mtr_read_ulint
|
||||
(dict_hdr + DICT_HDR_TABLE_IDS,
|
||||
MLOG_4BYTES, &mtr));
|
||||
ut_a(success);
|
||||
/*-------------------------*/
|
||||
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
|
||||
|
@ -297,14 +301,16 @@ dict_boot(void)
|
|||
dict_sys->sys_columns = table;
|
||||
|
||||
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
|
||||
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
DICT_HDR_SPACE,
|
||||
DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
|
||||
dict_mem_index_add_field(index, "TABLE_ID", 0);
|
||||
dict_mem_index_add_field(index, "POS", 0);
|
||||
|
||||
index->id = DICT_COLUMNS_ID;
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
|
||||
dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr));
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint
|
||||
(dict_hdr + DICT_HDR_COLUMNS,
|
||||
MLOG_4BYTES, &mtr));
|
||||
ut_a(success);
|
||||
/*-------------------------*/
|
||||
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
|
||||
|
@ -333,14 +339,16 @@ dict_boot(void)
|
|||
dict_sys->sys_indexes = table;
|
||||
|
||||
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
|
||||
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
DICT_HDR_SPACE,
|
||||
DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
|
||||
dict_mem_index_add_field(index, "TABLE_ID", 0);
|
||||
dict_mem_index_add_field(index, "ID", 0);
|
||||
|
||||
index->id = DICT_INDEXES_ID;
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
|
||||
dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr));
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint
|
||||
(dict_hdr + DICT_HDR_INDEXES,
|
||||
MLOG_4BYTES, &mtr));
|
||||
ut_a(success);
|
||||
/*-------------------------*/
|
||||
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
|
||||
|
@ -354,14 +362,16 @@ dict_boot(void)
|
|||
dict_sys->sys_fields = table;
|
||||
|
||||
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
|
||||
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
DICT_HDR_SPACE,
|
||||
DICT_UNIQUE | DICT_CLUSTERED, 2);
|
||||
|
||||
dict_mem_index_add_field(index, "INDEX_ID", 0);
|
||||
dict_mem_index_add_field(index, "POS", 0);
|
||||
|
||||
index->id = DICT_FIELDS_ID;
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint(
|
||||
dict_hdr + DICT_HDR_FIELDS, MLOG_4BYTES, &mtr));
|
||||
success = dict_index_add_to_cache(table, index, mtr_read_ulint
|
||||
(dict_hdr + DICT_HDR_FIELDS,
|
||||
MLOG_4BYTES, &mtr));
|
||||
ut_a(success);
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
|
|
@ -69,7 +69,7 @@ dict_create_sys_tables_tuple(
|
|||
|
||||
ptr = mem_heap_alloc(heap, 4);
|
||||
mach_write_to_4(ptr, table->n_def
|
||||
| ((table->flags & DICT_TF_COMPACT) << 31));
|
||||
| ((table->flags & DICT_TF_COMPACT) << 31));
|
||||
dfield_set_data(dfield, ptr, 4);
|
||||
/* 5: TYPE -----------------------------*/
|
||||
dfield = dtuple_get_nth_field(entry, 3);
|
||||
|
@ -222,8 +222,8 @@ dict_build_table_def_step(
|
|||
|
||||
row_len = 0;
|
||||
for (i = 0; i < table->n_def; i++) {
|
||||
row_len += dtype_get_min_size(dict_col_get_type(
|
||||
&table->cols[i]));
|
||||
row_len += dtype_get_min_size(dict_col_get_type
|
||||
(&table->cols[i]));
|
||||
}
|
||||
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
|
||||
return(DB_TOO_BIG_RECORD);
|
||||
|
@ -236,7 +236,7 @@ dict_build_table_def_step(
|
|||
- page 1 is an ibuf bitmap page,
|
||||
- page 2 is the first inode page,
|
||||
- page 3 will contain the root of the clustered index of the
|
||||
table we create here. */
|
||||
table we create here. */
|
||||
|
||||
table->space = 0; /* reset to zero for the call below */
|
||||
|
||||
|
@ -251,9 +251,9 @@ dict_build_table_def_step(
|
|||
is_path = FALSE;
|
||||
}
|
||||
|
||||
error = fil_create_new_single_table_tablespace(
|
||||
&(table->space), path_or_name, is_path,
|
||||
FIL_IBD_FILE_INITIAL_SIZE);
|
||||
error = fil_create_new_single_table_tablespace
|
||||
(&table->space, path_or_name, is_path,
|
||||
FIL_IBD_FILE_INITIAL_SIZE);
|
||||
if (error != DB_SUCCESS) {
|
||||
|
||||
return(error);
|
||||
|
@ -285,7 +285,7 @@ dict_build_col_def_step(
|
|||
dtuple_t* row;
|
||||
|
||||
row = dict_create_sys_columns_tuple(node->table, node->col_no,
|
||||
node->heap);
|
||||
node->heap);
|
||||
ins_node_set_new_row(node->col_def, row);
|
||||
|
||||
return(DB_SUCCESS);
|
||||
|
@ -450,7 +450,7 @@ dict_create_sys_fields_tuple(
|
|||
dfield = dtuple_get_nth_field(entry, 2);
|
||||
|
||||
dfield_set_data(dfield, field->name,
|
||||
ut_strlen(field->name));
|
||||
ut_strlen(field->name));
|
||||
/*---------------------------------*/
|
||||
|
||||
dict_table_copy_types(entry, sys_fields);
|
||||
|
@ -528,7 +528,7 @@ dict_build_index_def_step(
|
|||
node->table = table;
|
||||
|
||||
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|
||||
|| (index->type & DICT_CLUSTERED));
|
||||
|| (index->type & DICT_CLUSTERED));
|
||||
|
||||
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
|
||||
|
||||
|
@ -600,19 +600,19 @@ dict_create_index_tree_step(
|
|||
search_tuple = dict_create_search_tuple(node->ind_row, node->heap);
|
||||
|
||||
btr_pcur_open(UT_LIST_GET_FIRST(sys_indexes->indexes),
|
||||
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
|
||||
&pcur, &mtr);
|
||||
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
|
||||
&pcur, &mtr);
|
||||
|
||||
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
||||
|
||||
node->page_no = btr_create(index->type, index->space, index->id,
|
||||
dict_table_is_comp(table), &mtr);
|
||||
dict_table_is_comp(table), &mtr);
|
||||
/* printf("Created a new index tree in space %lu root page %lu\n",
|
||||
index->space, index->page_no); */
|
||||
index->space, index->page_no); */
|
||||
|
||||
page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
|
||||
DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
||||
node->page_no, &mtr);
|
||||
DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
||||
node->page_no, &mtr);
|
||||
btr_pcur_close(&pcur);
|
||||
mtr_commit(&mtr);
|
||||
|
||||
|
@ -657,7 +657,7 @@ dict_drop_index_tree(
|
|||
}
|
||||
|
||||
ptr = rec_get_nth_field_old(rec,
|
||||
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
|
||||
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
|
||||
|
||||
ut_ad(len == 4);
|
||||
|
||||
|
@ -680,11 +680,12 @@ dict_drop_index_tree(
|
|||
record: this mini-transaction marks the B-tree totally freed */
|
||||
|
||||
/* printf("Dropping index tree in space %lu root page %lu\n", space,
|
||||
root_page_no); */
|
||||
root_page_no); */
|
||||
btr_free_root(space, root_page_no, mtr);
|
||||
|
||||
page_rec_write_index_page_no(rec,
|
||||
DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr);
|
||||
DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
||||
FIL_NULL, mtr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -732,7 +733,7 @@ dict_truncate_index_tree(
|
|||
}
|
||||
|
||||
ptr = rec_get_nth_field_old(rec,
|
||||
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
|
||||
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
|
||||
|
||||
ut_ad(len == 4);
|
||||
|
||||
|
@ -749,7 +750,7 @@ dict_truncate_index_tree(
|
|||
}
|
||||
|
||||
ptr = rec_get_nth_field_old(rec,
|
||||
DICT_SYS_INDEXES_TYPE_FIELD, &len);
|
||||
DICT_SYS_INDEXES_TYPE_FIELD, &len);
|
||||
ut_ad(len == 4);
|
||||
type = mach_read_from_4(ptr);
|
||||
|
||||
|
@ -767,8 +768,8 @@ dict_truncate_index_tree(
|
|||
appropriate field in the SYS_INDEXES record: this mini-transaction
|
||||
marks the B-tree totally truncated */
|
||||
|
||||
comp = page_is_comp(btr_page_get(
|
||||
space, root_page_no, RW_X_LATCH, mtr));
|
||||
comp = page_is_comp(btr_page_get
|
||||
(space, root_page_no, RW_X_LATCH, mtr));
|
||||
|
||||
btr_free_root(space, root_page_no, mtr);
|
||||
/* We will temporarily write FIL_NULL to the PAGE_NO field
|
||||
|
@ -776,7 +777,7 @@ dict_truncate_index_tree(
|
|||
inconsistent state in case it crashes between the mtr_commit()
|
||||
below and the following mtr_commit() call. */
|
||||
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
||||
FIL_NULL, mtr);
|
||||
FIL_NULL, mtr);
|
||||
|
||||
/* We will need to commit the mini-transaction in order to avoid
|
||||
deadlocks in the btr_create() call, because otherwise we would
|
||||
|
@ -788,8 +789,8 @@ dict_truncate_index_tree(
|
|||
|
||||
/* Find the index corresponding to this SYS_INDEXES record. */
|
||||
for (index = UT_LIST_GET_FIRST(table->indexes);
|
||||
index;
|
||||
index = UT_LIST_GET_NEXT(indexes, index)) {
|
||||
index;
|
||||
index = UT_LIST_GET_NEXT(indexes, index)) {
|
||||
if (!ut_dulint_cmp(index->id, index_id)) {
|
||||
break;
|
||||
}
|
||||
|
@ -834,11 +835,11 @@ tab_create_graph_create(
|
|||
node->heap = mem_heap_create(256);
|
||||
|
||||
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
|
||||
heap);
|
||||
heap);
|
||||
node->tab_def->common.parent = node;
|
||||
|
||||
node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns,
|
||||
heap);
|
||||
heap);
|
||||
node->col_def->common.parent = node;
|
||||
|
||||
node->commit_node = commit_node_create(heap);
|
||||
|
@ -871,11 +872,11 @@ ind_create_graph_create(
|
|||
node->heap = mem_heap_create(256);
|
||||
|
||||
node->ind_def = ins_node_create(INS_DIRECT,
|
||||
dict_sys->sys_indexes, heap);
|
||||
dict_sys->sys_indexes, heap);
|
||||
node->ind_def->common.parent = node;
|
||||
|
||||
node->field_def = ins_node_create(INS_DIRECT,
|
||||
dict_sys->sys_fields, heap);
|
||||
dict_sys->sys_fields, heap);
|
||||
node->field_def->common.parent = node;
|
||||
|
||||
node->commit_node = commit_node_create(heap);
|
||||
|
@ -1088,7 +1089,7 @@ dict_create_index_step(
|
|||
if (node->state == INDEX_ADD_TO_CACHE) {
|
||||
|
||||
success = dict_index_add_to_cache(node->table, node->index,
|
||||
node->page_no);
|
||||
node->page_no);
|
||||
|
||||
ut_a(success);
|
||||
|
||||
|
@ -1136,8 +1137,8 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
|
||||
|
||||
if (table1 && table2
|
||||
&& UT_LIST_GET_LEN(table1->indexes) == 3
|
||||
&& UT_LIST_GET_LEN(table2->indexes) == 1) {
|
||||
&& UT_LIST_GET_LEN(table1->indexes) == 3
|
||||
&& UT_LIST_GET_LEN(table2->indexes) == 1) {
|
||||
|
||||
/* Foreign constraint system tables have already been
|
||||
created, and they are ok */
|
||||
|
@ -1157,13 +1158,15 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
|
||||
if (table1) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: dropping incompletely created SYS_FOREIGN table\n");
|
||||
"InnoDB: dropping incompletely created"
|
||||
" SYS_FOREIGN table\n");
|
||||
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
|
||||
}
|
||||
|
||||
if (table2) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n");
|
||||
"InnoDB: dropping incompletely created"
|
||||
" SYS_FOREIGN_COLS table\n");
|
||||
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
|
||||
}
|
||||
|
||||
|
@ -1181,19 +1184,25 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
design. */
|
||||
|
||||
error = que_eval_sql(NULL,
|
||||
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
|
||||
"BEGIN\n"
|
||||
"CREATE TABLE\n"
|
||||
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n"
|
||||
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n"
|
||||
"CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n"
|
||||
"CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n"
|
||||
"CREATE TABLE\n"
|
||||
"SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
|
||||
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
|
||||
"COMMIT WORK;\n"
|
||||
"END;\n"
|
||||
, FALSE, trx);
|
||||
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
|
||||
"BEGIN\n"
|
||||
"CREATE TABLE\n"
|
||||
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR,"
|
||||
" REF_NAME CHAR, N_COLS INT);\n"
|
||||
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
|
||||
" ON SYS_FOREIGN (ID);\n"
|
||||
"CREATE INDEX FOR_IND"
|
||||
" ON SYS_FOREIGN (FOR_NAME);\n"
|
||||
"CREATE INDEX REF_IND"
|
||||
" ON SYS_FOREIGN (REF_NAME);\n"
|
||||
"CREATE TABLE\n"
|
||||
"SYS_FOREIGN_COLS(ID CHAR, POS INT,"
|
||||
" FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
|
||||
"CREATE UNIQUE CLUSTERED INDEX ID_IND"
|
||||
" ON SYS_FOREIGN_COLS (ID, POS);\n"
|
||||
"COMMIT WORK;\n"
|
||||
"END;\n"
|
||||
, FALSE, trx);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
fprintf(stderr, "InnoDB: error %lu in creation\n",
|
||||
|
@ -1201,10 +1210,11 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
|
||||
ut_a(error == DB_OUT_OF_FILE_SPACE);
|
||||
|
||||
fprintf(stderr, "InnoDB: creation failed\n");
|
||||
fprintf(stderr, "InnoDB: tablespace is full\n");
|
||||
fprintf(stderr,
|
||||
"InnoDB: dropping incompletely created SYS_FOREIGN tables\n");
|
||||
"InnoDB: creation failed\n"
|
||||
"InnoDB: tablespace is full\n"
|
||||
"InnoDB: dropping incompletely created"
|
||||
" SYS_FOREIGN tables\n");
|
||||
|
||||
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
|
||||
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
|
||||
|
@ -1220,7 +1230,8 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
|
||||
if (error == DB_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Foreign key constraint system tables created\n");
|
||||
"InnoDB: Foreign key constraint system tables"
|
||||
" created\n");
|
||||
}
|
||||
|
||||
return(error);
|
||||
|
@ -1249,22 +1260,22 @@ dict_foreign_eval_sql(
|
|||
rewind(ef);
|
||||
ut_print_timestamp(ef);
|
||||
fputs(" Error in foreign key constraint creation for table ",
|
||||
ef);
|
||||
ef);
|
||||
ut_print_name(ef, trx, TRUE, table->name);
|
||||
fputs(".\nA foreign key constraint of name ", ef);
|
||||
ut_print_name(ef, trx, FALSE, foreign->id);
|
||||
fputs("\nalready exists."
|
||||
" (Note that internally InnoDB adds 'databasename/'\n"
|
||||
"in front of the user-defined constraint name).\n",
|
||||
ef);
|
||||
" (Note that internally InnoDB adds 'databasename/'\n"
|
||||
"in front of the user-defined constraint name).\n",
|
||||
ef);
|
||||
fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
|
||||
"constraint names as case-insensitive, with the\n"
|
||||
"MySQL standard latin1_swedish_ci collation. If you\n"
|
||||
"create tables or databases whose names differ only in\n"
|
||||
"the character case, then collisions in constraint\n"
|
||||
"names can occur. Workaround: name your constraints\n"
|
||||
"explicitly with unique names.\n",
|
||||
ef);
|
||||
"constraint names as case-insensitive, with the\n"
|
||||
"MySQL standard latin1_swedish_ci collation. If you\n"
|
||||
"create tables or databases whose names differ only in\n"
|
||||
"the character case, then collisions in constraint\n"
|
||||
"names can occur. Workaround: name your constraints\n"
|
||||
"explicitly with unique names.\n",
|
||||
ef);
|
||||
|
||||
mutex_exit(&dict_foreign_err_mutex);
|
||||
|
||||
|
@ -1279,10 +1290,11 @@ dict_foreign_eval_sql(
|
|||
mutex_enter(&dict_foreign_err_mutex);
|
||||
ut_print_timestamp(ef);
|
||||
fputs(" Internal error in foreign key constraint creation"
|
||||
" for table ", ef);
|
||||
" for table ", ef);
|
||||
ut_print_name(ef, trx, TRUE, table->name);
|
||||
fputs(".\n"
|
||||
"See the MySQL .err log in the datadir for more information.\n", ef);
|
||||
"See the MySQL .err log in the datadir"
|
||||
" for more information.\n", ef);
|
||||
mutex_exit(&dict_foreign_err_mutex);
|
||||
|
||||
return(error);
|
||||
|
@ -1311,18 +1323,18 @@ dict_create_add_foreign_field_to_dictionary(
|
|||
pars_info_add_int4_literal(info, "pos", field_nr);
|
||||
|
||||
pars_info_add_str_literal(info, "for_col_name",
|
||||
foreign->foreign_col_names[field_nr]);
|
||||
foreign->foreign_col_names[field_nr]);
|
||||
|
||||
pars_info_add_str_literal(info, "ref_col_name",
|
||||
foreign->referenced_col_names[field_nr]);
|
||||
foreign->referenced_col_names[field_nr]);
|
||||
|
||||
return dict_foreign_eval_sql(info,
|
||||
"PROCEDURE P () IS\n"
|
||||
return(dict_foreign_eval_sql
|
||||
(info, "PROCEDURE P () IS\n"
|
||||
"BEGIN\n"
|
||||
"INSERT INTO SYS_FOREIGN_COLS VALUES"
|
||||
"(:id, :pos, :for_col_name, :ref_col_name);\n"
|
||||
"END;\n"
|
||||
, table, foreign, trx);
|
||||
"END;\n",
|
||||
table, foreign, trx));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -1362,18 +1374,18 @@ dict_create_add_foreign_to_dictionary(
|
|||
pars_info_add_str_literal(info, "for_name", table->name);
|
||||
|
||||
pars_info_add_str_literal(info, "ref_name",
|
||||
foreign->referenced_table_name);
|
||||
foreign->referenced_table_name);
|
||||
|
||||
pars_info_add_int4_literal(info, "n_cols",
|
||||
foreign->n_fields + (foreign->type << 24));
|
||||
foreign->n_fields + (foreign->type << 24));
|
||||
|
||||
error = dict_foreign_eval_sql(info,
|
||||
"PROCEDURE P () IS\n"
|
||||
"BEGIN\n"
|
||||
"INSERT INTO SYS_FOREIGN VALUES"
|
||||
"(:id, :for_name, :ref_name, :n_cols);\n"
|
||||
"END;\n"
|
||||
, table, foreign, trx);
|
||||
"PROCEDURE P () IS\n"
|
||||
"BEGIN\n"
|
||||
"INSERT INTO SYS_FOREIGN VALUES"
|
||||
"(:id, :for_name, :ref_name, :n_cols);\n"
|
||||
"END;\n"
|
||||
, table, foreign, trx);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
||||
|
@ -1381,8 +1393,8 @@ dict_create_add_foreign_to_dictionary(
|
|||
}
|
||||
|
||||
for (i = 0; i < foreign->n_fields; i++) {
|
||||
error = dict_create_add_foreign_field_to_dictionary(i,
|
||||
table, foreign, trx);
|
||||
error = dict_create_add_foreign_field_to_dictionary
|
||||
(i, table, foreign, trx);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
||||
|
@ -1391,11 +1403,11 @@ dict_create_add_foreign_to_dictionary(
|
|||
}
|
||||
|
||||
error = dict_foreign_eval_sql(NULL,
|
||||
"PROCEDURE P () IS\n"
|
||||
"BEGIN\n"
|
||||
"COMMIT WORK;\n"
|
||||
"END;\n"
|
||||
, table, foreign, trx);
|
||||
"PROCEDURE P () IS\n"
|
||||
"BEGIN\n"
|
||||
"COMMIT WORK;\n"
|
||||
"END;\n"
|
||||
, table, foreign, trx);
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
@ -1428,7 +1440,8 @@ dict_create_add_foreigns_to_dictionary(
|
|||
|
||||
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
|
||||
"InnoDB: table SYS_FOREIGN not found"
|
||||
" in internal data dictionary\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
@ -1437,8 +1450,8 @@ dict_create_add_foreigns_to_dictionary(
|
|||
foreign;
|
||||
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
|
||||
|
||||
error = dict_create_add_foreign_to_dictionary(&number,
|
||||
table, foreign, trx);
|
||||
error = dict_create_add_foreign_to_dictionary
|
||||
(&number, table, foreign, trx);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue