Merged with 3.23, needs further fix-up

BitKeeper/etc/ignore:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
acconfig.h:
  Auto merged
acinclude.m4:
  Auto merged
include/myisam.h:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
BitKeeper/deleted/.del-ib_config.h.in~9e57db8504e55b7:
  Auto merged
BitKeeper/deleted/.del-ib_config.h~7539e26ffc614439:
  Auto merged
client/mysqltest.c:
  Auto merged
sql/lex.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_class.h:
  Auto merged
Docs/manual.texi:
  merged
client/errmsg.c:
  merged
configure.in:
  merged
sql/mysqld.cc:
  merged
sql/sql_select.cc:
  merged, needs manual fixing
sql/sql_yacc.yy:
  merged, needs manual fixing
This commit is contained in:
unknown 2001-05-10 15:06:35 -06:00
commit 9192600eb7
123 changed files with 3170 additions and 1345 deletions

View File

@ -59,9 +59,17 @@ PENDING/*
TAGS
aclocal.m4
bdb/README
bdb/btree/btree_auto.c
bdb/build_unix/*
bdb/build_vxworks/db.h
bdb/build_vxworks/db_int.h
bdb/build_win32/db.h
bdb/build_win32/db_int.h
bdb/build_win32/include.tcl
bdb/build_win32/libdb.rc
bdb/db/crdel_auto.c
bdb/db/db_auto.c
bdb/dist/config.hin
bdb/dist/configure
bdb/dist/tags
bdb/dist/template/rec_btree
@ -94,6 +102,7 @@ bdb/txn/txn_auto.c
client/insert_test
client/mysql
client/mysqladmin
client/mysqlcheck
client/mysqldump
client/mysqlimport
client/mysqlshow
@ -122,6 +131,8 @@ heap/hp_test2
include/my_config.h
include/my_global.h
include/mysql_version.h
innobase/ib_config.h
innobase/ib_config.h.in
isam/isamchk
isam/isamlog
isam/pack_isam
@ -137,113 +148,6 @@ libmysql_r/acconfig.h
libmysql_r/conf_to_src
libmysql_r/my_static.h
libmysql_r/mysys_priv.h
libtool
linked_client_sources
linked_include_sources
linked_libmysql_r_sources
linked_libmysql_sources
linked_server_sources
myisam/ft_dump
myisam/ft_eval
myisam/ft_test1
myisam/mi_test1
myisam/mi_test2
myisam/mi_test3
myisam/mi_test_all
myisam/myisamchk
myisam/myisamlog
myisam/myisampack
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/mysql-test-run
mysql-test/r/*.reject
mysql-test/share/mysql
mysql-test/var/*
mysqld.S
mysqld.sym
mysys/test_charset
mysys/test_dir
mysys/test_thr_alarm
mysys/test_thr_lock
mysys/testhash
regex/re
repl-tests/test-repl-ts/repl-timestamp.master.reject
repl-tests/test-repl/foo-dump-slave.master.
repl-tests/test-repl/sum-wlen-slave.master.
repl-tests/test-repl/sum-wlen-slave.master.re
repl-tests/test-repl/sum-wlen-slave.master.reje
scripts/make_binary_distribution
scripts/msql2mysql
scripts/mysql_config
scripts/mysql_convert_table_format
scripts/mysql_find_rows
scripts/mysql_fix_privilege_tables
scripts/mysql_install_db
scripts/mysql_setpermission
scripts/mysql_zap
scripts/mysqlaccess
scripts/mysqlbug
scripts/mysqld_multi
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/safe_mysqld
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
sql-bench/bench-init.pl
sql-bench/compare-results
sql-bench/copy-db
sql-bench/crash-me
sql-bench/output/*
sql-bench/run-all-tests
sql-bench/server-cfg
sql-bench/test-ATIS
sql-bench/test-alter-table
sql-bench/test-big-tables
sql-bench/test-connect
sql-bench/test-create
sql-bench/test-insert
sql-bench/test-select
sql-bench/test-wisconsin
sql/.gdbinit
sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
sql/mini_client_errors.c
sql/mysqlbinlog
sql/mysqld
sql/share/*.sys
sql/share/charsets/gmon.out
sql/share/gmon.out
sql/share/norwegian-ny/errmsg.sys
sql/share/norwegian/errmsg.sys
sql/sql_yacc.cc
sql/sql_yacc.h
stamp-h
strings/conf_to_src
strings/ctype_autoconf.c
strings/ctype_extra_sources.c
support-files/binary-configure
support-files/my-huge.cnf
support-files/my-large.cnf
support-files/my-medium.cnf
support-files/my-small.cnf
support-files/mysql-3.23.25-beta.spec
support-files/mysql-3.23.26-beta.spec
support-files/mysql-3.23.27-beta.spec
support-files/mysql-3.23.28-gamma.spec
support-files/mysql-3.23.29-gamma.spec
support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
tags
tmp/*
bdb/btree/btree_auto.c
bdb/build_vxworks/db_int.h
bdb/build_win32/db_int.h
bdb/build_win32/include.tcl
bdb/build_win32/libdb.rc
bdb/db/crdel_auto.c
bdb/db/db_auto.c
bdb/dist/config.hin
libmysqld/convert.cc
libmysqld/derror.cc
libmysqld/errmsg.c
@ -292,6 +196,7 @@ libmysqld/sql_class.cc
libmysqld/sql_crypt.cc
libmysqld/sql_db.cc
libmysqld/sql_delete.cc
libmysqld/sql_handler.cc
libmysqld/sql_insert.cc
libmysqld/sql_lex.cc
libmysqld/sql_list.cc
@ -313,6 +218,105 @@ libmysqld/table.cc
libmysqld/thr_malloc.cc
libmysqld/time.cc
libmysqld/unireg.cc
libtool
linked_client_sources
linked_include_sources
linked_libmysql_r_sources
linked_libmysql_sources
linked_libmysqld_sources
linked_server_sources
myisam/ft_dump
myisam/ft_eval
myisam/ft_test1
myisam/mi_test1
myisam/mi_test2
myisam/mi_test3
myisam/mi_test_all
myisam/myisamchk
myisam/myisamlog
myisam/myisampack
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/mysql-test-run
mysql-test/r/*.reject
mysql-test/share/mysql
mysql-test/var/*
mysql.proj
mysqld.S
mysqld.sym
mysys/test_charset
mysys/test_dir
mysys/test_thr_alarm
mysys/test_thr_lock
mysys/testhash
regex/re
repl-tests/test-repl-ts/repl-timestamp.master.reject
repl-tests/test-repl/foo-dump-slave.master.
repl-tests/test-repl/sum-wlen-slave.master.
repl-tests/test-repl/sum-wlen-slave.master.re
repl-tests/test-repl/sum-wlen-slave.master.reje
scripts/make_binary_distribution
scripts/msql2mysql
scripts/mysql_config
scripts/mysql_convert_table_format
scripts/mysql_find_rows
scripts/mysql_fix_privilege_tables
scripts/mysql_install_db
scripts/mysql_setpermission
scripts/mysql_zap
scripts/mysqlaccess
scripts/mysqlbug
scripts/mysqld_multi
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/safe_mysqld
sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686
sql-bench/bench-count-distinct
libmysqld/sql_handler.cc
sql-bench/bench-init.pl
sql-bench/compare-results
sql-bench/copy-db
sql-bench/crash-me
sql-bench/output/*
sql-bench/run-all-tests
sql-bench/server-cfg
sql-bench/test-ATIS
sql-bench/test-alter-table
sql-bench/test-big-tables
sql-bench/test-connect
sql-bench/test-create
sql-bench/test-insert
sql-bench/test-select
sql-bench/test-wisconsin
sql/.gdbinit
sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
sql/mini_client_errors.c
sql/mysqlbinlog
sql/mysqld
sql/share/*.sys
sql/share/charsets/gmon.out
sql/share/gmon.out
sql/share/norwegian-ny/errmsg.sys
sql/share/norwegian/errmsg.sys
sql/sql_yacc.cc
sql/sql_yacc.h
stamp-h
strings/conf_to_src
strings/ctype_autoconf.c
strings/ctype_extra_sources.c
support-files/binary-configure
support-files/my-huge.cnf
support-files/my-large.cnf
support-files/my-medium.cnf
support-files/my-small.cnf
support-files/mysql-3.23.25-beta.spec
support-files/mysql-3.23.26-beta.spec
support-files/mysql-3.23.27-beta.spec
support-files/mysql-3.23.28-gamma.spec
support-files/mysql-3.23.29-gamma.spec
support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
tags
tmp/*

View File

@ -1,12 +0,0 @@
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O0 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O0 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
make
strip sql/mysqld

View File

@ -1,12 +0,0 @@
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
CC=sgicc CFLAGS="-O0" CXX=sgicc CXXFLAGS="-O0" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
make
strip sql/mysqld

View File

@ -1,12 +0,0 @@
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O2 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
make
strip sql/mysqld

View File

@ -1,12 +0,0 @@
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
CC=sgicc CFLAGS="-O2" CXX=sgicc CXXFLAGS="-O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
make
strip sql/mysqld

View File

@ -1,8 +0,0 @@
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O6 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
make
strip sql/mysqld

View File

@ -1,5 +1,8 @@
heikki@donna.mysql.fi
jani@hynda.mysql.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@tetra.spaceapes.com
monty@donna.mysql.fi
monty@work.mysql.com
paul@central.snake.net

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,12 @@
/* pthread_attr_setscope */
#undef HAVE_PTHREAD_ATTR_SETSCOPE
/* pthread_yield that doesn't take any arguments */
#undef HAVE_PTHREAD_YIELD_ZERO_ARG
/* pthread_yield function with one argument */
#undef HAVE_PTHREAD_YIELD_ONE_ARG
/* POSIX readdir_r */
#undef HAVE_READDIR_R

View File

