summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /storage/myisam
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/Makefile.am169
-rw-r--r--storage/myisam/ft_boolean_search.c2
-rw-r--r--storage/myisam/ft_stopwords.c4
-rwxr-xr-xstorage/myisam/ftbench/Ecompare.pl15
-rwxr-xr-xstorage/myisam/ftbench/Ecreate.pl15
-rwxr-xr-xstorage/myisam/ftbench/Ereport.pl15
-rwxr-xr-xstorage/myisam/ftbench/ft-test-run.sh17
-rw-r--r--storage/myisam/ha_myisam.cc35
-rw-r--r--storage/myisam/ha_myisam.h3
-rw-r--r--storage/myisam/mi_check.c11
-rw-r--r--storage/myisam/mi_close.c2
-rw-r--r--storage/myisam/mi_create.c2
-rw-r--r--storage/myisam/mi_delete.c3
-rw-r--r--storage/myisam/mi_delete_all.c2
-rw-r--r--storage/myisam/mi_dynrec.c5
-rw-r--r--storage/myisam/mi_log.c4
-rw-r--r--storage/myisam/mi_open.c6
-rw-r--r--storage/myisam/mi_static.c2
-rw-r--r--storage/myisam/mi_statrec.c3
-rwxr-xr-xstorage/myisam/mi_test_all.sh18
-rw-r--r--storage/myisam/mi_update.c11
-rw-r--r--storage/myisam/mi_write.c6
-rw-r--r--storage/myisam/myisamchk.c8
-rw-r--r--storage/myisam/myisamdef.h14
-rw-r--r--storage/myisam/myisampack.c2
-rw-r--r--storage/myisam/plug.in7
-rw-r--r--storage/myisam/rt_index.c2
-rw-r--r--storage/myisam/sort.c2
28 files changed, 129 insertions, 256 deletions
diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am
deleted file mode 100644
index 5d8a5e9753b..00000000000
--- a/storage/myisam/Makefile.am
+++ /dev/null
@@ -1,169 +0,0 @@
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-MYSQLDATAdir = $(localstatedir)
-MYSQLSHAREdir = $(pkgdatadir)
-MYSQLBASEdir= $(prefix)
-MYSQLLIBdir= $(pkglibdir)
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
- -I$(top_srcdir)/regex \
- -I$(top_srcdir)/sql \
- -I$(srcdir)
-WRAPLIBS=
-
-LDADD =
-
-DEFS = @DEFS@
-
-EXTRA_DIST = mi_test_all.sh mi_test_all.res CMakeLists.txt plug.in
-pkgdata_DATA =
-
-pkglib_LIBRARIES = libmyisam.a
-bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
-myisamchk_DEPENDENCIES= $(LIBRARIES)
-myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisamlog_DEPENDENCIES= $(LIBRARIES)
-myisamlog_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisampack_DEPENDENCIES=$(LIBRARIES)
-myisampack_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-noinst_PROGRAMS = mi_test1 mi_test2 mi_test3 rt_test sp_test
-noinst_HEADERS = myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h \
- fulltext.h ftdefs.h ha_myisam.h mi_extrafunc.h
-mi_test1_DEPENDENCIES= $(LIBRARIES)
-mi_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-mi_test2_DEPENDENCIES= $(LIBRARIES)
-mi_test2_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-mi_test3_DEPENDENCIES= $(LIBRARIES)
-mi_test3_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-myisam_ftdump_DEPENDENCIES= $(LIBRARIES)
-myisam_ftdump_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-rt_test_DEPENDENCIES= $(LIBRARIES)
-rt_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-sp_test_DEPENDENCIES= $(LIBRARIES)
-sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
-libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \
- mi_rnext.c mi_rnext_same.c \
- mi_search.c mi_page.c mi_key.c mi_locking.c \
- mi_rrnd.c mi_scan.c mi_cache.c \
- mi_statrec.c mi_packrec.c mi_dynrec.c \
- mi_update.c mi_write.c mi_unique.c \
- mi_delete.c \
- mi_rprev.c mi_rfirst.c mi_rlast.c mi_rsame.c \
- mi_rsamepos.c mi_panic.c mi_close.c mi_create.c\
- mi_range.c mi_dbug.c mi_checksum.c mi_log.c \
- mi_changed.c mi_static.c mi_delete_all.c \
- mi_delete_table.c mi_rename.c mi_check.c \
- mi_keycache.c mi_preload.c \
- ft_parser.c ft_stopwords.c ft_static.c \
- ft_update.c ft_boolean_search.c ft_nlq_search.c \
- sort.c ha_myisam.cc ft_myisam.c \
- rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c
-CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY?
-
-# Move to automake rules ?
-prolint:; plparse -b -u -hF1 "-width(0,0)" "-format=%f:%l:\s%t:%n\s%m" \
- "-elib(????)" "+elib(?3??)" my.lnt $(nisam_SOURCES)
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''CC''@!@CC@!'\
- -e 's!@''CXX''@!@CXX@!'\
- -e 's!@''GXX''@!@GXX@!'\
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
- -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
- -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
- -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
- -e 's!@''HOSTNAME''@!@HOSTNAME@!' \
- -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \
- -e 's!@''CHECK_PID''@!@CHECK_PID@!' \
- -e 's!@''FIND_PROC''@!@FIND_PROC@!' \
- -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
- -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- -e 's!@''sysconfdir''@!@sysconfdir@!' \
- -e 's!@''SHORT_MYSQL_INTRO''@!@SHORT_MYSQL_INTRO@!' \
- -e 's!@''SHARED_LIB_VERSION''@!@SHARED_LIB_VERSION@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''PERL_DBI_VERSION''@!@PERL_DBI_VERSION@!' \
- -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \
- -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
-if HAVE_DTRACE_DASH_G
-libmyisam_a_LIBADD = probes_mysql.o
-libmyisam_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
-CLEANFILES += probes_mysql.o dtrace_files dtrace_providers
-DTRACEFILES = ha_myisam.o
-DTRACEPROVIDER = probes_mysql.d
-CLEANFILES += $(DTRACEPROVIDER) dtrace_sources
-
-dtrace_files:
- echo $(DTRACEFILES) > $@
-dtrace_providers: probes_mysql.d
- echo $(DTRACEPROVIDER) > $@
-probes_mysql.d:
- -$(RM) -f probes_mysql.d
- $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d
- echo timestamp > dtrace_sources
-
-probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
- $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
-endif
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index bf0af370838..650eb160866 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -92,8 +92,6 @@ static double *nwghts=_nwghts+5; /* nwghts[i] = -0.5*1.5**i */
#define FTB_FLAG_NO 4
#define FTB_FLAG_WONLY 8
-#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
-
typedef struct st_ftb_expr FTB_EXPR;
struct st_ftb_expr
{
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index b0911403996..9eb8b68bf13 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2005 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -16,7 +16,7 @@
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
#include "ftdefs.h"
-#include "my_handler.h"
+#include "my_compare.h"
static CHARSET_INFO *ft_stopword_cs= NULL;
diff --git a/storage/myisam/ftbench/Ecompare.pl b/storage/myisam/ftbench/Ecompare.pl
index 265534e704d..2c50ae9b9ce 100755
--- a/storage/myisam/ftbench/Ecompare.pl
+++ b/storage/myisam/ftbench/Ecompare.pl
@@ -1,5 +1,20 @@
#!/usr/bin/perl
+# Copyright (C) 2003 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
# compares out-files (as created by Ereport.pl) from dir1/*.out and dir2/*.out
# for each effectiveness column computes the probability of the hypothesis
# "Both files have the same effectiveness"
diff --git a/storage/myisam/ftbench/Ecreate.pl b/storage/myisam/ftbench/Ecreate.pl
index d90a6f7a0ad..123ca729c31 100755
--- a/storage/myisam/ftbench/Ecreate.pl
+++ b/storage/myisam/ftbench/Ecreate.pl
@@ -1,5 +1,20 @@
#!/usr/bin/perl
+# Copyright (C) 2003 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
$test=shift || die "Usage $0 testname [option]";
$option=shift;
diff --git a/storage/myisam/ftbench/Ereport.pl b/storage/myisam/ftbench/Ereport.pl
index 5969304da09..2f63d7ea37a 100755
--- a/storage/myisam/ftbench/Ereport.pl
+++ b/storage/myisam/ftbench/Ereport.pl
@@ -1,5 +1,20 @@
#!/usr/bin/perl
+# Copyright (C) 2003 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
die "Use: $0 eval_output qrels_file\n" unless @ARGV==2;
open(EOUT,$eout=shift) || die "Cannot open $eout: $!";
diff --git a/storage/myisam/ftbench/ft-test-run.sh b/storage/myisam/ftbench/ft-test-run.sh
index 0908e55b400..8726c263de9 100755
--- a/storage/myisam/ftbench/ft-test-run.sh
+++ b/storage/myisam/ftbench/ft-test-run.sh
@@ -1,5 +1,22 @@
#!/bin/sh
+# Copyright (C) 2003 MySQL AB
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+
if [ ! -x ./ft-test-run.sh ] ; then
echo "Usage: ./ft-test-run.sh"
exit 1
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 2913cdc421d..3121deb66e4 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -168,10 +168,9 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
Also we likely need to lock mutex here (in both cases with protocol and
push_warning).
*/
-#ifdef THREAD
if (param->need_print_msg_lock)
mysql_mutex_lock(&param->print_msg_mutex);
-#endif
+
protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info);
protocol->store(param->op_name, system_charset_info);
@@ -180,10 +179,10 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
if (protocol->write())
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
msgbuf);
-#ifdef THREAD
+
if (param->need_print_msg_lock)
mysql_mutex_unlock(&param->print_msg_mutex);
-#endif
+
return;
}
@@ -640,13 +639,14 @@ ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg)
HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS |
HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS |
- HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT),
+ HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT | HA_CAN_REPAIR),
can_enable_indexes(1)
{}
-handler *ha_myisam::clone(MEM_ROOT *mem_root)
+handler *ha_myisam::clone(const char *name, MEM_ROOT *mem_root)
{
- ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(mem_root));
+ ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(name,
+ mem_root));
if (new_handler)
new_handler->file->state= file->state;
return new_handler;
@@ -1530,8 +1530,6 @@ bool ha_myisam::check_and_repair(THD *thd)
{
int error=0;
int marked_crashed;
- char *old_query;
- uint old_query_length;
HA_CHECK_OPT check_opt;
DBUG_ENTER("ha_myisam::check_and_repair");
@@ -1542,10 +1540,9 @@ bool ha_myisam::check_and_repair(THD *thd)
check_opt.flags|=T_QUICK;
sql_print_warning("Checking table: '%s'",table->s->path.str);
- old_query= thd->query();
- old_query_length= thd->query_length();
+ const CSET_STRING query_backup= thd->query_string;
thd->set_query(table->s->table_name.str,
- (uint) table->s->table_name.length);
+ (uint) table->s->table_name.length, system_charset_info);
if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
{
@@ -1558,7 +1555,7 @@ bool ha_myisam::check_and_repair(THD *thd)
if (repair(thd, &check_opt))
error=1;
}
- thd->set_query(old_query, old_query_length);
+ thd->set_query(query_backup);
DBUG_RETURN(error);
}
@@ -1848,6 +1845,18 @@ int ha_myisam::delete_all_rows()
return mi_delete_all_rows(file);
}
+
+/*
+ Intended to support partitioning.
+ Allows a particular partition to be truncated.
+*/
+
+int ha_myisam::truncate()
+{
+ int error= delete_all_rows();
+ return error ? error : reset_auto_increment(0);
+}
+
int ha_myisam::reset_auto_increment(ulonglong value)
{
file->s->state.auto_increment= value;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 61585013678..b5415bb0dc7 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -55,7 +55,7 @@ class ha_myisam: public handler
public:
ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
~ha_myisam() {}
- handler *clone(MEM_ROOT *mem_root);
+ handler *clone(const char *name, MEM_ROOT *mem_root);
const char *table_type() const { return "MyISAM"; }
const char *index_type(uint key_number);
const char **bas_ext() const;
@@ -116,6 +116,7 @@ class ha_myisam: public handler
int reset(void);
int external_lock(THD *thd, int lock_type);
int delete_all_rows(void);
+ int truncate();
int reset_auto_increment(ulonglong value);
int disable_indexes(uint mode);
int enable_indexes(uint mode);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index a69ed41f67d..daae02e6846 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -79,7 +79,8 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param);
static SORT_KEY_BLOCKS *alloc_key_blocks(HA_CHECK *param, uint blocks,
uint buffer_length);
static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
-static void set_data_file_type(MI_SORT_INFO *sort_info, MYISAM_SHARE *share);
+static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share);
+static HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
void myisamchk_init(HA_CHECK *param)
{
@@ -98,6 +99,7 @@ void myisamchk_init(HA_CHECK *param)
param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
+ param->need_print_msg_lock= 0;
}
/* Check the status flags for the table */
@@ -1748,6 +1750,8 @@ err:
MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) ||
mi_open_datafile(info,share,name,-1))
got_error=1;
+
+ param->retry_repair= 0;
}
}
if (got_error)
@@ -2633,9 +2637,6 @@ err:
int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick)
{
-#ifndef THREAD
- return mi_repair_by_sort(param, info, name, rep_quick);
-#else
int got_error;
uint i,key, total_key_length, istep;
ulong rec_length;
@@ -3125,7 +3126,6 @@ err:
share->pack.header_length=0;
}
DBUG_RETURN(got_error);
-#endif /* THREAD */
}
/* Read next record and return next key */
@@ -4747,3 +4747,4 @@ set_data_file_type(MI_SORT_INFO *sort_info, MYISAM_SHARE *share)
share->delete_record=tmp.delete_record;
}
}
+
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index fd10ef47968..660863d4f7c 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -94,7 +94,6 @@ int mi_close(register MI_INFO *info)
my_free(share->decode_trees);
my_free(share->decode_tables);
}
-#ifdef THREAD
thr_lock_delete(&share->lock);
mysql_mutex_destroy(&share->intern_lock);
{
@@ -105,7 +104,6 @@ int mi_close(register MI_INFO *info)
mysql_rwlock_destroy(&share->key_root_lock[i]);
}
}
-#endif
my_free(info->s);
}
mysql_mutex_unlock(&THR_LOCK_myisam);
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 7222542847d..3ec429535d4 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -829,8 +829,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
err:
mysql_mutex_unlock(&THR_LOCK_myisam);
-err_no_lock:
+err_no_lock:
save_errno=my_errno;
switch (errpos) {
case 3:
diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c
index 0817d9926ca..6d2ca5b1f8d 100644
--- a/storage/myisam/mi_delete.c
+++ b/storage/myisam/mi_delete.c
@@ -102,7 +102,7 @@ int mi_delete(MI_INFO *info,const uchar *record)
mi_sizestore(lastpos,info->lastpos);
myisam_log_command(MI_LOG_DELETE,info,(uchar*) lastpos,sizeof(lastpos),0);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
- allow_break(); /* Allow SIGHUP & SIGINT */
+
if (info->invalidator != 0)
{
DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename));
@@ -122,7 +122,6 @@ err:
}
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
- allow_break(); /* Allow SIGHUP & SIGINT */
my_errno=save_errno;
if (save_errno == HA_ERR_KEY_NOT_FOUND)
{
diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c
index 5940b927d9a..a21a2a3093a 100644
--- a/storage/myisam/mi_delete_all.c
+++ b/storage/myisam/mi_delete_all.c
@@ -67,7 +67,6 @@ int mi_delete_all_rows(MI_INFO *info)
if (share->file_map)
mi_dynmap_file(info, (my_off_t) 0);
#endif
- allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
err:
@@ -75,7 +74,6 @@ err:
int save_errno=my_errno;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
- allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno);
}
} /* mi_delete */
diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c
index 70a59a11346..aeb81d4e09c 100644
--- a/storage/myisam/mi_dynrec.c
+++ b/storage/myisam/mi_dynrec.c
@@ -39,13 +39,11 @@ static int delete_dynamic_record(MI_INFO *info,my_off_t filepos,
static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
uint length);
-#ifdef THREAD
/* Play it safe; We have a small stack when using threads */
#undef my_alloca
#undef my_afree
#define my_alloca(A) my_malloc((A),MYF(0))
#define my_afree(A) my_free((A))
-#endif
/* Interface function from MI_INFO */
@@ -1579,9 +1577,6 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const uchar *record)
MI_BLOCK_INFO block_info;
DBUG_ENTER("_mi_cmp_dynamic_record");
- /* We are going to do changes; dont let anybody disturb */
- dont_break(); /* Dont allow SIGHUP or SIGINT */
-
if (info->opt_flag & WRITE_CACHE_USED)
{
info->update&= ~(HA_STATE_WRITE_AT_END | HA_STATE_EXTEND_BLOCK);
diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c
index e0c66bef996..ac3aa7c149b 100644
--- a/storage/myisam/mi_log.c
+++ b/storage/myisam/mi_log.c
@@ -24,11 +24,7 @@
#endif
#undef GETPID /* For HPUX */
-#ifdef THREAD
#define GETPID() (log_type == 1 ? (long) myisam_pid : (long) my_thread_dbug_id())
-#else
-#define GETPID() myisam_pid
-#endif
/* Activate logging if flag is 1 and reset logging if flag is 0 */
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index abc731aead6..3c52016a1ba 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -291,9 +291,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
&share->state.key_root,keys*sizeof(my_off_t),
&share->state.key_del,
(share->state.header.max_block_size_index*sizeof(my_off_t)),
-#ifdef THREAD
&share->key_root_lock, sizeof(mysql_rwlock_t)*keys,
-#endif
&share->mmap_lock, sizeof(mysql_rwlock_t),
NullS))
goto err;
@@ -510,7 +508,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
my_afree(disk_cache);
mi_setup_functions(share);
share->is_log_table= FALSE;
-#ifdef THREAD
thr_lock_init(&share->lock);
mysql_mutex_init(mi_key_mutex_MYISAM_SHARE_intern_lock,
&share->intern_lock, MY_MUTEX_INIT_FAST);
@@ -541,7 +538,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->lock.fix_status= (void (*)(void *, void *)) mi_fix_status;
}
}
-#endif
/*
Memory mapping can only be requested after initializing intern_lock.
*/
@@ -639,9 +635,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
bzero(info.rec_buff, mi_get_rec_buff_len(&info, info.rec_buff));
*m_info=info;
-#ifdef THREAD
thr_lock_data_init(&share->lock,&m_info->lock,(void*) m_info);
-#endif
m_info->open_list.data=(void*) m_info;
myisam_open_list=list_add(myisam_open_list,&m_info->open_list);
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 55967fc9001..711287ca16f 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -32,7 +32,7 @@ File myisam_log_file= -1;
uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
-#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
+#if !defined(DONT_USE_RW_LOCKS)
ulong myisam_concurrent_insert= 2;
#else
ulong myisam_concurrent_insert= 0;
diff --git a/storage/myisam/mi_statrec.c b/storage/myisam/mi_statrec.c
index f83afa3c886..bf791726aa9 100644
--- a/storage/myisam/mi_statrec.c
+++ b/storage/myisam/mi_statrec.c
@@ -114,9 +114,6 @@ int _mi_cmp_static_record(register MI_INFO *info, register const uchar *old)
{
DBUG_ENTER("_mi_cmp_static_record");
- /* We are going to do changes; dont let anybody disturb */
- dont_break(); /* Dont allow SIGHUP or SIGINT */
-
if (info->opt_flag & WRITE_CACHE_USED)
{
if (flush_io_cache(&info->rec_cache))
diff --git a/storage/myisam/mi_test_all.sh b/storage/myisam/mi_test_all.sh
index c6bc686e885..641f1cc0a35 100755
--- a/storage/myisam/mi_test_all.sh
+++ b/storage/myisam/mi_test_all.sh
@@ -1,4 +1,22 @@
#!/bin/sh
+
+# Copyright (C) 2000, 2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+
#
# Execute some simple basic test on MyISAM libary to check if things
# works at all.
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index 6d4150e5b79..2104e4c4117 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -179,7 +179,6 @@ int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec)
there is no index change there could be data change.
*/
(void) _mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
- allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename));
@@ -193,8 +192,8 @@ err:
save_errno=my_errno;
if (changed)
key_changed|= HA_STATE_CHANGED;
- if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM ||
- my_errno == HA_ERR_RECORD_FILE_FULL)
+ if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
+ my_errno == HA_ERR_NULL_IN_SPATIAL || my_errno == HA_ERR_OUT_OF_MEM)
{
info->errkey= (int) i;
flag=0;
@@ -212,8 +211,9 @@ err:
{
uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
uint old_length= _mi_make_key(info,i,old_key,oldrec,pos);
- if ((flag++ && _mi_ck_delete(info,i,new_key,new_length)) ||
- _mi_ck_write(info,i,old_key,old_length))
+ if ((flag++ &&
+ share->keyinfo[i].ck_delete(info, i, new_key, new_length)) ||
+ share->keyinfo[i].ck_insert(info, i, old_key, old_length))
break;
}
}
@@ -230,7 +230,6 @@ err:
err_end:
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,my_errno);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
- allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND)
{
mi_print_error(info->s, HA_ERR_CRASHED);
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 7b40a11f7c6..1c9a25f8e86 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -60,7 +60,7 @@ int mi_write(MI_INFO *info, uchar *record)
}
if (_mi_readinfo(info,F_WRLCK,1))
DBUG_RETURN(my_errno);
- dont_break(); /* Dont allow SIGHUP or SIGINT */
+
filepos= ((share->state.dellink != HA_OFFSET_ERROR &&
!info->append_insert_at_end) ?
share->state.dellink :
@@ -169,7 +169,6 @@ int mi_write(MI_INFO *info, uchar *record)
if (share->is_log_table)
mi_update_status((void*) info);
- allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
err:
@@ -205,7 +204,7 @@ err:
else
{
uint key_length=_mi_make_key(info,i,buff,record,filepos);
- if (_mi_ck_delete(info,i,buff,key_length))
+ if (share->keyinfo[i].ck_delete(info, i, buff, key_length))
{
if (local_lock_tree)
mysql_rwlock_unlock(&share->key_root_lock[i]);
@@ -228,7 +227,6 @@ err2:
save_errno=my_errno;
myisam_log_record(MI_LOG_WRITE,info,record,filepos,my_errno);
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
- allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno);
} /* mi_write */
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 70406203f63..e932234a998 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -670,10 +670,10 @@ get_one_option(int optid,
case OPT_STATS_METHOD:
{
int method;
- enum_handler_stats_method method_conv;
- LINT_INIT(method_conv);
+ enum_mi_stats_method UNINIT_VAR(method_conv);
myisam_stats_method_str= argument;
- if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
+ if ((method= find_type(argument, &myisam_stats_method_typelib,
+ FIND_TYPE_BASIC)) <= 0)
{
fprintf(stderr, "Invalid value of stats_method: %s.\n", argument);
exit(1);
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 894ec827b85..3f82d96b88b 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -18,12 +18,8 @@
#include "myisam.h" /* Structs & some defines */
#include "myisampack.h" /* packing of keys */
#include <my_tree.h>
-#ifdef THREAD
#include <my_pthread.h>
#include <thr_lock.h>
-#else
-#include <my_no_pthread.h>
-#endif
#include <mysql/psi/mysql_file.h>
/* undef map from my_nosys; We need test-if-disk full */
@@ -220,11 +216,9 @@ typedef struct st_mi_isam_share
global_changed, /* If changed since open */
not_flushed, temporary, delay_key_write, concurrent_insert;
my_bool deleting; /* we are going to delete this table */
-#ifdef THREAD
THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */
mysql_rwlock_t *key_root_lock;
-#endif
my_off_t mmaped_length;
uint nonmmaped_inserts; /* counter of writing in non-mmaped
area */
@@ -304,9 +298,7 @@ struct st_myisam_info
my_bool buff_used;
index_cond_func_t index_cond_func; /* Index condition function */
void *index_cond_func_arg; /* parameter for the func */
-#ifdef THREAD
THR_LOCK_DATA lock;
-#endif
uchar *rtree_recursion_state; /* For RTREE */
int rtree_recursion_depth;
};
@@ -415,10 +407,8 @@ struct st_myisam_info
#define MI_UNIQUE_HASH_TYPE HA_KEYTYPE_ULONG_INT
#define mi_unique_store(A,B) mi_int4store((A),(B))
-#ifdef THREAD
extern mysql_mutex_t THR_LOCK_myisam;
-#endif
-#if !defined(THREAD) || defined(DONT_USE_RW_LOCKS)
+#ifdef DONT_USE_RW_LOCKS
#define mysql_rwlock_wrlock(A) {}
#define mysql_rwlock_rdlock(A) {}
#define mysql_rwlock_unlock(A) {}
@@ -730,9 +720,7 @@ int killed_ptr(HA_CHECK *param);
void mi_check_print_error(HA_CHECK *param, const char *fmt, ...);
void mi_check_print_warning(HA_CHECK *param, const char *fmt, ...);
void mi_check_print_info(HA_CHECK *param, const char *fmt, ...);
-#ifdef THREAD
pthread_handler_t thr_find_all_keys(void *arg);
-#endif
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func,
void *func_arg);
int flush_blocks(HA_CHECK *param, KEY_CACHE *key_cache, File file,
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 017f7d160b6..b48e95f1171 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB
+/* Copyright (C) 2000-2007 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in
deleted file mode 100644
index e92b5e56d7f..00000000000
--- a/storage/myisam/plug.in
+++ /dev/null
@@ -1,7 +0,0 @@
-dnl MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine],
-dnl [Traditional non-transactional MySQL tables])
-dnl MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam])
-dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a])
-dnl MYSQL_PLUGIN_MANDATORY(myisam) dnl Default
-dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc])
-
diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c
index 48eb48cc5e8..888d3c7e56a 100644
--- a/storage/myisam/rt_index.c
+++ b/storage/myisam/rt_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006 MySQL AB & Ramil Kalimullin
+/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
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
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 903a893e779..eb462d8c23e 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -302,7 +302,6 @@ static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys,
} /* find_all_keys */
-#ifdef THREAD
/* Search after all keys and place them in a temp. file */
pthread_handler_t thr_find_all_keys(void *arg)
@@ -637,7 +636,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
my_free(mergebuf);
DBUG_RETURN(got_error);
}
-#endif /* THREAD */
/* Write all keys in memory to file for later merge */