@ -196,6 +196,42 @@ then
fi
])
AC_DEFUN(MYSQL_PTHREAD_YIELD,
[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
[AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h>
#ifdef __cplusplus
extern "C"
#endif
],
[
pthread_yield();
], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
if test "$ac_cv_pthread_yield_zero_arg" = "yes"
then
AC_DEFINE(HAVE_PTHREAD_YIELD_ZERO_ARG)
fi
]
[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
[AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h>
#ifdef __cplusplus
extern "C"
#endif
],
[
pthread_yield(0);
], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
if test "$ac_cv_pthread_yield_one_arg" = "yes"
then
AC_DEFINE(HAVE_PTHREAD_YIELD_ONE_ARG)
fi
]
)
#---END:
AC_DEFUN(MYSQL_CHECK_FP_EXCEPT,
@ -514,7 +550,8 @@ AC_DEFUN(MYSQL_STACK_DIRECTION,
AC_DEFUN(MYSQL_FUNC_ALLOCA,
[
# Since we have heard that alloca fails on IRIX never define it on a SGI machine
# Since we have heard that alloca fails on IRIX never define it on a
# SGI machine
if test ! "$host_vendor" = "sgi"
then
AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
@ -941,6 +978,7 @@ dnl circular references.
../innobase/odbc/libodbc.a\
../innobase/srv/libsrv.a\
../innobase/que/libque.a\
../innobase/srv/libsrv.a\
../innobase/dict/libdict.a\
../innobase/ibuf/libibuf.a\
../innobase/row/librow.a\

View File

@ -198,6 +198,7 @@ struct __fname {
*/
typedef enum {
DB_LV_INCOMPLETE,
DB_LV_NONEXISTENT,
DB_LV_NORMAL,
DB_LV_OLD_READABLE,
DB_LV_OLD_UNREADABLE

View File

@ -309,13 +309,13 @@ __log_find(dblp, find_first, valp, statusp)
int find_first, *valp;
logfile_validity *statusp;
{
logfile_validity clv_status, status;
logfile_validity logval_status, status;
u_int32_t clv, logval;
int cnt, fcnt, ret;
const char *dir;
char **names, *p, *q, savech;
clv_status = status = DB_LV_NORMAL;
logval_status = status = DB_LV_NONEXISTENT;
/* Return a value of 0 as the log file number on failure. */
*valp = 0;
@ -385,10 +385,14 @@ __log_find(dblp, find_first, valp, statusp)
* as a valid log file.
*/
break;
case DB_LV_NONEXISTENT:
/* Should never happen. */
DB_ASSERT(0);
break;
case DB_LV_NORMAL:
case DB_LV_OLD_READABLE:
logval = clv;
clv_status = status;
logval_status = status;
break;
case DB_LV_OLD_UNREADABLE:
/*
@ -410,7 +414,7 @@ __log_find(dblp, find_first, valp, statusp)
*/
if (!find_first) {
logval = clv;
clv_status = status;
logval_status = status;
}
break;
}
@ -420,7 +424,7 @@ __log_find(dblp, find_first, valp, statusp)
err: __os_dirfree(names, fcnt);
__os_freestr(p);
*statusp = clv_status;
*statusp = logval_status;
return (ret);
}

View File

@ -430,7 +430,7 @@ __log_add_logid(dbenv, logp, dbp, ndx)
TAILQ_INIT(&logp->dbentry[i].dblist);
else
TAILQ_REINSERT_HEAD(
&logp->dbentry[i].dblist, dbp, links);
&logp->dbentry[i].dblist, dbtmp, links);
}
/* Initialize the new entries. */

View File

@ -21,13 +21,14 @@ INCLUDES = -I$(srcdir)/../include \
-I..
LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlshow mysqldump mysqlimport mysqltest
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow mysqldump mysqlimport mysqltest
noinst_PROGRAMS = insert_test select_test thread_test
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqladmin_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)

View File

@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
#define ADMIN_VERSION "8.19"
#define ADMIN_VERSION "8.20"
#define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -417,19 +417,13 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
}
case ADMIN_DROP:
{
char buff[FN_REFLEN+20];
if (argc < 2)
{
my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
return 1;
}
sprintf(buff,"drop database `%.*s`",FN_REFLEN,argv[1]);
if (mysql_query(mysql,buff))
{
my_printf_error(0,"DROP DATABASE failed; error: '%-.200s'",
MYF(ME_BELL), mysql_error(mysql));
if (drop_db(mysql,argv[1]))
return 1;
}
argc--; argv++;
break;
}
@ -867,7 +861,8 @@ static int drop_db(MYSQL *mysql, const char *db)
{
puts("Dropping the database is potentially a very bad thing to do.");
puts("Any data stored in the database will be destroyed.\n");
printf("Do you really want to drop the '%s' database [y/N]\n",db);
printf("Do you really want to drop the '%s' database [y/N] ",db);
fflush(stdout);
VOID(fgets(buf,sizeof(buf)-1,stdin));
if ((*buf != 'y') && (*buf != 'Y'))
{
@ -878,7 +873,7 @@ static int drop_db(MYSQL *mysql, const char *db)
sprintf(name_buff,"drop database %.*s",FN_REFLEN,db);
if (mysql_query(mysql,name_buff))
{
my_printf_error(0,"drop of '%s' failed;\nerror: '%s'",MYF(ME_BELL),
my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
db,mysql_error(mysql));
return 1;
}

685
client/mysqlcheck.c Normal file
View File

@ -0,0 +1,685 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
#define CHECK_VERSION "1.01"
#include <global.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include <getopt.h>
#include "sslopt-vars.h"
#include <m_string.h>
/* Exit codes */
#define EX_USAGE 1
#define EX_MYSQLERR 2
static MYSQL mysql_connection, *sock = 0;
static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0, *default_charset = 0,
*current_host = 0;
static int first_error = 0;
DYNAMIC_ARRAY tables4repair;
enum operations {DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE};
enum options {OPT_CHARSETS_DIR=256, OPT_COMPRESS, OPT_DEFAULT_CHARSET,
OPT_TABLES, OPT_AUTO_REPAIR};
static struct option long_options[] =
{
{"all-databases", no_argument, 0, 'A'},
{"all-in-1", no_argument, 0, '1'},
{"auto-repair", no_argument, 0, OPT_AUTO_REPAIR},
{"analyze", no_argument, 0, 'a'},
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR},
{"check", no_argument, 0, 'c'},
{"check-only-changed", no_argument, 0, 'C'},
{"compress", no_argument, 0, OPT_COMPRESS},
{"databases", no_argument, 0, 'B'},
{"debug", optional_argument, 0, '#'},
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
{"fast", no_argument, 0, 'F'},
{"force", no_argument, 0, 'f'},
{"extended", no_argument, 0, 'e'},
{"help", no_argument, 0, '?'},
{"host", required_argument, 0, 'h'},
{"medium-check", no_argument, 0, 'm'},
{"optimize", no_argument, 0, 'o'},
{"password", optional_argument, 0, 'p'},
#ifdef __WIN__
{"pipe", no_argument, 0, 'W'},
#endif
{"port", required_argument, 0, 'P'},
{"quick", no_argument, 0, 'q'},
{"repair", no_argument, 0, 'r'},
{"silent", no_argument, 0, 's'},
{"socket", required_argument, 0, 'S'},
#include "sslopt-longopts.h"
{"tables", no_argument, 0, OPT_TABLES},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", required_argument, 0, 'u'},
#endif
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{0, 0, 0, 0}
};
static const char *load_default_groups[] = { "mysqlcheck", "client", 0 };
static void print_version(void);
static void usage(void);
static int get_options(int *argc, char ***argv);
static int process_all_databases();
static int process_databases(char **db_names);
static int process_selected_tables(char *db, char **table_names, int tables);
static int process_all_tables_in_db(char *database);
static int use_db(char *database);
static int handle_request_for_tables(char *tables, uint length);
static int dbConnect(char *host, char *user,char *passwd);
static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when);
static void safe_exit(int error);
static void print_result();
int what_to_do = 0;
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, CHECK_VERSION,
MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
} /* print_version */
static void usage(void)
{
print_version();
puts("By Jani Tolonen, 2001-04-20, MySQL Development Team\n");
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free");
puts("software and you are welcome to modify and redistribute it");
puts("under the GPL license.\n");
puts("This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a)");
puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
puts("used same time. It works on MyISAM and in some cases on BDB tables.");
puts("Please consult the MySQL manual for latest information about the");
puts("above. The options -c,-r,-a and -o are exclusive to each other, which");
puts("means that the last option will be used, if several was specified.\n");
puts("The option -c will be used by default, if none was specified. You");
puts("can change the default behavior by making a symbolic link, or");
puts("copying this file somewhere with another name, the alternatives are:");
puts("mysqlrepair: The default option will be -r");
puts("mysqlanalyze: The default option will be -a");
puts("mysqloptimize: The default option will be -o\n");
printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
printf("OR %s [OPTIONS] --databases DB1 [DB2 DB3...]\n",
my_progname);
printf("OR %s [OPTIONS] --all-databases\n", my_progname);
printf("\
-A, --all-databases Check all the databases. This will be same as\n\
--databases with all databases selected\n\
-1, --all-in-1 Instead of making one query for each table, execute\n\
all queries in 1 query separately for each database.\n\
Table names will be in a comma separeted list.\n\
-a, --analyze Analyze given tables.\n\
--auto-repair If a checked table is corrupted, automatically fix\n\
it. Repairing will be done after all tables have\n\
been checked, if corrupted ones were found.\n\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'\n\
--character-sets-dir=...\n\
Directory where character sets are\n\
-c, --check Check table for errors\n\
-C, --check-only-changed\n\
Check only tables that have changed since last check\n\
or haven't been closed properly.\n\
--compress Use compression in server/client protocol.\n\
-?, --help Display this help message and exit.\n\
-B, --databases To check several databases. Note the difference in\n\
usage; In this case no tables are given. All name\n\
arguments are regarded as databasenames.\n\
--default-character-set=...\n\
Set the default character set\n\
-F, --fast Check only tables that hasn't been closed properly\n\
-f, --force Continue even if we get an sql-error.\n\
-e, --extended If you are using this option with CHECK TABLE,\n\
it will ensure that the table is 100 percent\n\
consistent, but will take a long time.\n\n");
printf("\
If you are using this option with REPAIR TABLE,\n\
it will run an extended repair on the table, which\n\
may not only take a long time to execute, but\n\
may produce a lot of garbage rows also!\n\
-h, --host=... Connect to host.\n\
-m, --medium-check Faster than extended-check, but only finds 99.99 percent\n\
of all errors. Should be good enough for most cases.\n\
-o, --optimize Optimize table\n\
-p, --password[=...] Password to use when connecting to server.\n\
If password is not given it's solicited on the tty.\n");
#ifdef __WIN__
puts("-W, --pipe Use named pipes to connect to server");
#endif
printf("\
-P, --port=... Port number to use for connection.\n\
-q, --quick If you are using this option with CHECK TABLE, it\n\
prevents the check from scanning the rows to check\n\
for wrong links. This is the fastest check.\n\n\
If you are using this option with REPAIR TABLE, it\n\
will try to repair only the index tree. This is\n\
the fastest repair method for a table.\n\
-r, --repair Can fix almost anything except unique keys that aren't\n\
unique.\n\
-s, --silent Print only error messages.\n\
-S, --socket=... Socket file to use for connection.\n\
--tables Overrides option --databases (-B).\n");
#include "sslopt-usage.h"
#ifndef DONT_ALLOW_USER_CHANGE
printf("\
-u, --user=# User for login if not current user.\n");
#endif
printf("\
-v, --verbose Print info about the various stages.\n\
-V, --version Output version information and exit.\n");
print_defaults("my", load_default_groups);
} /* usage */
static int get_options(int *argc, char ***argv)
{
int c, option_index;
my_bool tty_password = 0;
if (*argc == 1)
{
usage();
exit(0);
}
load_defaults("my", load_default_groups, argc, argv);
while ((c = getopt_long(*argc, *argv, "#::p::h:u:P:S:BaAcCdeFfmqorsvVw:?I1",
long_options, &option_index)) != EOF)
{
switch(c) {
case 'a':
what_to_do = DO_ANALYZE;
break;
case '1':
opt_all_in_1 = 1;
break;
case 'A':
opt_alldbs = 1;
break;
case OPT_AUTO_REPAIR:
opt_auto_repair = 1;
break;
case OPT_DEFAULT_CHARSET:
default_charset = optarg;
break;
case OPT_CHARSETS_DIR:
charsets_dir = optarg;
break;
case 'c':
what_to_do = DO_CHECK;
break;
case 'C':
what_to_do = DO_CHECK;
opt_check_only_changed = 1;
break;
case 'e':
opt_extended = 1;
break;
case OPT_COMPRESS:
opt_compress = 1;
break;
case 'B':
opt_databases = 1;
break;
case 'F':
opt_fast = 1;
break;
case 'f':
ignore_errors = 1;
break;
case 'I': /* Fall through */
case '?':
usage();
exit(0);
case 'h':
my_free(current_host, MYF(MY_ALLOW_ZERO_PTR));
current_host = my_strdup(optarg, MYF(MY_WME));
break;
case 'm':
what_to_do = DO_CHECK;
opt_medium_check = 1;
break;
case 'o':
what_to_do = DO_OPTIMIZE;
break;
#ifndef DONT_ALLOW_USER_CHANGE
case 'u':
current_user = optarg;
break;
#endif
case 'p':
if (optarg)
{
char *start = optarg;
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
opt_password = my_strdup(optarg, MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; /* Destroy argument */
if (*start)
start[1] = 0; /* Cut length of argument */
}
else
tty_password = 1;
break;
case 'P':
opt_mysql_port = (unsigned int) atoi(optarg);
break;
case 'q':
opt_quick = 1;
break;
case 'r':
what_to_do = DO_REPAIR;
break;
case 'S':
opt_mysql_unix_port = optarg;
break;
case 's':
opt_silent = 1;
break;
case 'W':
#ifdef __WIN__
opt_mysql_unix_port = MYSQL_NAMEDPIPE;
#endif
break;
case '#':
DBUG_PUSH(optarg ? optarg : "d:t:o");
break;
case OPT_TABLES:
opt_databases = 0;
break;
case 'v':
verbose++;
break;
case 'V': print_version(); exit(0);
default:
fprintf(stderr, "%s: Illegal option character '%c'\n", my_progname,
opterr);
#include "sslopt-case.h"
}
}
if (!what_to_do)
{
int pnlen = strlen(my_progname);
if (pnlen < 6) // name too short
what_to_do = DO_CHECK;
else if (!strcmp("repair", my_progname + pnlen - 6))
what_to_do = DO_REPAIR;
else if (!strcmp("analyze", my_progname + pnlen - 7))
what_to_do = DO_ANALYZE;
else if (!strcmp("optimize", my_progname + pnlen - 8))
what_to_do = DO_OPTIMIZE;
else
what_to_do = DO_CHECK;
}
if (default_charset)
{
if (set_default_charset_by_name(default_charset, MYF(MY_WME)))
exit(1);
}
(*argc) -= optind;
(*argv) += optind;
if (*argc > 0 && opt_alldbs)
{
printf("You should give only options, no arguments at all, with option\n");
printf("--all-databases. Please see %s --help for more information.\n",
my_progname);
return 1;
}
if (*argc < 1 && !opt_alldbs)
{
printf("You forgot to give the arguments! Please see %s --help\n",
my_progname);
printf("for more information.\n");
return 1;
}
if (tty_password)
opt_password = get_tty_password(NullS);
return(0);
} /* get_options */
static int process_all_databases()
{
MYSQL_ROW row;
MYSQL_RES *tableres;
int result = 0;
if (mysql_query(sock, "SHOW DATABASES") ||
!(tableres = mysql_store_result(sock)))
{
my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
MYF(0), mysql_error(sock));
return 1;
}
while ((row = mysql_fetch_row(tableres)))
{
if (process_all_tables_in_db(row[0]))
result = 1;
}
return result;
}
/* process_all_databases */
static int process_databases(char **db_names)
{
int result = 0;
for ( ; *db_names ; db_names++)
{
if (process_all_tables_in_db(*db_names))
result = 1;
}
return result;
} /* process_databases */
static int process_selected_tables(char *db, char **table_names, int tables)
{
if (use_db(db))
return 1;
if (opt_all_in_1)
{
char *table_names_comma_sep, *end;
int i, tot_length = 0;
for (i = 0; i < tables; i++)
tot_length += strlen(*(table_names + i)) + 1;
if (!(table_names_comma_sep = (char *)
my_malloc((sizeof(char) * tot_length) + 1, MYF(MY_WME))))
return 1;
for (end = table_names_comma_sep + 1; tables > 0;
tables--, table_names++)
{
end = strmov(end, *table_names);
*end++= ',';
}
*--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
my_free(table_names_comma_sep, MYF(0));
}
else
for (; tables > 0; tables--, table_names++)
handle_request_for_tables(*table_names, strlen(*table_names));
return 0;
} /* process_selected_tables */
static int process_all_tables_in_db(char *database)
{
MYSQL_RES *res;
MYSQL_ROW row;
LINT_INIT(res);
if (use_db(database))
return 1;
if (!(mysql_query(sock, "SHOW TABLES") ||
(res = mysql_store_result(sock))))
return 1;
if (opt_all_in_1)
{
char *tables, *end;
uint tot_length = 0;
while ((row = mysql_fetch_row(res)))
tot_length += strlen(row[0]) + 1;
mysql_data_seek(res, 0);
if (!(tables=(char *) my_malloc(sizeof(char)*tot_length+1, MYF(MY_WME))))
{
mysql_free_result(res);
return 1;
}
for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
{
end = strmov(end, row[0]);
*end++= ',';
}
*--end = 0;
if (tot_length)
handle_request_for_tables(tables + 1, tot_length - 1);
my_free(tables, MYF(0));
}
else
{
while ((row = mysql_fetch_row(res)))
handle_request_for_tables(row[0], strlen(row[0]));
}
mysql_free_result(res);
return 0;
} /* process_all_tables_in_db */
static int use_db(char *database)
{
if (mysql_select_db(sock, database))
{
DBerror(sock, "when selecting the database");
return 1;
}
return 0;
} /* use_db */
static int handle_request_for_tables(char *tables, uint length)
{
char *query, *end, options[100];
const char *op = 0;
options[0] = 0;
switch (what_to_do) {
case DO_CHECK:
op = "CHECK";
end = options;
if (opt_quick) end = strmov(end, "QUICK");
if (opt_fast) end = strmov(end, "FAST");
if (opt_medium_check) end = strmov(end, "MEDIUM"); /* Default */
if (opt_extended) end = strmov(end, "EXTENDED");
if (opt_check_only_changed) end = strmov(end, "CHANGED");
break;
case DO_REPAIR:
op = "REPAIR";
end = options;
if (opt_quick) end = strmov(end, "QUICK");
if (opt_extended) end = strmov(end, "EXTENDED");
break;
case DO_ANALYZE:
op = "ANALYZE";
break;
case DO_OPTIMIZE:
op = "OPTIMIZE";
break;
}
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME))))
return 1;
sprintf(query, "%s TABLE %s %s", op, options, tables);
if (mysql_query(sock, query))
{
sprintf(options, "when executing '%s TABLE'", op);
DBerror(sock, options);
return 1;
}
print_result();
my_free(query, MYF(0));
return 0;
}
static void print_result()
{
MYSQL_RES *res;
MYSQL_ROW row;
char prev[NAME_LEN*2+2];
int i;
res = mysql_use_result(sock);
prev[0] = '\0';
for (i = 0; (row = mysql_fetch_row(res)); i++)
{
int changed = strcmp(prev, row[0]);
int status = !strcmp(row[2], "status");
if (opt_silent && status)
continue;
if (status && changed)
printf("%-50s %s", row[0], row[3]);
else if (!status && changed)
{
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
if (what_to_do != DO_REPAIR && opt_auto_repair)
insert_dynamic(&tables4repair, row[0]);
}
else
printf("%-9s: %s", row[2], row[3]);
strmov(prev, row[0]);
putchar('\n');
}
mysql_free_result(res);
}
static int dbConnect(char *host, char *user, char *passwd)
{
DBUG_ENTER("dbConnect");
if (verbose)
{
fprintf(stderr, "# Connecting to %s...\n", host ? host : "localhost");
}
mysql_init(&mysql_connection);
if (opt_compress)
mysql_options(&mysql_connection, MYSQL_OPT_COMPRESS, NullS);
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath);
#endif
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
{
DBerror(&mysql_connection, "when trying to connect");
return 1;
}
return 0;
} /* dbConnect */
static void dbDisconnect(char *host)
{
if (verbose)
fprintf(stderr, "# Disconnecting from %s...\n", host ? host : "localhost");
mysql_close(sock);
} /* dbDisconnect */
static void DBerror(MYSQL *mysql, const char *when)
{
DBUG_ENTER("DBerror");
my_printf_error(0,"Got error: %d: %s %s", MYF(0),
mysql_errno(mysql), mysql_error(mysql), when);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
} /* DBerror */
static void safe_exit(int error)
{
if (!first_error)
first_error= error;
if (ignore_errors)
return;
if (sock)
mysql_close(sock);
exit(error);
}
int main(int argc, char **argv)
{
MY_INIT(argv[0]);
/*
** Check out the args
*/
if (get_options(&argc, &argv))
{
my_end(0);
exit(EX_USAGE);
}
if (dbConnect(current_host, current_user, opt_password))
exit(EX_MYSQLERR);
if (opt_auto_repair &&
init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
{
first_error = 1;
goto end;
}
if (opt_alldbs)
process_all_databases();
/* Only one database and selected table(s) */
else if (argc > 1 && !opt_databases)
process_selected_tables(*argv, (argv + 1), (argc - 1));
/* One or more databases, all tables */
else
process_databases(argv);
if (opt_auto_repair)
{
uint i;
if (!opt_silent && tables4repair.elements)
puts("\nRepairing tables");
what_to_do = DO_REPAIR;
for (i = 0; i < tables4repair.elements ; i++)
{
char *name= (char*) dynamic_array_ptr(&tables4repair, i);
handle_request_for_tables(name, strlen(name));
}
}
end:
dbDisconnect(current_host);
if (opt_auto_repair)
delete_dynamic(&tables4repair);
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
my_end(0);
return(first_error!=0);
} /* main */

View File

@ -37,7 +37,7 @@
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
**/
#define DUMP_VERSION "8.13"
#define DUMP_VERSION "8.14"
#include <global.h>
#include <my_sys.h>
@ -73,7 +73,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
lock_tables=0,ignore_errors=0,flush_logs=0,replace=0,
ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0,
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0;
opt_alldbs=0,opt_create_db=0,opt_first_slave=0;
static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
@ -85,6 +85,7 @@ static int first_error=0;
extern ulong net_buffer_length;
static DYNAMIC_STRING extended_row;
#include "sslopt-vars.h"
FILE *result_file;
enum options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_KEYWORDS,
OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED, OPT_TABLES,
@ -127,6 +128,7 @@ static struct option long_options[] =
{"port", required_argument, 0, 'P'},
{"quick", no_argument, 0, 'q'},
{"quote-names", no_argument, 0, 'Q'},
{"result-file", required_argument, 0, 'r'},
{"set-variable", required_argument, 0, 'O'},
{"socket", required_argument, 0, 'S'},
#include "sslopt-longopts.h"
@ -227,6 +229,10 @@ puts("\
-P, --port=... Port number to use for connection.\n\
-q, --quick Don't buffer query, dump directly to stdout.\n\
-Q, --quote-names Quote table and column names with `\n\
-r, --result-file=... Direct output to a given file. This option should be\n\
used in MSDOS, because it prevents new line '\\n'\n\
from being converted to '\\n\\r' (newline + carriage\n\
return).\n\
-S, --socket=... Socket file to use for connection.\n\
--tables Overrides option --databases (-B).\n");
#include "sslopt-usage.h"
@ -284,9 +290,11 @@ static int get_options(int *argc,char ***argv)
int c,option_index;
my_bool tty_password=0;
result_file=stdout;
load_defaults("my",load_default_groups,argc,argv);
set_all_changeable_vars(changeable_vars);
while ((c=getopt_long(*argc,*argv,"#::p::h:u:O:P:S:T:EBaAcCdefFlnqtvVw:?Ix",
while ((c=getopt_long(*argc,*argv,
"#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?Ix",
long_options, &option_index)) != EOF)
{
switch(c) {
@ -346,6 +354,11 @@ static int get_options(int *argc,char ***argv)
case 'P':
opt_mysql_port= (unsigned int) atoi(optarg);
break;
case 'r':
if (!(result_file = my_fopen(optarg, O_WRONLY | O_BINARY,
MYF(MY_WME))))
exit(1);
break;
case 'S':
opt_mysql_unix_port= optarg;
break;
@ -589,7 +602,7 @@ static uint getTableStructure(char *table, char* db)
char *strpos, *table_name;
const char *delayed;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3];
FILE *sql_file = stdout;
FILE *sql_file = result_file;
DBUG_ENTER("getTableStructure");
delayed= opt_delayed ? " DELAYED " : "";
@ -625,8 +638,8 @@ static uint getTableStructure(char *table, char* db)
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
write_heder(sql_file, db);
}
@ -724,9 +737,9 @@ static uint getTableStructure(char *table, char* db)
if (init)
{
if (!tFlag)
fputs(",\n",sql_file);
fputs(",\n",sql_file);
if (cFlag)
strpos=strmov(strpos,", ");
strpos=strmov(strpos,", ");
}
init=1;
if (cFlag)
@ -734,20 +747,20 @@ static uint getTableStructure(char *table, char* db)
if (!tFlag)
{
if (opt_keywords)
fprintf(sql_file, " %s.%s %s", table_name,
quote_name(row[SHOW_FIELDNAME],name_buff), row[SHOW_TYPE]);
fprintf(sql_file, " %s.%s %s", table_name,
quote_name(row[SHOW_FIELDNAME],name_buff), row[SHOW_TYPE]);
else
fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME],name_buff),
row[SHOW_TYPE]);
fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME],
name_buff), row[SHOW_TYPE]);
if (row[SHOW_DEFAULT])
{
fputs(" DEFAULT ", sql_file);
unescape(sql_file,row[SHOW_DEFAULT],lengths[SHOW_DEFAULT]);
fputs(" DEFAULT ", sql_file);
unescape(sql_file,row[SHOW_DEFAULT],lengths[SHOW_DEFAULT]);
}
if (!row[SHOW_NULL][0])
fputs(" NOT NULL", sql_file);
fputs(" NOT NULL", sql_file);
if (row[SHOW_EXTRA][0])
fprintf(sql_file, " %s",row[SHOW_EXTRA]);
fprintf(sql_file, " %s",row[SHOW_EXTRA]);
}
}
numFields = (uint) mysql_num_rows(tableRes);
@ -761,9 +774,9 @@ static uint getTableStructure(char *table, char* db)
if (mysql_query(sock, buff))
{
fprintf(stderr, "%s: Can't get keys for table '%s' (%s)\n",
my_progname, table, mysql_error(sock));
my_progname, table, mysql_error(sock));
if (sql_file != stdout)
my_fclose(sql_file, MYF(MY_WME));
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@ -776,16 +789,16 @@ static uint getTableStructure(char *table, char* db)
{
if (atoi(row[3]) == 1)
{
keynr++;
#ifdef FORCE_PRIMARY_KEY
if (atoi(row[1]) == 0 && primary_key == INT_MAX)
primary_key=keynr;
#endif
if (!strcmp(row[2],"PRIMARY"))
{
primary_key=keynr;
break;
}
keynr++;
#ifdef FORCE_PRIMARY_KEY
if (atoi(row[1]) == 0 && primary_key == INT_MAX)
primary_key=keynr;
#endif
if (!strcmp(row[2],"PRIMARY"))
{
primary_key=keynr;
break;
}
}
}
mysql_data_seek(tableRes,0);
@ -794,21 +807,21 @@ static uint getTableStructure(char *table, char* db)
{
if (atoi(row[3]) == 1)
{
if (keynr++)
putc(')', sql_file);
if (atoi(row[1])) /* Test if duplicate key */
/* Duplicate allowed */
fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff));
else if (keynr == primary_key)
fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */
else
fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff));
if (keynr++)
putc(')', sql_file);
if (atoi(row[1])) /* Test if duplicate key */
/* Duplicate allowed */
fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff));
else if (keynr == primary_key)
fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */
else
fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff));
}
else
putc(',', sql_file);
putc(',', sql_file);
fputs(quote_name(row[4],name_buff), sql_file);
if (row[7])
fprintf(sql_file, " (%s)",row[7]); /* Sub key */
fprintf(sql_file, " (%s)",row[7]); /* Sub key */
}
if (keynr)
putc(')', sql_file);
@ -820,28 +833,28 @@ static uint getTableStructure(char *table, char* db)
sprintf(buff,"show table status like '%s'",table);
if (mysql_query(sock, buff))
{
if (mysql_errno(sock) != ER_PARSE_ERROR)
{ /* If old MySQL version */
if (verbose)
fprintf(stderr,
"# Warning: Couldn't get status information for table '%s' (%s)\n",
table,mysql_error(sock));
}
if (mysql_errno(sock) != ER_PARSE_ERROR)
{ /* If old MySQL version */
if (verbose)
fprintf(stderr,
"# Warning: Couldn't get status information for table '%s' (%s)\n",
table,mysql_error(sock));
}
}
else if (!(tableRes=mysql_store_result(sock)) ||
!(row=mysql_fetch_row(tableRes)))
!(row=mysql_fetch_row(tableRes)))
{
fprintf(stderr,
"Error: Couldn't read status information for table '%s' (%s)\n",
table,mysql_error(sock));
fprintf(stderr,
"Error: Couldn't read status information for table '%s' (%s)\n",
table,mysql_error(sock));
}
else
{
fputs("/*!",sql_file);
print_value(sql_file,tableRes,row,"type=","Type",0);
print_value(sql_file,tableRes,row,"","Create_options",0);
print_value(sql_file,tableRes,row,"comment=","Comment",1);
fputs(" */",sql_file);
fputs("/*!",sql_file);
print_value(sql_file,tableRes,row,"type=","Type",0);
print_value(sql_file,tableRes,row,"","Create_options",0);
print_value(sql_file,tableRes,row,"comment=","Comment",1);
fputs(" */",sql_file);
}
mysql_free_result(tableRes); /* Is always safe to free */
}
@ -960,14 +973,14 @@ static void dumpTable(uint numFields, char *table)
}
else
{
printf("\n#\n# Dumping data for table '%s'\n", table);
fprintf(result_file,"\n#\n# Dumping data for table '%s'\n", table);
sprintf(query, "SELECT * FROM %s", quote_name(table,table_buff));
if (where)
{
printf("# WHERE: %s\n",where);
fprintf(result_file,"# WHERE: %s\n",where);
strxmov(strend(query), " WHERE ",where,NullS);
}
puts("#\n");
fputs("#\n\n", result_file);
if (mysql_query(sock, query))
{
@ -994,7 +1007,8 @@ static void dumpTable(uint numFields, char *table)
}
if (opt_lock)
printf("LOCK TABLES %s WRITE;\n", quote_name(table,table_buff));
fprintf(result_file,"LOCK TABLES %s WRITE;\n",
quote_name(table,table_buff));
total_length=net_buffer_length; /* Force row break */
row_break=0;
@ -1007,7 +1021,7 @@ static void dumpTable(uint numFields, char *table)
ulong *lengths=mysql_fetch_lengths(res);
rownr++;
if (!extended_insert)
fputs(insert_pat,stdout);
fputs(insert_pat,result_file);
mysql_field_seek(res,0);
for (i = 0; i < mysql_num_fields(res); i++)
@ -1061,17 +1075,17 @@ static void dumpTable(uint numFields, char *table)
else
{
if (i)
putchar(',');
fputc(',',result_file);
if (row[i])
{
if (!IS_NUM_FIELD(field))
unescape(stdout, row[i], lengths[i]);
unescape(result_file, row[i], lengths[i]);
else
fputs(row[i],stdout);
fputs(row[i],result_file);
}
else
{
fputs("NULL",stdout);
fputs("NULL",result_file);
}
}
}
@ -1084,27 +1098,25 @@ static void dumpTable(uint numFields, char *table)
if (total_length + row_length < net_buffer_length)
{
total_length += row_length;
putchar(','); /* Always row break */
fputs(extended_row.str,stdout);
fputc(',',result_file); /* Always row break */
fputs(extended_row.str,result_file);
}
else
{
if (row_break)
puts(";");
fputs(";\n", result_file);
row_break=1; /* This is first row */
fputs(insert_pat,stdout);
fputs(extended_row.str,stdout);
fputs(insert_pat,result_file);
fputs(extended_row.str,result_file);
total_length = row_length+init_length;
}
}
else
{
puts(");");
}
fputs(");\n", result_file);
}
if (extended_insert && row_break)
puts(";"); /* If not empty table */
fflush(stdout);
fputs(";\n", result_file); /* If not empty table */
fflush(result_file);
if (mysql_errno(sock))
{
sprintf(query,"%s: Error %d: %s when dumping table '%s' at row: %ld\n",
@ -1118,7 +1130,7 @@ static void dumpTable(uint numFields, char *table)
return;
}
if (opt_lock)
puts("UNLOCK TABLES;");
fputs("UNLOCK TABLES;\n", result_file);
mysql_free_result(res);
}
} /* dumpTable */
@ -1194,10 +1206,11 @@ static int init_dumping(char *database)
{
if (opt_databases || opt_alldbs)
{
printf("\n#\n# Current Database: %s\n#\n", database);
fprintf(result_file,"\n#\n# Current Database: %s\n#\n", database);
if (!opt_create_db)
printf("\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", database);
printf("\nUSE %s;\n", database);
fprintf(result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
database);
fprintf(result_file,"\nUSE %s;\n", database);
}
}
if (extended_insert)
@ -1329,7 +1342,7 @@ int main(int argc, char **argv)
if (dbConnect(current_host, current_user, opt_password))
exit(EX_MYSQLERR);
if (!path)
write_heder(stdout, *argv);
write_heder(result_file, *argv);
if (opt_first_slave)
{
@ -1365,7 +1378,9 @@ int main(int argc, char **argv)
}
}
dbDisconnect(current_host);
puts("");
fputs("\n", result_file);
if (result_file != stdout)
my_fclose(result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (extended_insert)
dynstr_free(&extended_row);

View File

@ -569,7 +569,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
else
{
v->str_val = (char*)p;
v->str_val_len = (p_end && *p_end) ? *p_end - p : strlen(p);
v->str_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p);
v->int_val=atoi(p);
v->int_dirty=0;
return 0;
@ -1758,6 +1758,7 @@ static void init_var_hash()
die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306");
var_from_env("SLAVE_MYPORT", "9307");
var_from_env("MYSQL_TEST_DIR", "");
}
int main(int argc, char** argv)

View File

@ -119,6 +119,17 @@ AC_PROG_AWK
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
# Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc"
then
ac_cv_prog_gcc="no"
fi
if test "$CXX" = "sgi++"
then
GXX="no"
fi
if test "$ac_cv_prog_gcc" = "yes"
then
AS="$CC -c"
@ -1248,7 +1259,7 @@ fi
AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags")
if test "$IS_LINUX" = "true" -a "$all_is_static" != "yes"
if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then
LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic")
@ -1326,10 +1337,11 @@ MYSQL_CXX_BOOL
MYSQL_CHECK_LONGLONG_TO_FLOAT
if test "$ac_cv_conv_longlong_to_float" != "yes"
then
AC_MSG_ERROR([Your compiler can't convert a longlong value to a float!
AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float!
If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
again]);
fi
MYSQL_PTHREAD_YIELD
######################################################################
# For readline-4.0 (We simply move the mimimum amount of stuff from
@ -1386,7 +1398,7 @@ AC_CHECK_FUNCS(alarm bmove \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock pthread_yield\
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
fchmod getpass getpassphrase initgroups mlockall)
# Sanity check: We chould not have any fseeko symbol unless
@ -2103,7 +2115,7 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \
merge/Makefile dbug/Makefile scripts/Makefile \
include/Makefile sql-bench/Makefile \
tests/Makefile Docs/Makefile support-files/Makefile \
mysql-test/Makefile fs/Makefile \
mysql-test/Makefile \
include/mysql_version.h
, , [
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h

View File

@ -303,7 +303,7 @@ static void do_resolve()
uchar* addr = (uchar*)read_addr(&p);
if(resolve_addr(addr, &se))
fprintf(fp_out, "%p %s + %d\n", addr, se.symbol,
addr - se.addr);
(int) (addr - se.addr));
else
fprintf(fp_out, "%p (?)\n", addr);

View File

@ -332,7 +332,8 @@ typedef int File; /* File descriptor */
typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1
#endif
typedef RETSIGTYPE sig_handler; /* Function to handle signals */
/* Type for fuctions that handles signals */
#define sig_handler RETSIGTYPE
typedef void (*sig_return)();/* Returns type from signal */
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */

View File

@ -66,6 +66,7 @@ extern CHARSET_INFO compiled_charsets[];
#endif
/* Don't include std ctype.h when this is included */
#define _CTYPE_H
#define _CTYPE_H_
#define _CTYPE_INCLUDED
#define __CTYPE_INCLUDED
#define _CTYPE_USING /* Don't put names in global namespace. */

View File

@ -333,9 +333,9 @@ typedef struct st_mi_check_param
ulonglong unique_count[MI_MAX_KEY_SEG+1];
ha_checksum key_crc[MI_MAX_POSSIBLE_KEY];
ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY];
void* thd;
char* table_name;
char* op_name;
void *thd;
char *db_name,*table_name;
char *op_name;
} MI_CHECK;

View File

@ -20,6 +20,14 @@
#ifndef _mysql_h
#define _mysql_h
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#endif
#ifndef MYSQL_SERVER
#ifdef __cplusplus
extern "C" {

View File

@ -204,7 +204,28 @@ ulint buf_dbg_counter = 0; /* This is used to insert validation
ibool buf_debug_prints = FALSE; /* If this is set TRUE,
the program prints info whenever
read-ahead or flush occurs */
/************************************************************************
Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value
on 32-bit and 64-bit architectures. */
ulint
buf_calc_page_checksum(
/*===================*/
/* out: checksum */
byte* page) /* in: buffer page */
{
ulint checksum;
checksum = ut_fold_binary(page, FIL_PAGE_FILE_FLUSH_LSN);
+ ut_fold_binary(page + FIL_PAGE_DATA, UNIV_PAGE_SIZE - FIL_PAGE_DATA
- FIL_PAGE_END_LSN);
checksum = checksum & 0xFFFFFFFF;
return(checksum);
}
/************************************************************************
Initializes a buffer control block when the buf_pool is created. */
static
@ -1171,12 +1192,36 @@ buf_page_io_complete(
dulint id;
dict_index_t* index;
ulint io_type;
ulint checksum;
ut_ad(block);
io_type = block->io_fix;
if (io_type == BUF_IO_READ) {
checksum = buf_calc_page_checksum(block->frame);
/* From version 3.23.38 up we store the page checksum
to the 4 upper bytes of the page end lsn field */
if ((mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
!= mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN + 4))
|| (checksum != mach_read_from_4(block->frame
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN)
&& mach_read_from_4(block->frame + FIL_PAGE_LSN)
!= mach_read_from_4(block->frame
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN))) {
fprintf(stderr,
"InnoDB: Database page corruption or a failed\n"
"InnoDB: file read of page %lu.\n", block->offset);
fprintf(stderr,
"InnoDB: You may have to recover from a backup.\n");
exit(1);
}
if (recv_recovery_is_on()) {
recv_recover_page(TRUE, block->frame, block->space,
block->offset);
@ -1208,17 +1253,8 @@ buf_page_io_complete(
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->n_pages_read++;
/*
if (0 != ut_dulint_cmp(
mach_read_from_8(block->frame + FIL_PAGE_LSN),
mach_read_from_8(block->frame + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN))) {
printf("DB error: file page corrupted!\n");
ut_error;
}
*/
rw_lock_x_unlock_gen(&(block->lock), BUF_IO_READ);
rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ);

View File

@ -222,6 +222,12 @@ buf_flush_write_block_low(
mach_write_to_8(block->frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN,
block->newest_modification);
/* We overwrite the first 4 bytes of the end lsn field to store
a page checksum */
mach_write_to_4(block->frame + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN,
buf_calc_page_checksum(block->frame));
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);

View File

@ -73,11 +73,13 @@ buf_read_page_low(
sync = TRUE;
}
#endif
if (trx_sys_hdr_page(space, offset)) {
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* Trx sys header is so low in the latching order that we play
safe and do not leave the i/o-completion to an asynchronous
i/o-thread: */
i/o-thread. Ibuf bitmap pages must always be read with
syncronous i/o, to make sure they do not get involved in
thread deadlocks. */
sync = TRUE;
}

View File

@ -4,18 +4,94 @@ AC_CANONICAL_SYSTEM
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(ib_config.h)
AM_INIT_AUTOMAKE(ib, 0.90)
# This is need before AC_PROG_CC
#
if test "x${CFLAGS-}" = x ; then
cflags_is_set=no
else
cflags_is_set=yes
fi
if test "x${CPPFLAGS-}" = x ; then
cppflags_is_set=no
else
cppflags_is_set=yes
fi
if test "x${LDFLAGS-}" = x ; then
ldflags_is_set=no
else
ldflags_is_set=yes
fi
# The following hack should ensure that configure doesn't add optimizing
# or debugging flags to CFLAGS or CXXFLAGS
CFLAGS="$CFLAGS "
CXXFLAGS="$CXXFLAGS "
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_FUNCS(sched_yield)
AC_C_INLINE
#AC_C_INLINE Already checked in MySQL
AC_C_BIGENDIAN
# Build optimized or debug version ?
# First check for gcc and g++
if test "$ac_cv_prog_gcc" = "yes"
then
DEBUG_CFLAGS="-g"
DEBUG_OPTIMIZE_CC="-O"
OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
else
DEBUG_CFLAGS="-g"
DEBUG_OPTIMIZE_CC=""
OPTIMIZE_CFLAGS="-O"
fi
if test "$ac_cv_prog_cxx_g" = "yes"
then
DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX="-O"
OPTIMIZE_CXXFLAGS="-O3"
else
DEBUG_CXXFLAGS="-g"
DEBUG_OPTIMIZE_CXX=""
OPTIMIZE_CXXFLAGS="-O"
fi
AC_ARG_WITH(debug,
[ --without-debug Build a production version without debugging code],
[with_debug=$withval],
[with_debug=no])
if test "$with_debug" = "yes"
then
# Medium debug.
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS -DDEBUG_OFF"
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS -DDEBUG_OFF"
fi
case "$target_os" in
hp*) AC_DEFINE(UNIV_MUST_NOT_INLINE, 1,
No inlining because gcc broken on HP-UX);;
hp*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
irix*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
osf*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
sysv5uw7*)
# Problem when linking on SCO
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile

View File

@ -4,7 +4,5 @@ libsdir = ../libs
INCLUDES = -I../../include -I../include
CFLAGS= -g -O2 -DDEBUG_OFF
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -342,6 +342,16 @@ buf_frame_get_modify_clock(
/*=======================*/
/* out: value */
buf_frame_t* frame); /* in: pointer to a frame */
/************************************************************************
Calculates a page checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value
on 32-bit and 64-bit architectures. */
ulint
buf_calc_page_checksum(
/*===================*/
/* out: checksum */
byte* page); /* in: buffer page */
/**************************************************************************
Gets the page number of a pointer pointing within a buffer frame containing
a file page. */

View File

@ -117,7 +117,6 @@ que_thr_stop(
/**************************************************************************
Moves a thread from another state to the QUE_THR_RUNNING state. Increments
the n_active_thrs counters of the query graph and transaction. */
UNIV_INLINE
void
que_thr_move_to_run_state_for_mysql(
/*================================*/
@ -126,7 +125,6 @@ que_thr_move_to_run_state_for_mysql(
/**************************************************************************
A patch for MySQL used to 'stop' a dummy query thread used in MySQL
select, when there is no error or lock wait. */
UNIV_INLINE
void
que_thr_stop_for_mysql_no_error(
/*============================*/

View File

@ -256,49 +256,3 @@ que_graph_is_select(
return(FALSE);
}
/**************************************************************************
Moves a thread from another state to the QUE_THR_RUNNING state. Increments
the n_active_thrs counters of the query graph and transaction if thr was
not active. */
UNIV_INLINE
void
que_thr_move_to_run_state_for_mysql(
/*================================*/
que_thr_t* thr, /* in: an query thread */
trx_t* trx) /* in: transaction */
{
if (!thr->is_active) {
(thr->graph)->n_active_thrs++;
trx->n_active_thrs++;
thr->is_active = TRUE;
ut_ad((thr->graph)->n_active_thrs == 1);
ut_ad(trx->n_active_thrs == 1);
}
thr->state = QUE_THR_RUNNING;
}
/**************************************************************************
A patch for MySQL used to 'stop' a dummy query thread used in MySQL
select, when there is no error or lock wait. */
UNIV_INLINE
void
que_thr_stop_for_mysql_no_error(
/*============================*/
que_thr_t* thr, /* in: query thread */
trx_t* trx) /* in: transaction */
{
ut_ad(thr->state == QUE_THR_RUNNING);
thr->state = QUE_THR_COMPLETED;
thr->is_active = FALSE;
(thr->graph)->n_active_thrs--;
trx->n_active_thrs--;
}

View File

@ -55,6 +55,7 @@ Calling this function is obligatory only if the memory buffer containing
the mutex is freed. Removes a mutex object from the mutex list. The mutex
is checked to be in the reset state. */
#undef mutex_free /* Fix for MacOS X */
void
mutex_free(
/*=======*/

View File

@ -9,7 +9,7 @@ Created 1/20/1994 Heikki Tuuri
#ifndef univ_i
#define univ_i
#if (defined(_WIN32) || defined(_WIN64))
#if (defined(_WIN32) || defined(_WIN64)) && !defined(MYSQL_SERVER)
#define __WIN__
#include <windows.h>
@ -20,18 +20,28 @@ be defined:
#define CRITICAL_SECTION ulint
*/
#ifdef _NT_
#define __NT__
#endif
#else
/* The Unix version */
/* Most C compilers other than gcc do not know 'extern inline' */
#if !defined(__GNUC__) && !defined(__WIN__)
#define UNIV_MUST_NOT_INLINE
#endif
/* Include two header files from MySQL to make the Unix flavor used
in compiling more Posix-compatible. We assume that 'innobase' is a
subdirectory of 'mysql'. */
#include <global.h>
#include <my_pthread.h>
#ifndef __WIN__
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
#include <sys/stat.h>
#endif
#undef PACKAGE
#undef VERSION

View File

@ -9,9 +9,9 @@ Created 1/30/1994 Heikki Tuuri
#ifndef ut0dbg_h
#define ut0dbg_h
#include "univ.i"
#include <assert.h>
#include <stdlib.h>
#include "univ.i"
#include "os0thread.h"
extern ulint ut_dbg_zero; /* This is used to eliminate

View File

@ -9,9 +9,9 @@ Created 5/30/1994 Heikki Tuuri
#ifndef ut0mem_h
#define ut0mem_h
#include "univ.i"
#include <string.h>
#include <stdlib.h>
#include "univ.i"
UNIV_INLINE
void*

View File

@ -9,10 +9,9 @@ Created 1/20/1994 Heikki Tuuri
#ifndef ut0ut_h
#define ut0ut_h
#include <time.h>
#include <ctype.h>
#include "univ.i"
#include <time.h>
#include <m_ctype.h>
typedef time_t ib_time_t;

View File

@ -882,12 +882,6 @@ recv_recover_page(
recv = UT_LIST_GET_NEXT(rec_list, recv);
}
/* If the following assert fails, the file page is incompletely
written, and a recovery from a backup is required */
ut_a(0 == ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
mach_read_from_8(page + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN)));
mutex_enter(&(recv_sys->mutex));
recv_addr->state = RECV_PROCESSED;

View File

@ -15,9 +15,6 @@ Created 10/21/1995 Heikki Tuuri
/* We assume in this case that the OS has standard Posix aio (at least SunOS
2.6, HP-UX 11i and AIX 4.3 have) */
#undef __USE_FILE_OFFSET64
#include <aio.h>
#endif
/* We use these mutexes to protect lseek + file i/o operation, if the
@ -163,7 +160,6 @@ os_file_handle_error(
os_file_t file, /* in: file pointer */
char* name) /* in: name of a file or NULL */
{
int input_char;
ulint err;
UT_NOT_USED(file);
@ -171,33 +167,19 @@ os_file_handle_error(
err = os_file_get_last_error();
if (err == OS_FILE_DISK_FULL) {
ask_again:
printf("\n");
fprintf(stderr, "\n");
if (name) {
printf(
"Innobase encountered a problem with file %s.\n",
fprintf(stderr,
"InnoDB: Encountered a problem with file %s.\n",
name);
}
printf("Disk is full. Try to clean the disk to free space\n");
printf("before answering the following: How to continue?\n");
printf("(Y == freed some space: try again)\n");
printf("(N == crash the database: will restart it)?\n");
ask_with_no_question:
input_char = getchar();
fprintf(stderr,
"InnoDB: Cannot continue operation.\n"
"InnoDB: Disk is full. Try to clean the disk to free space.\n"
"InnoDB: Delete possible created file and restart.\n");
if (input_char == (int) 'N') {
ut_error;
return(FALSE);
} else if (input_char == (int) 'Y') {
exit(1);
return(TRUE);
} else if (input_char == (int) '\n') {
goto ask_with_no_question;
} else {
goto ask_again;
}
} else if (err == OS_FILE_AIO_RESOURCES_RESERVED) {
return(TRUE);
@ -534,8 +516,10 @@ os_file_pread(
ulint n, /* in: number of bytes to read */
ulint offset) /* in: offset from where to read */
{
off_t offs = (off_t)offset;
#ifdef HAVE_PREAD
return(pread(file, buf, n, (off_t) offset));
return(pread(file, buf, n, offs));
#else
ssize_t ret;
ulint i;
@ -545,7 +529,7 @@ os_file_pread(
os_mutex_enter(os_file_seek_mutexes[i]);
ret = lseek(file, (off_t) offset, 0);
ret = lseek(file, offs, 0);
if (ret < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
@ -573,10 +557,19 @@ os_file_pwrite(
ulint n, /* in: number of bytes to write */
ulint offset) /* in: offset where to write */
{
#ifdef HAVE_PWRITE
return(pwrite(file, buf, n, (off_t) offset));
#else
ssize_t ret;
off_t offs = (off_t)offset;
#ifdef HAVE_PWRITE
ret = pwrite(file, buf, n, offs);
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
ut_a(TRUE == os_file_flush(file));
return(ret);
#else
ulint i;
/* Protect the seek / write operation with a mutex */
@ -584,7 +577,7 @@ os_file_pwrite(
os_mutex_enter(os_file_seek_mutexes[i]);
ret = lseek(file, (off_t) offset, 0);
ret = lseek(file, offs, 0);
if (ret < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
@ -594,6 +587,11 @@ os_file_pwrite(
ret = write(file, buf, n);
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
ut_a(TRUE == os_file_flush(file));
os_mutex_exit(os_file_seek_mutexes[i]);
return(ret);
@ -662,7 +660,6 @@ try_again:
#else
ibool retry;
ssize_t ret;
ulint i;
#if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32);
@ -670,15 +667,9 @@ try_again:
UT_NOT_USED(offset_high);
#endif
try_again:
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
ret = os_file_pread(file, buf, n, (off_t) offset);
ret = os_file_pread(file, buf, n, offset);
if ((ulint)ret == n) {
os_mutex_exit(os_file_seek_mutexes[i]);
return(TRUE);
}
@ -747,9 +738,14 @@ try_again:
}
ret = WriteFile(file, buf, n, &len, NULL);
/* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */
ut_a(TRUE == os_file_flush(file));
os_mutex_exit(os_file_seek_mutexes[i]);
if (ret && len == n) {
return(TRUE);
}
@ -763,7 +759,7 @@ try_again:
UT_NOT_USED(offset_high);
#endif
try_again:
ret = os_file_pwrite(file, buf, n, (off_t) offset);
ret = os_file_pwrite(file, buf, n, offset);
if ((ulint)ret == n) {
return(TRUE);
@ -1344,6 +1340,10 @@ try_again:
}
} else if (mode == OS_AIO_IBUF) {
ut_ad(type == OS_FILE_READ);
/* Reduce probability of deadlock bugs in connection with ibuf:
do not let the ibuf i/o handler sleep */
wake_later = FALSE;
array = os_aio_ibuf_array;
} else if (mode == OS_AIO_LOG) {
@ -1413,7 +1413,7 @@ try_again:
return(TRUE);
}
goto error_handling;
err = 1; /* Fall through the next if */
}
#endif
if (err == 0) {
@ -1511,6 +1511,10 @@ os_aio_windows_handle(
if (ret && len == slot->len) {
ret_val = TRUE;
if (slot->type == OS_FILE_WRITE) {
ut_a(TRUE == os_file_flush(slot->file));
}
} else {
err = GetLastError();
ut_error;
@ -1592,6 +1596,10 @@ os_aio_posix_handle(
*message1 = slot->message1;
*message2 = slot->message2;
if (slot->type == OS_FILE_WRITE) {
ut_a(TRUE == os_file_flush(slot->file));
}
os_mutex_exit(array->mutex);
os_aio_array_free_slot(array, slot);

View File

@ -247,6 +247,7 @@ os_event_wait_time(
return(OS_SYNC_TIME_EXCEEDED);
} else {
ut_error;
return(1000000); /* dummy value to eliminate compiler warn. */
}
#else
UT_NOT_USED(time);

View File

@ -138,7 +138,11 @@ os_thread_yield(void)
#if defined(__WIN__)
Sleep(0);
#elif (defined(HAVE_SCHED_YIELD) && defined(HAVE_SCHED_H))
sched_yield();
sched_yield();
#elif defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
pthread_yield();
#elif defined(HAVE_PTHREAD_YIELD_ONE_ARG)
pthread_yield(0);
#else
os_thread_sleep(0);
#endif

View File

@ -6,6 +6,7 @@
#define FLEX_SCANNER
#include "univ.i"
#include <stdio.h>
@ -5850,7 +5851,6 @@ Created 12/14/1997 Heikki Tuuri
*******************************************************/
#define YYSTYPE que_node_t*
#include "univ.i"
#include "pars0pars.h"
#include "pars0grm.h"
#include "pars0sym.h"

View File

@ -97,9 +97,8 @@ que_node_t */
#define YYSTYPE que_node_t*
#define alloca mem_alloc
#include <math.h>
#include "univ.i"
#include <math.h>
#include "pars0pars.h"
#include "mem0mem.h"
#include "que0types.h"

View File

@ -10,11 +10,11 @@ Created 12/14/1997 Heikki Tuuri
/* The value of the semantic attribute is a pointer to a query tree node
que_node_t */
#define YYSTYPE que_node_t*
#define alloca mem_alloc
#include <math.h>
#include "univ.i"
#undef alloca
#define alloca mem_alloc
#include <math.h>
#include "pars0pars.h"
#include "mem0mem.h"
#include "que0types.h"

View File

@ -1068,6 +1068,51 @@ que_thr_stop_for_mysql(
mutex_exit(&kernel_mutex);
}
/**************************************************************************
Moves a thread from another state to the QUE_THR_RUNNING state. Increments
the n_active_thrs counters of the query graph and transaction if thr was
not active. */
void
que_thr_move_to_run_state_for_mysql(
/*================================*/
que_thr_t* thr, /* in: an query thread */
trx_t* trx) /* in: transaction */
{
if (!thr->is_active) {
(thr->graph)->n_active_thrs++;
trx->n_active_thrs++;
thr->is_active = TRUE;
ut_ad((thr->graph)->n_active_thrs == 1);
ut_ad(trx->n_active_thrs == 1);
}
thr->state = QUE_THR_RUNNING;
}
/**************************************************************************
A patch for MySQL used to 'stop' a dummy query thread used in MySQL
select, when there is no error or lock wait. */
void
que_thr_stop_for_mysql_no_error(
/*============================*/
que_thr_t* thr, /* in: query thread */
trx_t* trx) /* in: transaction */
{
ut_ad(thr->state == QUE_THR_RUNNING);
thr->state = QUE_THR_COMPLETED;
thr->is_active = FALSE;
(thr->graph)->n_active_thrs--;
trx->n_active_thrs--;
}
/**************************************************************************
Prints info of an SQL query graph node. */

View File

@ -48,6 +48,52 @@ to que_run_threads: this is to allow canceling runaway queries */
#define SEL_EXHAUSTED 1
#define SEL_RETRY 2
/************************************************************************
Returns TRUE if the user-defined column values in a secondary index record
are the same as the corresponding columns in the clustered index record. */
static
ibool
row_sel_sec_rec_is_for_clust_rec(
/*=============================*/
rec_t* sec_rec,
dict_index_t* sec_index,
rec_t* clust_rec,
dict_index_t* clust_index)
{
dict_col_t* col;
byte* sec_field;
ulint sec_len;
byte* clust_field;
ulint clust_len;
ulint n;
ulint i;
n = dict_index_get_n_ordering_defined_by_user(sec_index);
for (i = 0; i < n; i++) {
col = dict_field_get_col(
dict_index_get_nth_field(sec_index, i));
clust_field = rec_get_nth_field(clust_rec,
dict_col_get_clust_pos(col),
&clust_len);
sec_field = rec_get_nth_field(sec_rec, i, &sec_len);
if (sec_len != clust_len) {
return(FALSE);
}
if (sec_len != UNIV_SQL_NULL
&& ut_memcmp(sec_field, clust_field, sec_len) != 0) {
return(FALSE);
}
}
return(TRUE);
}
/*************************************************************************
Creates a select node struct. */
@ -561,6 +607,8 @@ row_sel_get_clust_rec(
/* This is a non-locking consistent read: if necessary, fetch
a previous version of the record */
old_vers = NULL;
if (!lock_clust_rec_cons_read_sees(clust_rec, index,
node->read_view)) {
@ -579,6 +627,28 @@ row_sel_get_clust_rec(
return(DB_SUCCESS);
}
}
/* If we had to go to an earlier version of row or the
secondary index record is delete marked, then it may be that
the secondary index record corresponding to clust_rec
(or old_vers) is not rec; in that case we must ignore
such row because in our snapshot rec would not have existed.
Remember that from rec we cannot see directly which transaction
id corresponds to it: we have to go to the clustered index
record. A query where we want to fetch all rows where
the secondary index value is in some interval would return
a wrong result if we would not drop rows which we come to
visit through secondary index records that would not really
exist in our snapshot. */
if ((old_vers || rec_get_deleted_flag(rec))
&& !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
clust_rec, index)) {
clust_rec = NULL;
*out_rec = clust_rec;
return(DB_SUCCESS);
}
}
/* Fetch the columns needed in test conditions */
@ -2105,6 +2175,8 @@ row_sel_get_clust_rec_for_mysql(
a previous version of the record */
trx = thr_get_trx(thr);
old_vers = NULL;
if (!lock_clust_rec_cons_read_sees(clust_rec, clust_index,
trx->read_view)) {
@ -2121,6 +2193,25 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = old_vers;
}
/* If we had to go to an earlier version of row or the
secondary index record is delete marked, then it may be that
the secondary index record corresponding to clust_rec
(or old_vers) is not rec; in that case we must ignore
such row because in our snapshot rec would not have existed.
Remember that from rec we cannot see directly which transaction
id corrsponds to it: we have to go to the clustered index
record. A query where we want to fetch all rows where
the secondary index value is in some interval would return
a wrong result if we would not drop rows which we come to
visit through secondary index records that would not really
exist in our snapshot. */
if ((old_vers || rec_get_deleted_flag(rec))
&& !row_sel_sec_rec_is_for_clust_rec(rec, sec_index,
clust_rec, clust_index)) {
clust_rec = NULL;
}
}
*out_rec = clust_rec;
@ -2609,8 +2700,10 @@ rec_loop:
goto next_rec;
}
rec = clust_rec;
if (prebuilt->need_to_access_clustered) {
rec = clust_rec;
}
}
/* We found a qualifying row */

View File

@ -250,9 +250,12 @@ row_undo_ins_parse_undo_rec(
ut_ad(type == TRX_UNDO_INSERT_REC);
node->rec_type = type;
/* NOTE that the table has to be explicitly released later */
node->table = dict_table_get_on_id(table_id, node->trx);
if (node->table == NULL) {
return;
}
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
@ -280,9 +283,14 @@ row_undo_ins(
row_undo_ins_parse_undo_rec(node, thr);
found = row_undo_search_clust_to_pcur(node, thr);
if (node->table == NULL) {
found = FALSE;
} else {
found = row_undo_search_clust_to_pcur(node, thr);
}
if (!found) {
trx_undo_rec_release(node->trx, node->undo_no);
return(DB_SUCCESS);
}

View File

@ -534,9 +534,16 @@ row_undo_mod_parse_undo_rec(
&undo_no, &table_id);
node->rec_type = type;
/* NOTE that the table has to be explicitly released later */
node->table = dict_table_get_on_id(table_id, thr_get_trx(thr));
/* TODO: other fixes associated with DROP TABLE + rollback in the
same table by another user */
if (node->table == NULL) {
/* Table was dropped */
return;
}
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
@ -571,12 +578,18 @@ row_undo_mod(
row_undo_mod_parse_undo_rec(node, thr);
found = row_undo_search_clust_to_pcur(node, thr);
if (node->table == NULL) {
found = FALSE;
} else {
found = row_undo_search_clust_to_pcur(node, thr);
}
if (!found) {
/* It is already undone, or will be undone by another query
thread */
thread, or table was dropped */
trx_undo_rec_release(node->trx, node->undo_no);
node->state = UNDO_NODE_FETCH_NEXT;
return(DB_SUCCESS);

View File

@ -85,7 +85,7 @@ void _nisam_print_key(FILE *stream, register N_KEYSEG *keyseg, const uchar *key)
key=end;
break;
case HA_KEYTYPE_INT24:
VOID(fprintf(stream,"%ld",sint3korr(key)));
VOID(fprintf(stream,"%ld",(long) sint3korr(key)));
key=end;
break;
case HA_KEYTYPE_UINT24:

View File

@ -16,11 +16,11 @@
MA 02111-1307, USA */
#define DONT_USE_RAID
#include <global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
#include <odbcinst.h>
#endif
#include <global.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>

View File

@ -335,11 +335,10 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
int _mi_writeinfo(register MI_INFO *info, uint operation)
{
int error,olderror;
MYISAM_SHARE *share;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_writeinfo");
error=0;
share=info->s;
if (share->r_locks == 0 && share->w_locks == 0)
{
olderror=my_errno; /* Remember last error */
@ -368,7 +367,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
{
share->changed= 1; /* Mark keyfile changed */
}
DBUG_RETURN(error);
DBUG_RETURN(error);
} /* _mi_writeinfo */

View File

@ -27,10 +27,10 @@ CLEANFILES = $(test_SCRIPTS)
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
install-data-local:
$(mkinstalldirs) \

View File

@ -1,3 +0,0 @@
-- require r/have_default_master.require
connection master;
show variables like "port";

View File

@ -9,5 +9,7 @@ connection master;
reset master;
connection slave;
reset slave;
# Clean up old test tables
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
@r/slave-running.result show status like 'Slave_running';

View File

@ -25,8 +25,8 @@ then
data=var/slave-data
ldata=$fix_bin/var/slave-data
else
data=var/lib
ldata=$fix_bin/var/lib
data=var/master-data
ldata=$fix_bin/var/master-data
fi
mdata=$data/mysql

View File

@ -198,7 +198,7 @@ done
#--
MYRUN_DIR=$MYSQL_TEST_DIR/var/run
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/lib"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/mysql-master.sock"
MASTER_MYPID="$MYRUN_DIR/mysqld.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/mysqld.log"
@ -298,6 +298,8 @@ prompt_user ()
read unused
}
# We can't use diff -u as this isn't portable
show_failed_diff ()
{
reject_file=r/$1.reject
@ -306,7 +308,7 @@ show_failed_diff ()
then
echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------"
$DIFF -u $result_file $reject_file
$DIFF -c $result_file $reject_file
echo "-------------------------------------------------------"
echo "Please e-mail the above, along with the output of mysqlbug"
echo "and any other relevant info to bugs@lists.mysql.com"
@ -377,6 +379,8 @@ mysql_install_db () {
error "Could not install slave test DBs"
exit 1
fi
# Give mysqld some time to die.
sleep $SLEEP_TIME
return 0
}
@ -515,7 +519,7 @@ start_slave()
--core \
--tmpdir=$MYSQL_TMP_DIR \
--language=english \
--skip-innodb \
--skip-innodb --skip-slave-start \
$SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
if [ x$DO_DDD = x1 ]

View File

@ -1,5 +1,5 @@
Table Op Msg_type Msg_text
t1 backup error Failed copying .frm file: errno = X
test.t1 backup error Failed copying .frm file: errno = X
test.t1 backup status Operation failed
Table Op Msg_type Msg_text
test.t1 backup status OK

View File

@ -492,3 +492,20 @@ a 1
a 2
MIN(B) MAX(b)
1 1
id
0
1
2
id
0
1
2
id
0
1
2
id id3
0 0
1 1
2 2
100 2

View File

@ -30,3 +30,7 @@ Documentation 0
Host communication 0
kkkkkkkkkkk lllllllllll 3
Test Procedures 0
1+1 a count(*)
2 a 0
1+1 a count(*)
2 a 0

View File

@ -1,2 +0,0 @@
Variable_name Value
port 9306

View File

@ -449,3 +449,29 @@ a
1
table type possible_keys key key_len ref rows Extra
t1 range PRIMARY PRIMARY 4 NULL 1 where used
id
0
1
2
id
0
1
2
id
0
1
2
id id3
0 0
1 1
2 2
100 2
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) default NULL,
KEY `a` (`a`)
) TYPE=InnoDB
a
1
2
3

View File

@ -1,2 +1,6 @@
dummy1 count(distinct id)
NULL 1
Table Op Msg_type Msg_text
test.t1 check status OK
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES

View File

@ -1,13 +1,13 @@
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 No 0 0
127.0.0.1 root 9999 1 master-bin.001 73 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 173 Yes 0 0
127.0.0.1 root 9999 1 master-bin.001 173 Yes 0 0
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
n

View File

@ -3,11 +3,11 @@ master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
0 0 0 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 test 3306 60 4 No 0 0
127.0.0.1 test 9998 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 4 No 0 0
127.0.0.1 root 9999 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.001 73 Yes 0 0
127.0.0.1 root 9999 60 master-bin.001 73 Yes 0 0
n
10
45

View File

@ -1,5 +1,5 @@
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.001 216 Yes 0 0
127.0.0.1 root 9999 60 master-bin.001 216 Yes 0 0
s
Could not break slave
Tried hard
@ -10,7 +10,7 @@ master-bin.003
Log_name
master-bin.003
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.003 184 Yes 0 0
127.0.0.1 root 9999 60 master-bin.003 184 Yes 0 0
m
34
65
@ -25,6 +25,6 @@ master-bin.006
File Position Binlog_do_db Binlog_ignore_db
master-bin.006 131
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.006 131 Yes 0 0
127.0.0.1 root 9999 60 master-bin.006 131 Yes 0 0
count(*)
100

View File

@ -67,3 +67,16 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL
t1 0 PRIMARY 2 f2 A 3 NULL NULL
t1 0 PRIMARY 3 f3 A 9 NULL NULL
t1 0 PRIMARY 4 f4 A 18 NULL NULL
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'

View File

@ -1,5 +0,0 @@
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'

View File

@ -678,3 +678,30 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
drop table t1;
#
# Test problem with BDB and lock tables with duplicate write.
#
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
--error 690
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1;
select id from t1;
UNLOCK TABLES;
DROP TABLE t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=bdb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
--error 690
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
commit;
select id,id3 from t1;
UNLOCK TABLES;
DROP TABLE t1;

View File

@ -2,6 +2,7 @@
# Test of group (Failed for Lars Hoss <lh@pbm.de>)
#
drop table if exists t1,t2;
CREATE TABLE t1 (
spID int(10) unsigned,
userID int(10) unsigned,
@ -208,3 +209,14 @@ select value,description,bug_id from t2 left join t1 on t2.program=t1.product an
select value,description,COUNT(bug_id) from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA" group by value;
drop table t1,t2;
#
# Problem with functions and group functions when no matching rows
#
create table t1 (foo int);
insert into t1 values (1);
select 1+1, "a",count(*) from t1 where foo in (2);
insert into t1 values (1);
select 1+1,"a",count(*) from t1 where foo in (2);
drop table t1;

View File

@ -429,3 +429,50 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
drop table t1;
#
# Test lock tables
#
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
--error 690
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1;
select id from t1;
UNLOCK TABLES;
DROP TABLE t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
--error 690
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
commit;
select id,id3 from t1;
UNLOCK TABLES;
DROP TABLE t1;
#
# Test prefix key
#
--error 1089
create table t1 (a char(20), unique (a(5))) type=innodb;
create table t1 (a char(20), index (a(5))) type=innodb;
show create table t1;
drop table t1;
#
# Test using temporary table and auto_increment
#
create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
insert into t1 values (NULL),(NULL),(NULL);
delete from t1 where a=3;
insert into t1 values (NULL);
select * from t1;
drop table t1;

View File

@ -21,3 +21,35 @@ LOCK TABLE t1 WRITE,t2 write;
insert into t2 SELECT * from t1;
update t1 set id=1 where id=-1;
drop table t1,t2;
#
# Check bug with INSERT ... SELECT with lock tables
#
CREATE TABLE t1 (
index1 smallint(6) default NULL,
nr smallint(6) default NULL,
KEY index1(index1)
) TYPE=MyISAM;
CREATE TABLE t2 (
nr smallint(6) default NULL,
name varchar(20) default NULL
) TYPE=MyISAM;
INSERT INTO t2 VALUES (1,'item1');
INSERT INTO t2 VALUES (2,'item2');
# problem begins here!
lock tables t1 write, t2 read;
insert into t1 select 1,nr from t2 where name='item1';
insert into t1 select 2,nr from t2 where name='item2';
unlock tables;
check table t1;
# Check error message
lock tables t1 write;
check table t2;
unlock tables;
drop table t1,t2;

View File

@ -1,18 +1,21 @@
source include/master-slave.inc;
source include/have_default_master.inc;
connection master;
show master status;
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
slave start;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
change master to master_log_pos=173;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
connection master;
show master status;

View File

@ -1,6 +1,5 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0, mysql-slave.sock);
source include/have_default_master.inc;
connection master;
reset master;
show master status;
@ -9,12 +8,15 @@ connection slave;
reset slave;
show slave status;
change master to master_host='127.0.0.1';
--replace_result 3306 9998 9306 9999 3334 9999 3335 9999
show slave status;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
slave start;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
connection master;
drop table if exists t1;

View File

@ -1,6 +1,5 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock);
source include/have_default_master.inc;
system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info;
connection slave;
@ -23,6 +22,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
select * from t1;
connection master;
@ -68,6 +68,7 @@ insert into t2 values (65);
save_master_pos;
connection slave;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
select * from t2;
connection master;
@ -87,6 +88,7 @@ connection slave;
slave stop;
slave start;
sync_with_master;
--replace_result 9306 9999 3334 9999 3335 9999
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock

View File

@ -1,3 +1,3 @@
rm -f $MYSQL_TEST_DIR/var/lib/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/lib/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/lib/master-bin.index
rm -f $MYSQL_TEST_DIR/var/master-data/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/master-data/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/master-data/master-bin.index

View File

@ -48,3 +48,20 @@ show index from t1;
repair table t1;
show index from t1;
drop table t1;
#
# Test of SHOW CREATE
#
create temporary table t1 (a int not null);
show create table t1;
alter table t1 rename t2;
show create table t2;
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;

View File

@ -1,8 +0,0 @@
use test;
drop table if exists t1;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;

View File

@ -66,7 +66,7 @@ int my_error(int nr,myf MyFlags, ...)
while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
tpos++;
if (*tpos == 'l') /* Skipp 'l' argument */
*tpos++;
tpos++;
if (*tpos == 's') /* String parameter */
{
par = va_arg(ap, char *);

View File

@ -788,7 +788,7 @@ Fstat(int fd, MY_STAT *stat_area, myf MyFlags )
DBUG_PRINT("enter",("fd: %d MyFlags: %d",fd,MyFlags));
uint i;
int error=0;
MY_STAT my_stat;
MY_STAT status;
stat_area->st_size=0;
stat_area->st_mtime=0;
stat_area->st_atime=0;
@ -796,12 +796,12 @@ Fstat(int fd, MY_STAT *stat_area, myf MyFlags )
for(i=0 ; i < _raid_chunks ; i++)
{
if (my_fstat(_fd_vector[i],&my_stat,MyFlags))
if (my_fstat(_fd_vector[i],&status,MyFlags))
error=1;
stat_area->st_size+=my_stat.st_size;
set_if_bigger(stat_area->st_mtime,my_stat.st_mtime);
set_if_bigger(stat_area->st_atime,my_stat.st_atime);
set_if_bigger(stat_area->st_ctime,my_stat.st_ctime);
stat_area->st_size+=status.st_size;
set_if_bigger(stat_area->st_mtime,status.st_mtime);
set_if_bigger(stat_area->st_atime,status.st_atime);
set_if_bigger(stat_area->st_ctime,status.st_ctime);
}
DBUG_RETURN(error);
}

View File

@ -62,9 +62,10 @@ do
done
for i in extra/comp_err extra/replace extra/perror extra/resolveip \
extra/my_print_defaults isam/isamchk isam/pack_isam myisam/myisamchk \
extra/my_print_defaults extra/resolve_stack_dump \
isam/isamchk isam/pack_isam myisam/myisamchk \
myisam/myisampack sql/mysqld sql/mysqlbinlog \
client/mysql sql/mysqld client/mysqlshow \
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck \
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
@ -104,8 +105,8 @@ rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD
$CP mysql-test/mysql-test-run mysql-test/install_test_db $BASE/mysql-test/
$CP mysql-test/README $BASE/mysql-test/README
$CP mysql-test/include/*.inc $BASE/mysql-test/include
$CP mysql-test/std_data/*.dat $BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.opt $BASE/mysql-test/t
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.001 $BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.opt mysql-test/t/*.sh $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require $BASE/mysql-test/r
$CP scripts/* $BASE/bin

View File

@ -30,7 +30,7 @@ mysqlhotcopy - fast on-line hot-backup utility for local MySQL databases and tab
mysqlhotcopy --method='scp -Bq -i /usr/home/foo/.ssh/identity' --user=root --password=secretpassword \
db_1./^nice_table/ user@some.system.dom:~/path/to/new_directory
WARNING: THIS IS VERY MUCH A FIRST-CUT ALPHA. Comments/patches welcome.
WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
=cut

View File

@ -1,20 +1,20 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 0:38:04
Testing server 'MySQL 3.23.37' at 2001-04-19 13:49:16
ATIS table test
Creating tables
Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_table (28): 0 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (9768): 5 wallclock secs ( 0.95 usr 1.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to insert (9768): 6 wallclock secs ( 0.81 usr 1.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data
Time for select_simple_join (500): 3 wallclock secs ( 1.59 usr 0.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_join (100): 4 wallclock secs ( 1.39 usr 0.55 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix_join (100): 19 wallclock secs (12.20 usr 4.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_distinct (800): 17 wallclock secs ( 4.72 usr 1.55 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (2800): 20 wallclock secs ( 3.14 usr 0.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_simple_join (500): 3 wallclock secs ( 1.52 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_join (100): 4 wallclock secs ( 1.41 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix_join (100): 18 wallclock secs (12.05 usr 4.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_distinct (800): 17 wallclock secs ( 4.72 usr 1.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (2800): 21 wallclock secs ( 3.06 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Removing tables
Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 68 wallclock secs (24.02 usr 9.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 69 wallclock secs (23.58 usr 10.26 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,96 +1,103 @@
Benchmark DBD suite: 2.11a
Date of test: 2001-01-17 23:59:27
Running tests on: Windows NT Version 4.0
Arguments:
Benchmark DBD suite: 2.12
Date of test: 2001-04-19 13:10:13
Running tests on: Windows NT Version 4.0
Arguments:
Comments: 2x Pentium III XEON 450MHZ, 512M
Limits from:
Server version: MySQL 3.23.31
Limits from:
Server version: MySQL 3.23.37
alter-table: Total time: 2315 wallclock secs ( 0.78 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
ATIS: Total time: 68 wallclock secs (24.02 usr 9.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
big-tables: Total time: 80 wallclock secs (18.31 usr 19.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
connect: Total time: 183 wallclock secs (60.53 usr 49.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
create: Total time: 995 wallclock secs (13.64 usr 10.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
insert: Total time: 7164 wallclock secs (872.86 usr 441.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
select: Total time: 1297 wallclock secs (113.66 usr 43.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
wisconsin: Total time: 28 wallclock secs ( 7.94 usr 5.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
alter-table: Total time: 2342 wallclock secs ( 0.91 usr 0.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
ATIS: Total time: 69 wallclock secs (23.58 usr 10.26 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
big-tables: Total time: 79 wallclock secs (17.44 usr 18.84 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
connect: Total time: 179 wallclock secs (58.89 usr 48.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
create: Total time: 897 wallclock secs (15.94 usr 10.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
insert: Total time: 6659 wallclock secs (1143.94 usr 544.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
select: Total time: 1556 wallclock secs (127.53 usr 47.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
wisconsin: Total time: 28 wallclock secs ( 7.95 usr 5.70 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
All 8 test executed successfully
Totals per operation:
Operation seconds usr sys cpu tests
alter_table_add 1225.00 0.47 0.25 0.00 992
alter_table_drop 1039.00 0.19 0.11 0.00 496
connect 33.00 11.47 9.97 0.00 10000
connect+select_1_row 38.00 13.19 12.03 0.00 10000
connect+select_simple 36.00 12.84 11.23 0.00 10000
count 35.00 0.06 0.00 0.00 100
count_distinct 80.00 0.94 0.31 0.00 2000
count_distinct_big 214.00 23.03 7.88 0.00 120
count_distinct_group 150.00 3.03 1.20 0.00 1000
count_distinct_group_on_key 45.00 0.67 0.25 0.00 1000
count_distinct_group_on_key_parts 150.00 3.31 0.97 0.00 1000
count_group_on_key_parts 41.00 2.81 0.92 0.00 1000
count_on_key 377.00 21.58 9.17 0.00 50100
create+drop 142.00 3.30 2.89 0.00 10000
create_MANY_tables 245.00 2.73 1.56 0.00 10000
create_index 25.00 0.00 0.00 0.00 8
create_key+drop 172.00 5.14 2.92 0.00 10000
create_table 0.00 0.00 0.01 0.00 31
delete_all 21.00 0.00 0.02 0.00 12
delete_all_many_keys 1980.00 0.03 0.03 0.00 1
delete_big 0.00 0.00 0.00 0.00 1
delete_big_many_keys 1980.00 0.03 0.03 0.00 128
delete_key 8.00 0.88 1.34 0.00 10000
drop_index 25.00 0.00 0.00 0.00 8
drop_table 0.00 0.00 0.00 0.00 28
drop_table_when_MANY_tables 187.00 1.08 1.38 0.00 10000
insert 234.00 35.02 48.52 0.00 350768
insert_duplicates 59.00 8.92 14.09 0.00 100000
insert_key 1853.00 13.92 13.81 0.00 100000
insert_many_fields 22.00 0.64 0.39 0.00 2000
insert_select_1_key 8.00 0.00 0.00 0.00 1
insert_select_2_keys 12.00 0.00 0.00 0.00 1
min_max 18.00 0.05 0.02 0.00 60
min_max_on_key 193.00 35.67 14.80 0.00 85000
multiple_value_insert 12.00 2.50 0.19 0.00 100000
order_by_big 104.00 64.25 25.28 0.00 10
order_by_big_key 95.00 69.14 26.05 0.00 10
order_by_big_key2 90.00 63.38 26.20 0.00 10
order_by_big_key_desc 96.00 68.61 26.58 0.00 10
order_by_big_key_diff 100.00 65.05 24.69 0.00 10
order_by_big_key_prefix 89.00 63.73 25.53 0.00 10
order_by_key2_diff 11.00 5.53 2.23 0.00 500
order_by_key_prefix 6.00 3.11 1.09 0.00 500
order_by_range 9.00 3.02 1.25 0.00 500
outer_join 118.00 0.00 0.00 0.00 10
outer_join_found 106.00 0.02 0.00 0.00 10
outer_join_not_found 58.00 0.02 0.00 0.00 500
outer_join_on_key 41.00 0.03 0.00 0.00 10
select_1_row 5.00 1.14 1.80 0.00 10000
select_2_rows 6.00 0.91 2.03 0.00 10000
select_big 146.00 83.48 34.54 0.00 10080
select_column+column 6.00 0.88 1.83 0.00 10000
select_diff_key 122.00 0.45 0.08 0.00 500
select_distinct 17.00 4.72 1.55 0.00 800
select_group 56.00 3.17 1.01 0.00 2911
select_group_when_MANY_tables 249.00 1.39 2.03 0.00 10000
select_join 4.00 1.39 0.55 0.00 100
select_key 194.00 90.98 38.86 0.00 200000
select_key2 202.00 92.78 37.67 0.00 200000
select_key_prefix 199.00 93.61 38.05 0.00 200000
select_key_prefix_join 19.00 12.20 4.53 0.00 100
select_many_fields 55.00 17.65 18.90 0.00 2000
select_range 187.00 27.39 9.33 0.00 410
select_range_key2 29.00 10.31 3.64 0.00 25010
select_range_prefix 28.00 10.05 4.22 0.00 25010
select_simple 4.00 0.88 1.61 0.00 10000
select_simple_join 3.00 1.59 0.67 0.00 500
update_big 60.00 0.00 0.00 0.00 10
update_of_key 56.00 4.28 7.00 0.00 50000
update_of_key_big 33.00 0.06 0.08 0.00 501
update_of_primary_key_many_keys 580.00 0.03 0.05 0.00 256
update_with_key 188.00 27.97 41.06 0.00 300000
update_with_key_prefix 59.00 9.42 12.14 0.00 100000
wisc_benchmark 9.00 5.44 1.66 0.00 114
TOTALS 14098.00 1111.56 580.08 0.00 2046247
alter_table_add 1246.00 0.52 0.22 0.00 992
alter_table_drop 1043.00 0.27 0.06 0.00 496
connect 33.00 12.13 9.89 0.00 10000
connect+select_1_row 39.00 12.91 11.73 0.00 10000
connect+select_simple 37.00 12.36 12.34 0.00 10000
count 36.00 0.03 0.02 0.00 100
count_distinct 48.00 0.56 0.20 0.00 1000
count_distinct_2 52.00 0.45 0.27 0.00 1000
count_distinct_big 205.00 22.49 8.11 0.00 120
count_distinct_group 145.00 2.67 1.19 0.00 1000
count_distinct_group_on_key 48.00 0.58 0.17 0.00 1000
count_distinct_group_on_key_parts 145.00 3.02 0.94 0.00 1000
count_distinct_key_prefix 39.00 0.52 0.17 0.00 1000
count_group_on_key_parts 40.00 2.73 0.83 0.00 1000
count_on_key 405.00 22.87 8.23 0.00 50100
create+drop 134.00 3.78 2.89 0.00 10000
create_MANY_tables 231.00 3.27 1.58 0.00 10000
create_index 26.00 0.00 0.00 0.00 8
create_key+drop 167.00 5.98 2.77 0.00 10000
create_table 0.00 0.02 0.02 0.00 31
delete_all 19.00 0.00 0.00 0.00 12
delete_all_many_keys 1431.00 0.00 0.03 0.00 1
delete_big 0.00 0.00 0.00 0.00 1
delete_big_many_keys 1431.00 0.00 0.03 0.00 128
delete_key 7.00 1.14 1.42 0.00 10000
drop_index 27.00 0.00 0.00 0.00 8
drop_table 0.00 0.00 0.00 0.00 28
drop_table_when_MANY_tables 169.00 1.41 1.42 0.00 10000
insert 235.00 33.44 47.68 0.00 350768
insert_duplicates 59.00 9.02 12.91 0.00 100000
insert_key 1440.00 13.86 11.92 0.00 100000
insert_many_fields 22.00 0.64 0.45 0.00 2000
insert_select_1_key 8.00 0.00 0.00 0.00 1
insert_select_2_keys 12.00 0.00 0.00 0.00 1
min_max 19.00 0.00 0.02 0.00 60
min_max_on_key 196.00 37.78 15.60 0.00 85000
multiple_value_insert 9.00 2.53 0.19 0.00 100000
order_by_big 101.00 61.84 25.81 0.00 10
order_by_big_key 93.00 66.86 26.16 0.00 10
order_by_big_key2 88.00 62.99 24.97 0.00 10
order_by_big_key_desc 94.00 67.34 25.92 0.00 10
order_by_big_key_diff 98.00 62.45 25.16 0.00 10
order_by_big_key_prefix 88.00 62.72 25.19 0.00 10
order_by_key2_diff 11.00 5.53 2.19 0.00 500
order_by_key_prefix 6.00 2.94 1.08 0.00 500
order_by_range 9.00 2.92 1.23 0.00 500
outer_join 120.00 0.00 0.00 0.00 10
outer_join_found 106.00 0.00 0.00 0.00 10
outer_join_not_found 56.00 0.03 0.00 0.00 500
outer_join_on_key 41.00 0.00 0.00 0.00 10
select_1_row 5.00 1.23 1.69 0.00 10000
select_2_rows 6.00 1.00 2.20 0.00 10000
select_big 139.00 80.53 32.12 0.00 10080
select_column+column 5.00 1.08 1.75 0.00 10000
select_diff_key 127.00 0.67 0.05 0.00 500
select_distinct 17.00 4.72 1.78 0.00 800
select_group 59.00 3.11 1.34 0.00 2911
select_group_when_MANY_tables 196.00 1.48 1.77 0.00 10000
select_join 4.00 1.41 0.53 0.00 100
select_key 196.00 103.61 37.28 0.00 200000
select_key2 205.00 93.56 39.66 0.00 200000
select_key2_return_key 198.00 90.06 35.53 0.00 200000
select_key2_return_prim 203.00 91.61 35.25 0.00 200000
select_key_prefix 201.00 93.56 39.13 0.00 200000
select_key_prefix_join 18.00 12.05 4.75 0.00 100
select_key_return_key 195.00 89.05 37.13 0.00 200000
select_many_fields 54.00 16.80 18.40 0.00 2000
select_query_cache 90.00 5.81 1.91 0.00 10000
select_query_cache2 91.00 5.55 1.86 0.00 10000
select_range 186.00 27.06 9.17 0.00 410
select_range_key2 30.00 10.39 3.47 0.00 25010
select_range_prefix 28.00 10.19 4.06 0.00 25010
select_simple 4.00 0.80 1.48 0.00 10000
select_simple_join 3.00 1.52 0.66 0.00 500
update_big 66.00 0.00 0.00 0.00 10
update_of_key 56.00 4.66 6.17 0.00 50000
update_of_key_big 32.00 0.05 0.11 0.00 501
update_of_primary_key_many_keys 447.00 0.03 0.00 0.00 256
update_with_key 190.00 27.05 40.97 0.00 300000
update_with_key_prefix 58.00 9.02 13.19 0.00 100000
wisc_benchmark 9.00 5.77 1.45 0.00 114
TOTALS 13232.00 1396.03 685.87 0.00 2667247

View File

@ -1,16 +1,16 @@
Testing server 'MySQL 3.23.31' at 2001-01-17 23:59:28
Testing server 'MySQL 3.23.37' at 2001-04-19 13:10:14
Testing of ALTER TABLE
Testing with 1000 columns and 1000 rows in 20 steps
Insert data into the table
Time for insert (1000) 1 wallclock secs ( 0.13 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert (1000) 0 wallclock secs ( 0.13 usr 0.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_add (992): 1225 wallclock secs ( 0.47 usr 0.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_add (992): 1246 wallclock secs ( 0.52 usr 0.22 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 25 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 26 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 25 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 27 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_drop (496): 1039 wallclock secs ( 0.19 usr 0.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_drop (496): 1043 wallclock secs ( 0.27 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 2315 wallclock secs ( 0.78 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 2342 wallclock secs ( 0.91 usr 0.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,19 +1,19 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 0:39:12
Testing server 'MySQL 3.23.37' at 2001-04-19 13:50:25
Testing of some unusual tables
All tests are done 1000 times with 1000 fields
Testing table with 1000 fields
Testing select * from table with 1 record
Time to select_many_fields(1000): 20 wallclock secs ( 8.56 usr 9.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_many_fields(1000): 19 wallclock secs ( 8.02 usr 9.49 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select all_fields from table with 1 record
Time to select_many_fields(1000): 35 wallclock secs ( 9.09 usr 9.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_many_fields(1000): 35 wallclock secs ( 8.78 usr 8.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert VALUES()
Time to insert_many_fields(1000): 4 wallclock secs ( 0.47 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to insert_many_fields(1000): 3 wallclock secs ( 0.48 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert (all_fields) VALUES()
Time to insert_many_fields(1000): 18 wallclock secs ( 0.17 usr 0.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to insert_many_fields(1000): 19 wallclock secs ( 0.16 usr 0.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 80 wallclock secs (18.31 usr 19.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 79 wallclock secs (17.44 usr 18.84 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,30 +1,30 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 0:40:33
Testing server 'MySQL 3.23.37' at 2001-04-19 13:51:45
Testing the speed of connecting to the server and sending of data
All tests are done 10000 times
Testing connection/disconnect
Time to connect (10000): 33 wallclock secs (11.47 usr 9.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to connect (10000): 33 wallclock secs (12.13 usr 9.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test connect/simple select/disconnect
Time for connect+select_simple (10000): 36 wallclock secs (12.84 usr 11.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for connect+select_simple (10000): 37 wallclock secs (12.36 usr 12.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test simple select
Time for select_simple (10000): 4 wallclock secs ( 0.88 usr 1.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_simple (10000): 4 wallclock secs ( 0.80 usr 1.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing connect/select 1 row from table/disconnect
Time to connect+select_1_row (10000): 38 wallclock secs (13.19 usr 12.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to connect+select_1_row (10000): 39 wallclock secs (12.91 usr 11.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 1 row from table
Time to select_1_row (10000): 5 wallclock secs ( 1.14 usr 1.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_1_row (10000): 5 wallclock secs ( 1.23 usr 1.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 2 rows from table
Time to select_2_rows (10000): 6 wallclock secs ( 0.91 usr 2.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_2_rows (10000): 6 wallclock secs ( 1.00 usr 2.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test select with aritmetic (+)
Time for select_column+column (10000): 6 wallclock secs ( 0.88 usr 1.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_column+column (10000): 5 wallclock secs ( 1.08 usr 1.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing retrieval of big records (65000 bytes)
Time to select_big (10000): 55 wallclock secs (19.23 usr 8.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_big (10000): 50 wallclock secs (17.36 usr 6.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 183 wallclock secs (60.53 usr 49.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 179 wallclock secs (58.89 usr 48.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,18 +1,18 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 0:43:36
Testing server 'MySQL 3.23.37' at 2001-04-19 13:54:45
Testing the speed of creating and droping tables
Testing with 10000 tables and 10000 loop count
Testing create of tables
Time for create_MANY_tables (10000): 245 wallclock secs ( 2.73 usr 1.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_MANY_tables (10000): 231 wallclock secs ( 3.27 usr 1.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Accessing tables
Time to select_group_when_MANY_tables (10000): 249 wallclock secs ( 1.39 usr 2.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to select_group_when_MANY_tables (10000): 196 wallclock secs ( 1.48 usr 1.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing drop
Time for drop_table_when_MANY_tables (10000): 187 wallclock secs ( 1.08 usr 1.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_table_when_MANY_tables (10000): 169 wallclock secs ( 1.41 usr 1.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing create+drop
Time for create+drop (10000): 142 wallclock secs ( 3.30 usr 2.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_key+drop (10000): 172 wallclock secs ( 5.14 usr 2.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 995 wallclock secs (13.64 usr 10.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create+drop (10000): 134 wallclock secs ( 3.78 usr 2.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_key+drop (10000): 167 wallclock secs ( 5.98 usr 2.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 897 wallclock secs (15.94 usr 10.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,4 +1,4 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 1:00:12
Testing server 'MySQL 3.23.37' at 2001-04-19 14:09:43
Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows.
@ -8,55 +8,58 @@ Creating tables
Inserting 100000 rows in order
Inserting 100000 rows in reverse order
Inserting 100000 rows in random order
Time for insert (300000): 203 wallclock secs (30.27 usr 42.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert (300000): 203 wallclock secs (29.19 usr 40.84 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert of duplicates
Time for insert_duplicates (100000): 59 wallclock secs ( 8.92 usr 14.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_duplicates (100000): 59 wallclock secs ( 9.02 usr 12.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data from the table
Time for select_big (10:3000000): 90 wallclock secs (63.84 usr 25.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key (10:3000000): 95 wallclock secs (69.14 usr 26.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_desc (10:3000000): 96 wallclock secs (68.61 usr 26.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_prefix (10:3000000): 89 wallclock secs (63.73 usr 25.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key2 (10:3000000): 90 wallclock secs (63.38 usr 26.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_diff (10:3000000): 100 wallclock secs (65.05 usr 24.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big (10:3000000): 104 wallclock secs (64.25 usr 25.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_range (500:125750): 9 wallclock secs ( 3.02 usr 1.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key_prefix (500:125750): 6 wallclock secs ( 3.11 usr 1.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key2_diff (500:250500): 11 wallclock secs ( 5.53 usr 2.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_diff_key (500:1000): 122 wallclock secs ( 0.45 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (5010:42084): 15 wallclock secs ( 4.52 usr 1.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (5010:42084): 16 wallclock secs ( 4.67 usr 1.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix (200000): 199 wallclock secs (93.61 usr 38.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key (200000): 194 wallclock secs (90.98 usr 38.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2 (200000): 202 wallclock secs (92.78 usr 37.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_big (10:3000000): 88 wallclock secs (62.84 usr 25.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key (10:3000000): 93 wallclock secs (66.86 usr 26.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_desc (10:3000000): 94 wallclock secs (67.34 usr 25.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_prefix (10:3000000): 88 wallclock secs (62.72 usr 25.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key2 (10:3000000): 88 wallclock secs (62.99 usr 24.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big_key_diff (10:3000000): 98 wallclock secs (62.45 usr 25.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_big (10:3000000): 101 wallclock secs (61.84 usr 25.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_range (500:125750): 9 wallclock secs ( 2.92 usr 1.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key_prefix (500:125750): 6 wallclock secs ( 2.94 usr 1.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key2_diff (500:250500): 11 wallclock secs ( 5.53 usr 2.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_diff_key (500:1000): 127 wallclock secs ( 0.67 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (5010:42084): 15 wallclock secs ( 4.69 usr 1.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (5010:42084): 16 wallclock secs ( 4.70 usr 1.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix (200000): 201 wallclock secs (93.56 usr 39.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key (200000): 196 wallclock secs (103.61 usr 37.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_return_key (200000): 195 wallclock secs (89.05 usr 37.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2 (200000): 205 wallclock secs (93.56 usr 39.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2_return_key (200000): 198 wallclock secs (90.06 usr 35.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2_return_prim (200000): 203 wallclock secs (91.61 usr 35.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test of compares with simple ranges
Time for select_range_prefix (20000:43500): 13 wallclock secs ( 5.53 usr 2.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (20000:43500): 13 wallclock secs ( 5.64 usr 2.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (111): 36 wallclock secs ( 0.03 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (15000): 14 wallclock secs ( 6.42 usr 2.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max (60): 18 wallclock secs ( 0.05 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (100): 31 wallclock secs ( 0.06 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count (100): 35 wallclock secs ( 0.06 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (20): 103 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (20000:43500): 13 wallclock secs ( 5.50 usr 2.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (20000:43500): 14 wallclock secs ( 5.69 usr 2.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (111): 38 wallclock secs ( 0.05 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (15000): 14 wallclock secs ( 6.08 usr 2.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max (60): 19 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (100): 37 wallclock secs ( 0.06 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count (100): 36 wallclock secs ( 0.03 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (20): 91 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys with functions
Time for update_of_key (50000): 56 wallclock secs ( 4.28 usr 7.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key_big (501): 33 wallclock secs ( 0.06 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key (50000): 56 wallclock secs ( 4.66 usr 6.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key_big (501): 32 wallclock secs ( 0.05 usr 0.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update with key
Time for update_with_key (300000): 188 wallclock secs (27.97 usr 41.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_with_key_prefix (100000): 59 wallclock secs ( 9.42 usr 12.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_with_key (300000): 190 wallclock secs (27.05 usr 40.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_with_key_prefix (100000): 58 wallclock secs ( 9.02 usr 13.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of all rows
Time for update_big (10): 60 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_big (10): 66 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing left outer join
Time for outer_join_on_key (10:10): 41 wallclock secs ( 0.03 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join (10:10): 118 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_found (10:10): 106 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_not_found (500:10): 58 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_on_key (10:10): 41 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join (10:10): 120 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_found (10:10): 106 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_not_found (500:10): 56 wallclock secs ( 0.03 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing INSERT INTO ... SELECT
Time for insert_select_1_key (1): 8 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
@ -64,24 +67,24 @@ Time for insert_select_2_keys (1): 12 wallclock secs ( 0.00 usr 0.00 sys + 0.
Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing delete
Time for delete_key (10000): 8 wallclock secs ( 0.88 usr 1.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 21 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_key (10000): 7 wallclock secs ( 1.14 usr 1.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 19 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Insert into table with 16 keys and with a primary key with 16 parts
Time for insert_key (100000): 1853 wallclock secs (13.92 usr 13.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_key (100000): 1440 wallclock secs (13.86 usr 11.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys
Time for update_of_primary_key_many_keys (256): 580 wallclock secs ( 0.03 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_primary_key_many_keys (256): 447 wallclock secs ( 0.03 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting rows from the table
Time for delete_big_many_keys (128): 1980 wallclock secs ( 0.03 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_big_many_keys (128): 1431 wallclock secs ( 0.00 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting everything from table
Time for delete_all_many_keys (1): 1980 wallclock secs ( 0.03 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all_many_keys (1): 1431 wallclock secs ( 0.00 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting 100000 rows with multiple values
Time for multiple_value_insert (100000): 12 wallclock secs ( 2.50 usr 0.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for multiple_value_insert (100000): 9 wallclock secs ( 2.53 usr 0.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 7164 wallclock secs (872.86 usr 441.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 6659 wallclock secs (1143.94 usr 544.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,23 +1,30 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 2:59:37
Testing server 'MySQL 3.23.37' at 2001-04-19 16:00:44
Testing the speed of selecting on keys that consist of many parts
The test-table has 10000 rows and the test is done with 500 ranges.
Creating table
Inserting 10000 rows
Time to insert (10000): 7 wallclock secs ( 1.30 usr 1.41 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to insert (10000): 7 wallclock secs ( 1.27 usr 1.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test if the database has a query cache
Time for select_query_cache (10000): 90 wallclock secs ( 5.81 usr 1.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_query_cache2 (10000): 91 wallclock secs ( 5.55 usr 1.86 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing big selects on the table
Time for select_big (70:17207): 1 wallclock secs ( 0.41 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range (410:1057904): 187 wallclock secs (27.39 usr 9.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (70000): 179 wallclock secs (29.25 usr 12.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (50000): 346 wallclock secs (21.52 usr 9.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_big (70:17207): 1 wallclock secs ( 0.33 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range (410:1057904): 186 wallclock secs (27.06 usr 9.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (70000): 182 wallclock secs (31.70 usr 12.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (50000): 368 wallclock secs (22.81 usr 8.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_group_on_key_parts (1000:100000): 41 wallclock secs ( 2.81 usr 0.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_group_on_key_parts (1000:100000): 40 wallclock secs ( 2.73 usr 0.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing count(distinct) on the table
Time for count_distinct (2000:2000): 80 wallclock secs ( 0.94 usr 0.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key (1000:6000): 45 wallclock secs ( 0.67 usr 0.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key_parts (1000:100000): 150 wallclock secs ( 3.31 usr 0.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group (1000:100000): 150 wallclock secs ( 3.03 usr 1.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (100:1000000): 111 wallclock secs (23.03 usr 7.88 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1297 wallclock secs (113.66 usr 43.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_key_prefix (1000:1000): 39 wallclock secs ( 0.52 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct (1000:1000): 48 wallclock secs ( 0.56 usr 0.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_2 (1000:1000): 52 wallclock secs ( 0.45 usr 0.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key (1000:6000): 48 wallclock secs ( 0.58 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key_parts (1000:100000): 145 wallclock secs ( 3.02 usr 0.94 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group (1000:100000): 145 wallclock secs ( 2.67 usr 1.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (100:1000000): 114 wallclock secs (22.47 usr 8.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1556 wallclock secs (127.53 usr 47.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,14 +1,14 @@
Testing server 'MySQL 3.23.31' at 2001-01-18 3:21:15
Testing server 'MySQL 3.23.37' at 2001-04-19 16:26:40
Wisconsin benchmark test
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (31000): 19 wallclock secs ( 2.50 usr 3.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to insert (31000): 19 wallclock secs ( 2.17 usr 4.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Running actual benchmark
Time for wisc_benchmark (114): 9 wallclock secs ( 5.44 usr 1.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for wisc_benchmark (114): 9 wallclock secs ( 5.77 usr 1.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 28 wallclock secs ( 7.94 usr 5.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 28 wallclock secs ( 7.95 usr 5.70 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -39,11 +39,6 @@ $opt_read_key_loop_count=$opt_loop_count;
chomp($pwd = `pwd`); $pwd = "." if ($pwd eq '');
require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
if ($opt_loop_count < 256)
{
$opt_loop_count=256; # Some tests must have some data to work!
}
if ($opt_small_test)
{
$opt_loop_count/=100;
@ -62,6 +57,13 @@ elsif ($opt_small_key_tables)
$many_keys_loop_count/=10;
}
if ($opt_loop_count < 100)
{
$opt_loop_count=100; # Some tests must have some data to work!
}
$range_loop_count=min($opt_loop_count,$range_loop_count);
print "Testing the speed of inserting data into 1 table and do some selects on it.\n";
print "The tests are done with a table that has $opt_loop_count rows.\n\n";

View File

@ -49,7 +49,7 @@ typedef struct st_sort_param {
uint sort_length; /* Length of sortarg */
uint keys; /* Max antal nycklar / buffert */
uint ref_length; /* Length of record ref. */
ha_rows max_rows;
ha_rows max_rows,examined_rows;
TABLE *sort_form; /* For quicker make_sortkey */
SORT_FIELD *local_sortorder;
SORT_FIELD *end;
@ -91,7 +91,8 @@ static uint sortlength(SORT_FIELD *sortorder,uint length);
open a new file is opened */
ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
SQL_SELECT *select, ha_rows special, ha_rows max_rows)
SQL_SELECT *select, ha_rows special, ha_rows max_rows,
ha_rows *examined_rows)
{
int error;
uint memavl,old_memavl,maxbuffer,skr;
@ -113,6 +114,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
param.ref_length= table[0]->file->ref_length;
param.sort_length=sortlength(sortorder,s_length)+ param.ref_length;
param.max_rows= max_rows;
param.examined_rows=0;
if (select && select->quick)
{
@ -259,7 +261,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG));
else
statistic_add(filesort_rows, records, &LOCK_status);
*examined_rows= param.examined_rows;
#ifdef SKIPP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */
#endif
@ -367,6 +369,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->rnd_end();
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
}
if (error == 0)
param->examined_rows++;
if (error == 0 && (!select || select->skipp_record() == 0))
{
if (idx == param->keys)

View File

@ -41,10 +41,9 @@
from the updated tables.
Testing of:
- LOCK TABLES
- Mark tables that participate in a transaction so that they are not
closed during the transaction. We need to test what happens if
MySQL closes a table that is updated by a not commit transaction.
MySQL closes a table that is updated by a not commited transaction.
*/
@ -572,6 +571,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
transaction=0;
cursor=0;
key_read=0;
block_size=8192; // Berkeley DB block size
share->fixed_length_row=!(table->db_create_options & HA_OPTION_PACK_RECORD);
get_status();
@ -1701,12 +1701,35 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
DBUG_PRINT("trans",("commiting non-updating transaction"));
error=txn_commit((DB_TXN*) thd->transaction.stmt.bdb_tid,0);
thd->transaction.stmt.bdb_tid=0;
transaction=0;
}
}
}
DBUG_RETURN(error);
}
/*
When using LOCK TABLE's external_lock is only called when the actual
TABLE LOCK is done.
Under LOCK TABLES, each used tables will force a call to start_stmt.
*/
int ha_berkeley::start_stmt(THD *thd)
{
int error=0;
DBUG_ENTER("ha_berkeley::start_stmt");
if (!thd->transaction.stmt.bdb_tid)
{
error=txn_begin(db_env, (DB_TXN*) thd->transaction.all.bdb_tid,
(DB_TXN**) &thd->transaction.stmt.bdb_tid,
0);
transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid;
}
DBUG_RETURN(error);
}
/*
The idea with handler::store_lock() is the following:

View File

@ -136,6 +136,7 @@ class ha_berkeley: public handler
int extra(enum ha_extra_function operation);
int reset(void);
int external_lock(THD *thd, int lock_type);
int start_stmt(THD *thd);
void position(byte *record);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);

View File

@ -449,7 +449,7 @@ innobase_init(void)
if (!innobase_data_file_path)
{
fprintf(stderr,
"Can't initialize InnoDB as 'innobase_data_file_path' is not set\n");
"Can't initialize InnoDB as 'innodb_data_file_path' is not set\n");
innodb_skip=1;
DBUG_RETURN(FALSE); // Continue without innobase
}
@ -1868,7 +1868,7 @@ corresponding row to buf. */
int
ha_innobase::index_first(
/*=====================*/
/* out: 0, HA_ERR_KEY_NOT_FOUND,
/* out: 0, HA_ERR_END_OF_FILE,
or error code */
mysql_byte* buf) /* in/out: buffer for the row */
{
@ -1879,6 +1879,12 @@ ha_innobase::index_first(
error = index_read(buf, NULL, 0, HA_READ_AFTER_KEY);
/* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */
if (error == HA_ERR_KEY_NOT_FOUND) {
error = HA_ERR_END_OF_FILE;
}
DBUG_RETURN(error);
}
@ -1899,7 +1905,7 @@ ha_innobase::index_last(
error = index_read(buf, NULL, 0, HA_READ_BEFORE_KEY);
/* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */
/* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */
if (error == HA_ERR_KEY_NOT_FOUND) {
error = HA_ERR_END_OF_FILE;

View File

@ -83,14 +83,14 @@ class ha_innobase: public handler
HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_DROP_BEFORE_CREATE |
HA_NOT_READ_AFTER_KEY),
HA_NOT_READ_AFTER_KEY | HA_NO_PREFIX_CHAR_KEYS),
last_dup_key((uint) -1),
start_of_scan(0)
{
}
~ha_innobase() {}
const char* table_type() const { return("Innobase");}
const char* table_type() const { return("InnoDB");}
const char** bas_ext() const;
ulong option_flag() const { return int_option_flag; }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }

View File

@ -50,10 +50,12 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
{
THD* thd = (THD*)param->thd;
String* packet = &thd->packet;
packet->length(0);
uint length;
char msgbuf[MI_MAX_MSG_BUF];
msgbuf[0] = 0;
char name[NAME_LEN*2+2];
packet->length(0);
msgbuf[0] = 0; // healthy paranoia ?
my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia
@ -70,9 +72,12 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
return;
}
net_store_data(packet, param->table_name);
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
name);
net_store_data(packet, name, length);
net_store_data(packet, param->op_name);
net_store_data(packet, msg_type);
net_store_data(packet, msgbuf);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), thd->packet.length()))
fprintf(stderr,
@ -245,6 +250,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*)"check";
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag = check_opt->flags | T_CHECK | T_SILENT;
@ -332,6 +338,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*) "analyze";
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag=(T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
T_DONT_CHECK_CHECKSUM);
@ -384,6 +391,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*)"restore";
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag = 0;
mi_check_print_error(&param,errmsg, errno );
@ -438,6 +446,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*)"backup";
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.testflag = 0;
mi_check_print_error(&param,errmsg, errno );
@ -524,6 +533,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair");
param.db_name = table->table_cache_key;
param.table_name = table->table_name;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1;
@ -533,7 +543,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0)));
if (mi_lock_database(file,F_WRLCK))
// Don't lock tables if we have used LOCK TABLE
if (!thd->locked_tables && mi_lock_database(file,F_WRLCK))
{
mi_check_print_error(&param,ER(ER_CANT_LOCK),my_errno);
DBUG_RETURN(HA_ADMIN_FAILED);
@ -615,7 +626,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
update_state_info(&param, file, 0);
}
thd->proc_info=old_proc_info;
mi_lock_database(file,F_UNLCK);
if (!thd->locked_tables)
mi_lock_database(file,F_UNLCK);
DBUG_RETURN(error ? HA_ADMIN_FAILED :
!optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
}

View File

@ -73,6 +73,7 @@
#define HA_NOT_READ_AFTER_KEY (HA_DROP_BEFORE_CREATE*2)
#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2)
#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2)
/* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does a implicit HA_ABORT_IF_LOCKED */
@ -265,6 +266,7 @@ public:
virtual int extra(enum ha_extra_function operation)=0;
virtual int reset()=0;
virtual int external_lock(THD *thd, int lock_type)=0;
virtual int start_stmt(THD *thd) {return 0;}
virtual int delete_all_rows();
virtual longlong get_auto_increment();
virtual void update_create_info(HA_CREATE_INFO *create_info) {}
@ -344,6 +346,7 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
bool update_create_info);
int ha_delete_table(enum db_type db_type, const char *path);
void ha_key_cache(void);
int ha_start_stmt(THD *thd);
int ha_commit_trans(THD *thd, THD_TRANS *trans);
int ha_rollback_trans(THD *thd, THD_TRANS *trans);
int ha_autocommit_or_rollback(THD *thd, int error);

View File

@ -393,12 +393,14 @@ void Item_func_reverse::fix_length_and_dec()
String *Item_func_replace::val_str(String *str)
{
String *res,*res2,*res3;
int offset=0;
int offset;
uint from_length,to_length;
bool alloced=0;
#ifdef USE_MB
const char *ptr,*end,*strend,*search,*search_end;
register uint32 l;
bool binary_str = (args[0]->binary || args[1]->binary ||
!use_mb(default_charset_info));
#endif
null_value=0;
@ -415,7 +417,8 @@ String *Item_func_replace::val_str(String *str)
if ((offset=res->strstr(*res2)) < 0)
return res;
#else
if (!use_mb(default_charset_info) && (offset=res->strstr(*res2)) < 0)
offset=0;
if (binary_str && (offset=res->strstr(*res2)) < 0)
return res;
#endif
if (!(res3=args[2]->val_str(&tmp_value2)))
@ -424,7 +427,7 @@ String *Item_func_replace::val_str(String *str)
to_length= res3->length();
#ifdef USE_MB
if (use_mb(default_charset_info))
if (!binary_str)
{
search=res2->ptr();
search_end=search+from_length;
@ -449,6 +452,7 @@ redo:
res=copy_if_not_alloced(str,res,res->length()+to_length);
}
res->replace((uint) offset,from_length,*res3);
offset+=(int) to_length;
goto redo;
}
skipp:

View File

@ -89,6 +89,7 @@ static SYMBOL symbols[] = {
{ "COMMIT", SYM(COMMIT_SYM),0,0},
{ "COMMITTED", SYM(COMMITTED_SYM),0,0},
{ "COMPRESSED", SYM(COMPRESSED_SYM),0,0},
{ "CONCURRENT", SYM(CONCURRENT),0,0},
{ "CONSTRAINT", SYM(CONSTRAINT),0,0},
{ "CREATE", SYM(CREATE),0,0},
{ "CROSS", SYM(CROSS),0,0},

Some files were not shown because too many files have changed in this diff Show More