Commit d2b8d744 authored by unknown's avatar unknown

Added storage/maria (based on MyISAM). WL#3245

Moved things into ft_global.h, my_handler.h and myisamchk.h to allow MyISAM and Maria to share code and defines
Rename of not properly renamed functions in MyISAM and my_handler.c
Renamed some MI_ defines to HA_ to allow MyISAM and Maria to share
Added maria variables to mysqld.cc and set_var.cc
Fixed compiler warnings



BitKeeper/etc/ignore:
  added storage/maria/*.MAI
BUILD/SETUP.sh:
  Compile maria by default
BitKeeper/triggers/post-commit:
  No public maria emails.
  Mark changesets emails with 'maria'
configure.in:
  Add maria
include/ft_global.h:
  Move defines needed by maria and MyISAM here
include/keycache.h:
  Add support for default key_cache if cache not found
include/my_base.h:
  Add invalidator_by_filename
include/my_handler.h:
  Remove duplicate header files
  Add defines that are typical for handlers (MyISAM and Maria)
include/myisam.h:
  Move things to my_handler.h to allow Maria and MyISAM to share things
  (Some things needed to be shared to allow sharing of HA_CHECK structure)
libmysqld/Makefile.am:
  Added ha_maria.cc
mysys/mf_keycaches.c:
  Added default value for multi_key_cache_search
mysys/my_handler.c:
  mi_compare_text -> ha_compare_text
  Removed compiler warnings
sql/ha_myisam.cc:
  MI_CHECK -> HA_CHECK
  MI_MAX_KEY_LENGTH -> HA_MAX_KEY_LENGTH
sql/ha_myisam.h:
  MI_CHECK -> HA_CHECK
  MI_MAX_KEY_LENGTH -> HA_MAX_KEY_LENGTH
sql/ha_myisammrg.h:
  MI_CHECK -> HA_CHECK
  MI_MAX_KEY_LENGTH -> HA_MAX_KEY_LENGTH
sql/handler.h:
  Added MARIA
  Added inclusion of my_handler.h
sql/item_func.h:
  Remove duplicate include
sql/mysql_priv.h:
  Added maria variables
sql/mysqld.cc:
  Added maria
sql/set_var.cc:
  Added maria status variables
sql/set_var.h:
  Added maria
sql/sql_class.h:
  Added maria status variables
sql/sql_sort.h:
  Remove duplicate BUFFPEK struct
storage/Makefile.am:
  Added maria
storage/csv/ha_tina.cc:
  Removed compiler warning
storage/myisam/Makefile.am:
  Added ft_myisam.c
storage/myisam/ft_boolean_search.c:
  mi_compare_text -> ha_compare_text
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
  Remove compiler warnings
storage/myisam/ft_nlq_search.c:
  mi_compare_text -> ha_compare_text
storage/myisam/ft_parser.c:
  mi_compare_text -> ha_compare_text
storage/myisam/ft_static.c:
  Move ft_init_search() to ft_myisam.c to make ft_static.c independent of MyISAM
storage/myisam/ft_stopwords.c:
  mi_compare_text -> ha_compare_text
storage/myisam/ft_update.c:
  mi_compare_text -> ha_compare_text
storage/myisam/fulltext.h:
  Move things to ft_global.h to allow to share more things between MyISAM and Maria
storage/myisam/mi_check.c:
  MI_CHECK -> HA_CHECK
storage/myisam/mi_create.c:
  MI_MAX_POSSIBLE_KEY ->   HA_MAX_POSSIBLE_KEY
  MI_MAX_KEY_BLOCK_SIZE -> HA_MAX_KEY_BLOCK_SIZE
  MI_MAX_KEY_SEG ->  HA_MAX_KEY_SEG
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
storage/myisam/mi_delete.c:
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
storage/myisam/mi_delete_all.c:
  Remove not used variable
storage/myisam/mi_dynrec.c:
  _my_calc_total_blob_length -> _mi_calc_total_blob_length
storage/myisam/mi_key.c:
  _my_store_blob_length -> _mi_store_blob_length
storage/myisam/mi_log.c:
  _my_calc_total_blob_length -> _mi_calc_total_blob_length
storage/myisam/mi_open.c:
  MI_MAX_POSSIBLE_KEY -> HA_MAX_POSSIBLE_KEY
  MI_MAX_KEY_SEG ->      HA_MAX_KEY_SEG
  MI_MAX_KEY_BUFF ->     HA_MAX_KEY_BUFF
  my_n_base_info_read -> mi_n_base_info_read
storage/myisam/mi_packrec.c:
  Made read_pack_length static
  _my_store_blob_length -> _mi_store_blob_length
  Remove not used variable
storage/myisam/mi_range.c:
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
storage/myisam/mi_search.c:
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
storage/myisam/mi_test1.c:
  MI_MAX_KEY_LENGTH -> HA_MAX_KEY_LENGTH
storage/myisam/mi_test2.c:
  Fixed compiler warning
storage/myisam/mi_unique.c:
  Fixed compiler warning
  mi_compare_text -> ha_compare_text
storage/myisam/mi_update.c:
  MI_MAX_KEY_BUFF -> HA_MAX_KEY_BUFF
storage/myisam/mi_write.c:
  Rename of defines and functions
storage/myisam/myisamchk.c:
  Rename of defines and functions
storage/myisam/myisamdef.h:
  Remove tabs
  Indentation fixes (Large changes as I did run indent-ex on the file)
  Move some things to myisamchk.h
  Added missing functions that gave compiler warnings
storage/myisam/myisamlog.c:
  Rename of defines and functions
storage/myisam/myisampack.c:
  Remove compiler warning
storage/myisam/rt_index.c:
  Rename of defines and functions
storage/myisam/sort.c:
  Rename of defines, functions and structures
config/ac-macros/ha_maria.m4:
  New BitKeeper file ``config/ac-macros/ha_maria.m4''
include/maria.h:
  New BitKeeper file ``include/maria.h''
include/myisamchk.h:
  New BitKeeper file ``include/myisamchk.h''
libmysqld/ha_maria.cc:
  New BitKeeper file ``libmysqld/ha_maria.cc''
mysql-test/include/have_maria.inc:
  New BitKeeper file ``mysql-test/include/have_maria.inc''
mysql-test/r/have_maria.require:
  New BitKeeper file ``mysql-test/r/have_maria.require''
mysql-test/r/maria.result:
  New BitKeeper file ``mysql-test/r/maria.result''
mysql-test/r/ps_maria.result:
  New BitKeeper file ``mysql-test/r/ps_maria.result''
mysql-test/t/maria.test:
  New BitKeeper file ``mysql-test/t/maria.test''
mysql-test/t/ps_maria.test:
  New BitKeeper file ``mysql-test/t/ps_maria.test''
sql/ha_maria.cc:
  New BitKeeper file ``sql/ha_maria.cc''
sql/ha_maria.h:
  New BitKeeper file ``sql/ha_maria.h''
storage/maria/Makefile.am:
  New BitKeeper file ``storage/maria/Makefile.am''
storage/maria/cmakelists.txt:
  New BitKeeper file ``storage/maria/cmakelists.txt''
storage/maria/ft_maria.c:
  New BitKeeper file ``storage/maria/ft_maria.c''
storage/maria/ma_cache.c:
  New BitKeeper file ``storage/maria/ma_cache.c''
storage/maria/ma_changed.c:
  New BitKeeper file ``storage/maria/ma_changed.c''
storage/maria/ma_check.c:
  New BitKeeper file ``storage/maria/ma_check.c''
storage/maria/ma_checksum.c:
  New BitKeeper file ``storage/maria/ma_checksum.c''
storage/maria/ma_close.c:
  New BitKeeper file ``storage/maria/ma_close.c''
storage/maria/ma_create.c:
  New BitKeeper file ``storage/maria/ma_create.c''
storage/maria/ma_dbug.c:
  New BitKeeper file ``storage/maria/ma_dbug.c''
storage/maria/ma_delete.c:
  New BitKeeper file ``storage/maria/ma_delete.c''
storage/maria/ma_delete_all.c:
  New BitKeeper file ``storage/maria/ma_delete_all.c''
storage/maria/ma_delete_table.c:
  New BitKeeper file ``storage/maria/ma_delete_table.c''
storage/maria/ma_dynrec.c:
  New BitKeeper file ``storage/maria/ma_dynrec.c''
storage/maria/ma_extra.c:
  New BitKeeper file ``storage/maria/ma_extra.c''
storage/maria/ma_ft_boolean_search.c:
  New BitKeeper file ``storage/maria/ma_ft_boolean_search.c''
storage/maria/ma_ft_eval.c:
  New BitKeeper file ``storage/maria/ma_ft_eval.c''
storage/maria/ma_ft_eval.h:
  New BitKeeper file ``storage/maria/ma_ft_eval.h''
storage/maria/ma_ft_nlq_search.c:
  New BitKeeper file ``storage/maria/ma_ft_nlq_search.c''
storage/maria/ma_ft_parser.c:
  New BitKeeper file ``storage/maria/ma_ft_parser.c''
storage/maria/ma_ft_stem.c:
  New BitKeeper file ``storage/maria/ma_ft_stem.c''
storage/maria/ma_ft_test1.c:
  New BitKeeper file ``storage/maria/ma_ft_test1.c''
storage/maria/ma_ft_test1.h:
  New BitKeeper file ``storage/maria/ma_ft_test1.h''
storage/maria/ma_ft_update.c:
  New BitKeeper file ``storage/maria/ma_ft_update.c''
storage/maria/ma_ftdefs.h:
  New BitKeeper file ``storage/maria/ma_ftdefs.h''
storage/maria/ma_fulltext.h:
  New BitKeeper file ``storage/maria/ma_fulltext.h''
storage/maria/ma_info.c:
  New BitKeeper file ``storage/maria/ma_info.c''
storage/maria/ma_init.c:
  New BitKeeper file ``storage/maria/ma_init.c''
storage/maria/ma_key.c:
  New BitKeeper file ``storage/maria/ma_key.c''
storage/maria/ma_keycache.c:
  New BitKeeper file ``storage/maria/ma_keycache.c''
storage/maria/ma_locking.c:
  New BitKeeper file ``storage/maria/ma_locking.c''
storage/maria/ma_log.c:
  New BitKeeper file ``storage/maria/ma_log.c''
storage/maria/ma_open.c:
  New BitKeeper file ``storage/maria/ma_open.c''
storage/maria/ma_packrec.c:
  New BitKeeper file ``storage/maria/ma_packrec.c''
storage/maria/ma_page.c:
  New BitKeeper file ``storage/maria/ma_page.c''
storage/maria/ma_panic.c:
  New BitKeeper file ``storage/maria/ma_panic.c''
storage/maria/ma_preload.c:
  New BitKeeper file ``storage/maria/ma_preload.c''
storage/maria/ma_range.c:
  New BitKeeper file ``storage/maria/ma_range.c''
storage/maria/ma_rename.c:
  New BitKeeper file ``storage/maria/ma_rename.c''
storage/maria/ma_rfirst.c:
  New BitKeeper file ``storage/maria/ma_rfirst.c''
storage/maria/ma_rkey.c:
  New BitKeeper file ``storage/maria/ma_rkey.c''
storage/maria/ma_rlast.c:
  New BitKeeper file ``storage/maria/ma_rlast.c''
storage/maria/ma_rnext.c:
  New BitKeeper file ``storage/maria/ma_rnext.c''
storage/maria/ma_rnext_same.c:
  New BitKeeper file ``storage/maria/ma_rnext_same.c''
storage/maria/ma_rprev.c:
  New BitKeeper file ``storage/maria/ma_rprev.c''
storage/maria/ma_rrnd.c:
  New BitKeeper file ``storage/maria/ma_rrnd.c''
storage/maria/ma_rsame.c:
  New BitKeeper file ``storage/maria/ma_rsame.c''
storage/maria/ma_rsamepos.c:
  New BitKeeper file ``storage/maria/ma_rsamepos.c''
storage/maria/ma_rt_index.c:
  New BitKeeper file ``storage/maria/ma_rt_index.c''
storage/maria/ma_rt_index.h:
  New BitKeeper file ``storage/maria/ma_rt_index.h''
storage/maria/ma_rt_key.c:
  New BitKeeper file ``storage/maria/ma_rt_key.c''
storage/maria/ma_rt_key.h:
  New BitKeeper file ``storage/maria/ma_rt_key.h''
storage/maria/ma_rt_mbr.c:
  New BitKeeper file ``storage/maria/ma_rt_mbr.c''
storage/maria/ma_rt_mbr.h:
  New BitKeeper file ``storage/maria/ma_rt_mbr.h''
storage/maria/ma_rt_split.c:
  New BitKeeper file ``storage/maria/ma_rt_split.c''
storage/maria/ma_rt_test.c:
  New BitKeeper file ``storage/maria/ma_rt_test.c''
storage/maria/ma_scan.c:
  New BitKeeper file ``storage/maria/ma_scan.c''
storage/maria/ma_search.c:
  New BitKeeper file ``storage/maria/ma_search.c''
storage/maria/ma_sort.c:
  New BitKeeper file ``storage/maria/ma_sort.c''
storage/maria/ma_sp_defs.h:
  New BitKeeper file ``storage/maria/ma_sp_defs.h''
storage/maria/ma_sp_key.c:
  New BitKeeper file ``storage/maria/ma_sp_key.c''
storage/maria/ma_sp_test.c:
  New BitKeeper file ``storage/maria/ma_sp_test.c''
storage/maria/ma_static.c:
  New BitKeeper file ``storage/maria/ma_static.c''
storage/maria/ma_statrec.c:
  New BitKeeper file ``storage/maria/ma_statrec.c''
storage/maria/ma_test1.c:
  New BitKeeper file ``storage/maria/ma_test1.c''
storage/maria/ma_test2.c:
  New BitKeeper file ``storage/maria/ma_test2.c''
storage/maria/ma_test3.c:
  New BitKeeper file ``storage/maria/ma_test3.c''
storage/maria/ma_test_all.sh:
  New BitKeeper file ``storage/maria/ma_test_all.sh''
storage/maria/ma_unique.c:
  New BitKeeper file ``storage/maria/ma_unique.c''
storage/maria/ma_update.c:
  New BitKeeper file ``storage/maria/ma_update.c''
storage/maria/ma_write.c:
  New BitKeeper file ``storage/maria/ma_write.c''
storage/maria/maria_chk.c:
  New BitKeeper file ``storage/maria/maria_chk.c''
storage/maria/maria_def.h:
  New BitKeeper file ``storage/maria/maria_def.h''
storage/maria/maria_ftdump.c:
  New BitKeeper file ``storage/maria/maria_ftdump.c''
storage/maria/maria_log.c:
  New BitKeeper file ``storage/maria/maria_log.c''
storage/maria/maria_pack.c:
  New BitKeeper file ``storage/maria/maria_pack.c''
storage/maria/maria_rename.sh:
  New BitKeeper file ``storage/maria/maria_rename.sh''
storage/maria/test_pack:
  New BitKeeper file ``storage/maria/test_pack''
storage/myisam/ft_myisam.c:
  New BitKeeper file ``storage/myisam/ft_myisam.c''
parent 838c7ddc
......@@ -1759,3 +1759,16 @@ vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
mysql-test/r/*.log
storage/maria/ma_test1
storage/maria/ma_test2
storage/maria/ma_test3
storage/maria/maria_ftdump
storage/maria/ma_sp_test
storage/maria/ma_rt_test
storage/maria/maria_log
storage/maria/maria_pack
storage/maria/maria_chk
storage/maria/ma_test_all
storage/maria/maria.log
storage/maria/*.MAD
storage/maria/*.MAI
......@@ -84,7 +84,7 @@ debug_extra_cflags="-O1 -Wuninitialized"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables"
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables --with-maria-storage-engine"
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
amd64_configs=""
alpha_configs="" # Not used yet
......
......@@ -5,7 +5,7 @@ FROM=$USER@mysql.com
COMMITS=commits@lists.mysql.com
DOCS=docs-commit@mysql.com
LIMIT=10000
VERSION="5.1"
VERSION="maria"
if [ "$REAL_EMAIL" = "" ]
then
......@@ -66,51 +66,6 @@ EOF
bk cset -r+ -d
) | $SENDMAIL -t
#++
# commits@ mail
#--
echo "Notifying commits list at $COMMITS"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $COMMITS
Subject: bk commit into $VERSION tree ($CHANGESET)$BS
X-CSetKey: <$CSETKEY>
$BH
Below is the list of changes that have just been committed into a local
$VERSION repository of $USER. When $USER does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
EOF
bk changes -v -r+
bk cset -r+ -d
) | head -n $LIMIT | $SENDMAIL -t
#++
# docs-commit@ mail
# Picks up anything under the Docs subdirectory (relevant for docs team).
#--
bk changes -v -r+ | grep -q " Docs/"
if [ $? -eq 0 ]
then
echo "Notifying docs list at $DOCS"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $DOCS
Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS
EOF
bk changes -v -r+
bk cset -r+ -d
) | $SENDMAIL -t
fi
else
echo "commit failed because '$BK_STATUS', you may need to re-clone..."
fi
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_MARIA
dnl Sets HAVE_MARIA_DB if --with-maria-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_MARIA], [
AC_ARG_WITH([maria-storage-engine],
[
--with-maria-storage-engine
Enable the Maria Storage Engine],
[mariadb="$withval"],
[mariadb=no])
AC_MSG_CHECKING([for Maria storage engine])
case "$mariadb" in
yes )
AC_DEFINE([HAVE_MARIA_DB], [1], [Builds Maria Storage Engine])
AC_MSG_RESULT([yes])
[mariadb=yes]
;;
* )
AC_MSG_RESULT([no])
[mariadb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_MARIA SECTION
dnl ---------------------------------------------------------------------------
......@@ -2483,6 +2483,10 @@ MYSQL_STORAGE_ENGINE(ndbcluster,,ndbcluster,,,,storage/ndb,,,[
MYSQL_SETUP_NDBCLUSTER
])
MYSQL_STORAGE_ENGINE(partition,,partition)
MYSQL_STORAGE_ENGINE(maria,,,,,,storage/maria,,
\$(top_builddir)/storage/maria/libmaria.a, [
AC_CONFIG_FILES(storage/maria/Makefile)
])
# If we have threads generate some library functions and test programs
sql_server_dirs=
......
......@@ -66,6 +66,17 @@ void ft_free_stopwords(void);
FT_INFO *ft_init_search(uint,void *, uint, byte *, uint,CHARSET_INFO *, byte *);
my_bool ft_boolean_check_syntax_string(const byte *);
/* Internal symbols for fulltext between maria and MyISAM */
#define HA_FT_WTYPE HA_KEYTYPE_FLOAT
#define HA_FT_WLEN 4
#define FT_SEGS 2
#define ft_sintXkorr(A) mi_sint4korr(A)
#define ft_intXstore(T,A) mi_int4store(T,A)
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
#ifdef __cplusplus
}
#endif
......
......@@ -128,7 +128,8 @@ extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup);
/* Functions to handle multiple key caches */
extern my_bool multi_keycache_init(void);
extern void multi_keycache_free(void);
extern KEY_CACHE *multi_key_cache_search(byte *key, uint length);
extern KEY_CACHE *multi_key_cache_search(byte *key, uint length,
KEY_CACHE *def);
extern my_bool multi_key_cache_set(const byte *key, uint length,
KEY_CACHE *key_cache);
extern void multi_key_cache_change(KEY_CACHE *old_data,
......
This diff is collapsed.
......@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file includes constants used with all databases */
/* Author: Michael Widenius */
#ifndef _my_base_h
#define _my_base_h
......@@ -487,4 +486,7 @@ typedef ulong ha_rows;
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
/* invalidator function reference for Query Cache */
typedef void (* invalidator_by_filename)(const char * filename);
#endif /* _my_base_h */
......@@ -18,11 +18,30 @@
#ifndef _my_handler_h
#define _my_handler_h
#include "my_global.h"
#include "my_base.h"
#include "m_ctype.h"
#include "myisampack.h"
/*
There is a hard limit for the maximum number of keys as there are only
8 bits in the index file header for the number of keys in a table.
This means that 0..255 keys can exist for a table. The idea of
HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
a MyISAM table for which one has more keys than MyISAM is normally
compiled for. If you don't have this, you will get a core dump when
running myisamchk compiled for 128 keys on a table with 255 keys.
*/
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
/*
The following defines can be increased if necessary.
But beware the dependency of HA_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
*/
#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
#define HA_MAX_KEY_SEG 16 /* Max segments for key */
#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
typedef struct st_HA_KEYSEG /* Key-portion */
{
CHARSET_INFO *charset;
......@@ -82,7 +101,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
my_bool, my_bool);
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag,
......
This diff is collapsed.
/* Copyright (C) 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; 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 */
/* Definitions needed for myisamchk/mariachk.c */
/*
Entries marked as "QQ to be removed" are NOT used to
pass check/repair options to xxx_check.c. They are used
internally by xxxchk.c or/and ha_xxxx.cc and should NOT
be stored together with other flags. They should be removed
from the following list to make addition of new flags possible.
*/
#ifndef _myisamchk_h
#define _myisamchk_h
#define T_AUTO_INC 1
#define T_AUTO_REPAIR 2 /* QQ to be removed */
#define T_BACKUP_DATA 4
#define T_CALC_CHECKSUM 8
#define T_CHECK 16 /* QQ to be removed */
#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */
#define T_CREATE_MISSING_KEYS 64
#define T_DESCRIPT 128
#define T_DONT_CHECK_CHECKSUM 256
#define T_EXTEND 512
#define T_FAST (1L << 10) /* QQ to be removed */
#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */
#define T_FORCE_UNIQUENESS (1L << 12)
#define T_INFO (1L << 13)
#define T_MEDIUM (1L << 14)
#define T_QUICK (1L << 15) /* QQ to be removed */
#define T_READONLY (1L << 16) /* QQ to be removed */
#define T_REP (1L << 17)
#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */
#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */
#define T_RETRY_WITHOUT_QUICK (1L << 20)
#define T_SAFE_REPAIR (1L << 21)
#define T_SILENT (1L << 22)
#define T_SORT_INDEX (1L << 23) /* QQ to be removed */
#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */
#define T_STATISTICS (1L << 25)
#define T_UNPACK (1L << 26)
#define T_UPDATE_STATE (1L << 27)
#define T_VERBOSE (1L << 28)
#define T_VERY_SILENT (1L << 29)
#define T_WAIT_FOREVER (1L << 30)
#define T_WRITE_LOOP ((ulong) 1L << 31)
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
/*
Flags used by xxxxchk.c or/and ha_xxxx.cc that are NOT passed
to xxxcheck.c follows:
*/
#define TT_USEFRM 1
#define TT_FOR_UPGRADE 2
#define O_NEW_INDEX 1 /* Bits set in out_flag */
#define O_NEW_DATA 2
#define O_DATA_LOST 4
typedef struct st_sort_key_blocks /* Used when sorting */
{
uchar *buff, *end_pos;
uchar lastkey[HA_MAX_POSSIBLE_KEY_BUFF];
uint last_length;
int inited;
} SORT_KEY_BLOCKS;
/*
MARIA/MYISAM supports several statistics collection
methods. Currently statistics collection method is not stored in
MARIA file and has to be specified for each table analyze/repair
operation in MI_CHECK::stats_method.
*/
typedef enum
{
/* Treat NULLs as inequal when collecting statistics (default for 4.1/5.0) */
MI_STATS_METHOD_NULLS_NOT_EQUAL,
/* Treat NULLs as equal when collecting statistics (like 4.0 did) */
MI_STATS_METHOD_NULLS_EQUAL,
/* Ignore NULLs - count only tuples without NULLs in the index components */
MI_STATS_METHOD_IGNORE_NULLS
} enum_handler_stats_method;
typedef struct st_handler_check_param
{
char *isam_file_name;
MY_TMPDIR *tmpdir;
void *thd;
const char *db_name, *table_name, *op_name;
ulonglong auto_increment_value;
ulonglong max_data_file_length;
ulonglong keys_in_use;
ulonglong max_record_length;
/*
The next two are used to collect statistics, see update_key_parts for
description.
*/
ulonglong unique_count[HA_MAX_KEY_SEG + 1];
ulonglong notnull_count[HA_MAX_KEY_SEG + 1];
my_off_t search_after_block;
my_off_t new_file_pos, key_file_blocks;
my_off_t keydata, totaldata, key_blocks, start_check_pos;
ha_rows total_records, total_deleted;
ha_checksum record_checksum, glob_crc;
ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
ulong use_buffers, read_buffer_length, write_buffer_length;
ulong sort_buffer_length, sort_key_blocks;
ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
uint out_flag, warning_printed, error_printed, verbose;
uint opt_sort_key, total_files, max_level;
uint testflag, key_cache_block_size;
int tmpfile_createflag;
myf myf_rw;
uint8 language;
my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
my_bool retry_repair, force_sort, calc_checksum;
char temp_filename[FN_REFLEN];
IO_CACHE read_cache;
enum_handler_stats_method stats_method;
} HA_CHECK;
typedef struct st_sort_ftbuf
{
uchar *buf, *end;
int count;
uchar lastkey[HA_MAX_KEY_BUFF];
} SORT_FT_BUF;
typedef struct st_buffpek {
my_off_t file_pos; /* Where we are in the sort file */
uchar *base,*key; /* Key pointers */
ha_rows count; /* Number of rows in table */
ulong mem_count; /* numbers of keys in memory */
ulong max_keys; /* Max keys in buffert */
} BUFFPEK;
#endif /* _myisamchk_h */
......@@ -73,8 +73,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources)
EXTRA_libmysqld_a_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
ha_ndbcluster_binlog.cc \
ha_partition.cc
ha_ndbcluster_binlog.cc ha_partition.cc \
ha_maria.cc
libmysqld_a_DEPENDENCIES= @mysql_se_objs@
libmysqld_a_SOURCES=
......
-- require r/have_maria.require
disable_query_log;
show variables like "have_maria";
enable_query_log;
Variable_name Value
have_maria YES
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
###############################################
# #
# Prepared Statements test on MARIA tables #
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
-- source include/have_maria.inc
let $type= 'MARIA' ;
-- source include/ps_create.inc
-- source include/ps_renew.inc
-- source include/ps_query.inc
# parameter in SELECT ... MATCH/AGAINST
# case derived from client_test.c: test_bug1500()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
eval create table t2 (s varchar(25), fulltext(s))
ENGINE = $type ;
insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
commit ;
prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
set @arg00='Dogs' ;
execute stmt1 using @arg00 ;
prepare stmt1 from ' SELECT s FROM t2
where match (s) against (concat(?,''digger'')) ';
set @arg00='Grave' ;
execute stmt1 using @arg00 ;
drop table t2 ;
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t9;
# End of 4.1 tests
......@@ -148,7 +148,8 @@ static void safe_hash_free(SAFE_HASH *hash)
Return the value stored for a key or default value if no key
*/
static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length)
static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length,
byte *def)
{
byte *result;
DBUG_ENTER("safe_hash_search");
......@@ -156,7 +157,7 @@ static byte *safe_hash_search(SAFE_HASH *hash, const byte *key, uint length)
result= hash_search(&hash->hash, key, length);
rw_unlock(&hash->mutex);
if (!result)
result= hash->default_value;
result= def;
else
result= ((SAFE_HASH_ENTRY*) result)->data;
DBUG_PRINT("exit",("data: 0x%lx", result));
......@@ -316,6 +317,7 @@ void multi_keycache_free(void)
multi_key_cache_search()
key key to find (usually table path)
uint length Length of key.
def Default value if no key cache
NOTES
This function is coded in such a way that we will return the
......@@ -326,11 +328,13 @@ void multi_keycache_free(void)
key cache to use
*/
KEY_CACHE *multi_key_cache_search(byte *key, uint length)
KEY_CACHE *multi_key_cache_search(byte *key, uint length,
KEY_CACHE *def)
{
if (!key_cache_hash.hash.records)
return dflt_key_cache;
return (KEY_CACHE*) safe_hash_search(&key_cache_hash, key, length);
return def;
return (KEY_CACHE*) safe_hash_search(&key_cache_hash, key, length,
(void*) def);
}
......
......@@ -15,9 +15,12 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#include "my_handler.h"
#include <my_global.h>
#include <m_ctype.h>
#include <my_base.h>
#include <my_handler.h>
int mi_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
int ha_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
uchar *b, uint b_length, my_bool part_key,
my_bool skip_end_space)
{
......@@ -173,7 +176,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
next_key_length=key_length-b_length-pack_length;
if (piks &&
(flag=mi_compare_text(keyseg->charset,a,a_length,b,b_length,
(flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
next_key_length <= 0),
(my_bool)!(nextflag & SEARCH_PREFIX))))
......@@ -186,7 +189,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
{
uint length=(uint) (end-a), a_length=length, b_length=length;
if (piks &&
(flag= mi_compare_text(keyseg->charset, a, a_length, b, b_length,
(flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
next_key_length <= 0),
(my_bool)!(nextflag & SEARCH_PREFIX))))
......@@ -234,7 +237,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
next_key_length=key_length-b_length-pack_length;
if (piks &&
(flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length,
(flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
next_key_length <= 0),
(my_bool) ((nextflag & (SEARCH_FIND |
......@@ -481,12 +484,15 @@ end:
DESCRIPTION
Find the first NULL value in index-suffix values tuple.
TODO Consider optimizing this fuction or its use so we don't search for
NULL values in completely NOT NULL index suffixes.
TODO
Consider optimizing this function or its use so we don't search for
NULL values in completely NOT NULL index suffixes.
RETURN
First key part that has NULL as value in values tuple, or the last key part
(with keyseg->type==HA_TYPE_END) if values tuple doesn't contain NULLs.
First key part that has NULL as value in values tuple, or the last key
part (with keyseg->type==HA_TYPE_END) if values tuple doesn't contain
NULLs.
*/
HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
......@@ -504,6 +510,7 @@ HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_BIT:
if (keyseg->flag & HA_SPACE_PACK)
{
int a_length;
......@@ -516,6 +523,8 @@ HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
break;
case HA_KEYTYPE_VARTEXT1:
case HA_KEYTYPE_VARBINARY1:
case HA_KEYTYPE_VARTEXT2:
case HA_KEYTYPE_VARBINARY2:
{
int a_length;
get_key_length(a_length, a);
......@@ -545,6 +554,9 @@ HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
case HA_KEYTYPE_DOUBLE:
a= end;
break;
case HA_KEYTYPE_END:
DBUG_ASSERT(0);
break;
}
}
return keyseg;
......
This diff is collapsed.
/* Copyright (C) 2006,2004 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 */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
/* class for the the maria handler */
#include <maria.h>
#define HA_RECOVER_NONE 0 /* No automatic recover */
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
extern ulong maria_sort_buffer_size;
extern TYPELIB maria_recover_typelib;
extern ulong maria_recover_options;
class ha_maria :public handler
{
MARIA_HA *file;
ulong int_table_flags;
char *data_file_name, *index_file_name;
bool can_enable_indexes;
int repair(THD * thd, HA_CHECK &param, bool optimize);
public:
ha_maria(TABLE_SHARE * table_arg);
~ha_maria()
{}
const char *table_type() const
{ return "MARIA"; }
const char *index_type(uint key_number);
const char **bas_ext() const;
ulong table_flags() const
{ return int_table_flags; }
ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const
{ return MARIA_MAX_KEY; }
uint max_supported_key_length() const
{ return HA_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const
{ return HA_MAX_KEY_LENGTH; }
uint checksum() const;
virtual bool check_if_locking_is_allowed(uint sql_command,
ulong type, TABLE * table,
uint count,
bool called_by_logger_thread);
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
int delete_row(const byte * buf);
int index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag);
int index_read_idx(byte * buf, uint idx, const byte * key,
uint key_len, enum ha_rkey_function find_flag);
int index_read_last(byte * buf, const byte * key, uint key_len);
int index_next(byte * buf);
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
int index_next_same(byte * buf, const byte * key, uint keylen);
int ft_init()
{
if (!ft_handler)
return 1;
ft_handler->please->reinit_search(ft_handler);
return 0;
}
FT_INFO *ft_init_ext(uint flags, uint inx, String * key)
{
return maria_ft_init_search(flags, file, inx,
(byte *) key->ptr(), key->length(),
key->charset(), table->record[0]);
}
int ft_read(byte * buf);
int rnd_init(bool scan);
int rnd_next(byte * buf);
int rnd_pos(byte * buf, byte * pos);
int restart_rnd_next(byte * buf, byte * pos);
void position(const byte * record);
void info(uint);
int extra(enum ha_extra_function operation);
int extra_opt(enum ha_extra_function operation, ulong cache_size);
int external_lock(THD * thd, int lock_type);
int delete_all_rows(void);
int disable_indexes(uint mode);
int enable_indexes(uint mode);
int indexes_are_disabled(void);
void start_bulk_insert(ha_rows rows);
int end_bulk_insert();
ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key);
void update_create_info(HA_CREATE_INFO * create_info);
int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info);
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
enum thr_lock_type lock_type);
ulonglong get_auto_increment();
int rename_table(const char *from, const char *to);
int delete_table(const char *name);
int check(THD * thd, HA_CHECK_OPT * check_opt);
int analyze(THD * thd, HA_CHECK_OPT * check_opt);
int repair(THD * thd, HA_CHECK_OPT * check_opt);
bool check_and_repair(THD * thd);
bool is_crashed() const;
bool auto_repair() const
{ return maria_recover_options != 0; }
int optimize(THD * thd, HA_CHECK_OPT * check_opt);
int restore(THD * thd, HA_CHECK_OPT * check_opt);
int backup(THD * thd, HA_CHECK_OPT * check_opt);
int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt);
int preload_keys(THD * thd, HA_CHECK_OPT * check_opt);
bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
#ifdef HAVE_REPLICATION
int dump(THD * thd, int fd);
int net_read_dump(NET * net);
#endif
};
......@@ -105,7 +105,7 @@ static handler *myisam_create_handler(TABLE_SHARE *table)
// collect errors printed by mi_check routines
static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
const char *fmt, va_list args)
{
THD* thd = (THD*)param->thd;
......@@ -146,13 +146,13 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
extern "C" {
volatile int *killed_ptr(MI_CHECK *param)
volatile int *killed_ptr(HA_CHECK *param)
{
/* In theory Unsafe conversion, but should be ok for now */
return (int*) &(((THD *)(param->thd))->killed);
}
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
void mi_check_print_error(HA_CHECK *param, const char *fmt,...)
{
param->error_printed|=1;
param->out_flag|= O_DATA_LOST;
......@@ -162,7 +162,7 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
va_end(args);
}
void mi_check_print_info(MI_CHECK *param, const char *fmt,...)
void mi_check_print_info(HA_CHECK *param, const char *fmt,...)
{
va_list args;
va_start(args, fmt);
......@@ -170,7 +170,7 @@ void mi_check_print_info(MI_CHECK *param, const char *fmt,...)
va_end(args);
}
void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
void mi_check_print_warning(HA_CHECK *param, const char *fmt,...)
{
param->warning_printed=1;
param->out_flag|= O_DATA_LOST;
......@@ -382,7 +382,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
if (!file) return HA_ADMIN_INTERNAL_ERROR;
int error;
MI_CHECK param;
HA_CHECK param;
MYISAM_SHARE* share = file->s;
const char *old_proc_info=thd->proc_info;
......@@ -393,7 +393,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
param.db_name= table->s->db.str;
param.table_name= table->alias;
param.testflag = check_opt->flags | T_CHECK | T_SILENT;
param.stats_method= (enum_mi_stats_method)thd->variables.myisam_stats_method;
param.stats_method= (enum_handler_stats_method)thd->variables.myisam_stats_method;
if (!(table->db_stat & HA_READ_ONLY))
param.testflag|= T_STATISTICS;
......@@ -474,7 +474,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
{
int error=0;
MI_CHECK param;
HA_CHECK param;
MYISAM_SHARE* share = file->s;
myisamchk_init(&param);
......@@ -485,7 +485,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
T_DONT_CHECK_CHECKSUM);
param.using_global_keycache = 1;
param.stats_method= (enum_mi_stats_method)thd->variables.myisam_stats_method;
param.stats_method= (enum_handler_stats_method)thd->variables.myisam_stats_method;
if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE;
......@@ -531,7 +531,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
MI_CHECK param;
HA_CHECK param;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "restore";
......@@ -591,7 +591,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
MI_CHECK param;
HA_CHECK param;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "backup";
......@@ -607,7 +607,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
MI_CHECK param;
HA_CHECK param;
ha_rows start_records;
if (!file) return HA_ADMIN_INTERNAL_ERROR;
......@@ -657,7 +657,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
{
int error;
if (!file) return HA_ADMIN_INTERNAL_ERROR;
MI_CHECK param;
HA_CHECK param;
myisamchk_init(&param);
param.thd = thd;
......@@ -676,7 +676,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
}
int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
int ha_myisam::repair(THD *thd, HA_CHECK &param, bool optimize)
{
int error=0;
uint local_testflag=param.testflag;
......@@ -854,7 +854,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if (error != HA_ADMIN_OK)
{
/* Send error to user */
MI_CHECK param;
HA_CHECK param;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "assign_to_keycache";
......@@ -922,7 +922,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
err:
{
MI_CHECK param;
HA_CHECK param;
myisamchk_init(&param);
param.thd= thd;
param.op_name= "preload_keys";
......@@ -1029,7 +1029,7 @@ int ha_myisam::enable_indexes(uint mode)
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
{
THD *thd=current_thd;
MI_CHECK param;
HA_CHECK param;
const char *save_proc_info=thd->proc_info;
thd->proc_info="Creating index";
myisamchk_init(&param);
......@@ -1038,7 +1038,7 @@ int ha_myisam::enable_indexes(uint mode)
T_CREATE_MISSING_KEYS);
param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= thd->variables.myisam_sort_buff_size;
param.stats_method= (enum_mi_stats_method)thd->variables.myisam_stats_method;
param.stats_method= (enum_handler_stats_method)thd->variables.myisam_stats_method;
param.tmpdir=&mysql_tmpdir_list;
if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair)
{
......@@ -1685,7 +1685,7 @@ ulonglong ha_myisam::get_auto_increment()
{
ulonglong nr;
int error;
byte key[MI_MAX_KEY_LENGTH];
byte key[HA_MAX_KEY_LENGTH];
if (!table->s->next_number_key_offset)
{ // Autoincrement at key-start
......
......@@ -22,6 +22,7 @@
/* class for the the myisam handler */
#include <myisam.h>
#include <myisamchk.h>
#include <ft_global.h>
#define HA_RECOVER_NONE 0 /* No automatic recover */
......@@ -40,7 +41,7 @@ class ha_myisam: public handler
ulong int_table_flags;
char *data_file_name, *index_file_name;
bool can_enable_indexes;
int repair(THD *thd, MI_CHECK &param, bool optimize);
int repair(THD *thd, HA_CHECK &param, bool optimize);
public:
ha_myisam(TABLE_SHARE *table_arg);
......@@ -56,8 +57,8 @@ class ha_myisam: public handler
HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return HA_MAX_KEY_LENGTH; }
uint checksum() const;
virtual bool check_if_locking_is_allowed(uint sql_command,
......
......@@ -47,8 +47,8 @@ class ha_myisammrg: public handler
HA_READ_ORDER | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return MI_MAX_KEY; }
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return HA_MAX_KEY_LENGTH; }
double scan_time()
{ return ulonglong2double(data_file_length) / IO_SIZE + file->tables; }
......
......@@ -21,6 +21,7 @@
#pragma interface /* gcc class implementation */
#endif
#include <my_handler.h>
#include <ft_global.h>
#include <keycache.h>
......@@ -233,6 +234,7 @@ enum legacy_db_type
DB_TYPE_BLACKHOLE_DB,
DB_TYPE_PARTITION_DB,
DB_TYPE_BINLOG,
DB_TYPE_MARIA,
DB_TYPE_DEFAULT=127 // Must be last
};
......
......@@ -1261,7 +1261,6 @@ public:
/* for fulltext search */
#include <ft_global.h>
class Item_func_match :public Item_real_func
{
......
......@@ -1440,6 +1440,12 @@ extern handlerton partition_hton;
#else
extern SHOW_COMP_OPTION have_partition_db;
#endif
#ifdef WITH_MARIA_STORAGE_ENGINE
extern handlerton maria_hton;
#define have_maria maria_hton.state
#else
extern SHOW_COMP_OPTION have_maria;
#endif
extern handlerton myisam_hton;
extern handlerton myisammrg_hton;
......
......@@ -27,6 +27,9 @@
#include "event.h"
#include "ha_myisam.h"
#ifdef WITH_MARIA_STORAGE_ENGINE
#include "ha_maria.h"
#endif
#ifdef WITH_INNOBASE_STORAGE_ENGINE
#define OPT_INNODB_DEFAULT 1
......@@ -529,6 +532,7 @@ char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF";
const char *myisam_stats_method_str="nulls_unequal";
const char *maria_stats_method_str="nulls_unequal";
/* name of reference on left espression in rewritten IN subquery */
const char *in_left_expr_name= "<left expr>";
/* name of additional condition */
......@@ -4729,10 +4733,17 @@ enum options_mysqld
OPT_MAX_LENGTH_FOR_SORT_DATA,
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE,
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
OPT_MYISAM_USE_MMAP,
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
OPT_MYISAM_STATS_METHOD,
OPT_MARIA_BLOCK_SIZE,
OPT_MARIA_MAX_SORT_FILE_SIZE, OPT_MARIA_SORT_BUFFER_SIZE,
OPT_MARIA_USE_MMAP, OPT_MARIA_REPAIR_THREADS,
OPT_MARIA_STATS_METHOD,
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
OPT_OPEN_FILES_LIMIT,
......@@ -4746,7 +4757,7 @@ enum options_mysqld
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS,
OPT_WAIT_TIMEOUT,
OPT_INNODB_MIRRORED_LOG_GROUPS,
OPT_INNODB_LOG_FILES_IN_GROUP,
OPT_INNODB_LOG_FILE_SIZE,
......@@ -5932,6 +5943,50 @@ log and this option does nothing anymore.",
0
#endif
, 0, 2, 0, 1, 0},
#ifdef WITH_MARIA_STORAGE_ENGINE
{"maria_block_size", OPT_MARIA_BLOCK_SIZE,
"Block size to be used for MARIA index pages.",
(gptr*) &maria_block_size,
(gptr*) &maria_block_size, 0, GET_ULONG, REQUIRED_ARG,
MARIA_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH,
MARIA_MAX_KEY_BLOCK_LENGTH,
0, MARIA_MIN_KEY_BLOCK_LENGTH, 0},
{"maria_key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for Maria tables. Increase "
"this to get better index handling (for all reads and multiple writes) to "
"as much as you can afford; 64M on a 256M machine that mainly runs MySQL "
"is quite common.",
(gptr*) &maria_key_cache_var.param_buff_size, (gptr*) 0,
0, (GET_ULL | GET_ASK_ADDR),
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD,
IO_SIZE, 0},
{"maria_max_sort_file_size", OPT_MARIA_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary "
"file would get bigger than this.",
(gptr*) &global_system_variables.maria_max_sort_file_size,
(gptr*) &max_system_variables.maria_max_sort_file_size, 0,
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
0, 1024*1024, 0},
{"maria_repair_threads", OPT_MARIA_REPAIR_THREADS,
"Number of threads to use when repairing maria tables. The value of 1 "
"disables parallel repair.",
(gptr*) &global_system_variables.maria_repair_threads,
(gptr*) &max_system_variables.maria_repair_threads, 0,
GET_ULONG, REQUIRED_ARG, 1, 1, ~0L, 0, 1, 0},
{"maria_sort_buffer_size", OPT_MARIA_SORT_BUFFER_SIZE,
"The buffer that is allocated when sorting the index when doing a REPAIR "
"or when creating indexes with CREATE INDEX or ALTER TABLE.",
(gptr*) &global_system_variables.maria_sort_buff_size,
(gptr*) &max_system_variables.maria_sort_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
{"maria_stats_method", OPT_MARIA_STATS_METHOD,
"Specifies how maria index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
(gptr*) &maria_stats_method_str, (gptr*) &maria_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packetlength to send/receive from to server.",
(gptr*) &global_system_variables.max_allowed_packet,
......@@ -6028,12 +6083,6 @@ The minimum value for this variable is 4096.",
(gptr*) &myisam_data_pointer_size,
(gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
6, 2, 7, 0, 1, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Deprecated option",
(gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
(gptr*) &max_system_variables.myisam_max_extra_sort_file_size,
0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,
0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary file would get bigger than this.",
(gptr*) &global_system_variables.myisam_max_sort_file_size,
......@@ -6997,15 +7046,24 @@ static void mysql_init_variables(void)
query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION);
myisam_recover_options_str= sql_mode_str= "OFF";
myisam_stats_method_str= "nulls_unequal";
myisam_stats_method_str= maria_stats_method_str= "nulls_unequal";
my_bind_addr = htonl(INADDR_ANY);
threads.empty();
thread_cache.empty();
key_caches.empty();
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
default_key_cache_base.length)))
default_key_cache_base.length)))
exit(1);
#ifdef WITH_MARIA_STORAGE_ENGINE
if (!(maria_key_cache= get_or_create_key_cache(maria_key_cache_base.str,
maria_key_cache_base.length)))
exit(1);
multi_keycache_init(); /* set key_cache_hash.default_value = dflt_key_cache */
maria_key_cache->param_buff_size= maria_key_cache_var.param_buff_size;
maria_key_cache->param_block_size= maria_block_size;
#endif
/* set key_cache_hash.default_value = dflt_key_cache */
multi_keycache_init();
/* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
......@@ -7692,7 +7750,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int method;
LINT_INIT(method_conv);
myisam_stats_method_str= argument;
if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
{
fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument);
......
......@@ -55,6 +55,9 @@
#include <my_getopt.h>
#include <thr_alarm.h>
#include <myisam.h>
#ifdef WITH_MARIA_STORAGE_ENGINE
#include <maria.h>
#endif
/* WITH_BERKELEY_STORAGE_ENGINE */
extern bool berkeley_shared_data;
......@@ -150,6 +153,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type);
static void fix_query_cache_size(THD *thd, enum_var_type type);
static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type);
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_maria_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
static void fix_max_connections(THD *thd, enum_var_type type);
......@@ -338,6 +342,14 @@ sys_var_thd_enum sys_myisam_stats_method("myisam_stats_method",
&myisam_stats_method_typelib,
NULL);
sys_var_thd_ulonglong sys_maria_max_sort_file_size("maria_max_sort_file_size", &SV::maria_max_sort_file_size, fix_maria_max_sort_file_size, 1);
sys_var_thd_ulong sys_maria_repair_threads("maria_repair_threads", &SV::maria_repair_threads);
sys_var_thd_ulong sys_maria_sort_buffer_size("maria_sort_buffer_size", &SV::maria_sort_buff_size);
sys_var_thd_enum sys_maria_stats_method("maria_stats_method",
&SV::maria_stats_method,
&myisam_stats_method_typelib,
NULL);
sys_var_thd_ulong sys_net_buffer_length("net_buffer_length",
&SV::net_buffer_length);
sys_var_thd_ulong sys_net_read_timeout("net_read_timeout",
......@@ -637,6 +649,7 @@ sys_var_have_variable sys_have_federated_db("have_federated_engine",
&have_federated_db);
sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
sys_var_have_variable sys_have_maria("have_maria", &have_maria);
sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
sys_var_have_variable sys_have_partition_db("have_partitioning",
......@@ -760,6 +773,7 @@ SHOW_VAR init_vars[]= {
{sys_have_federated_db.name,(char*) &have_federated_db, SHOW_HAVE},
{sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
{sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
{sys_have_maria.name, (char*) &have_maria, SHOW_HAVE},
{sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
{sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
{sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
......@@ -834,6 +848,15 @@ SHOW_VAR init_vars[]= {
{sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS},
{"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL},
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT},
{sys_maria_max_sort_file_size.name, (char*) &sys_maria_max_sort_file_size,
SHOW_SYS},
{sys_maria_repair_threads.name, (char*) &sys_maria_repair_threads,
SHOW_SYS},
{sys_maria_sort_buffer_size.name, (char*) &sys_maria_sort_buffer_size,
SHOW_SYS},
{sys_maria_stats_method.name, (char*) &sys_maria_stats_method, SHOW_SYS},
{sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS},
{sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS},
{sys_max_binlog_size.name, (char*) &sys_max_binlog_size, SHOW_SYS},
......@@ -1116,6 +1139,16 @@ fix_myisam_max_sort_file_size(THD *thd, enum_var_type type)
(my_off_t) global_system_variables.myisam_max_sort_file_size;
}
static void
fix_maria_max_sort_file_size(THD *thd, enum_var_type type)
{
#ifdef WITH_MARIA_STORAGE_ENGINE
maria_max_temp_length=
(my_off_t) global_system_variables.myisam_max_sort_file_size;
#endif
}
/*
Set the OPTION_BIG_SELECTS flag if max_join_size == HA_POS_ERROR
*/
......@@ -2299,6 +2332,7 @@ void sys_var_collation_server::set_default(THD *thd, enum_var_type type)
LEX_STRING default_key_cache_base= {(char *) "default", 7 };
LEX_STRING maria_key_cache_base= {(char *) "maria", 5 };
static KEY_CACHE zero_key_cache;
......@@ -2308,7 +2342,7 @@ KEY_CACHE *get_key_cache(LEX_STRING *cache_name)
if (!cache_name || ! cache_name->length)
cache_name= &default_key_cache_base;
return ((KEY_CACHE*) find_named(&key_caches,
cache_name->str, cache_name->length, 0));
cache_name->str, cache_name->length, 0));
}
......
......@@ -985,6 +985,7 @@ public:
extern sys_var_thd_bool sys_old_alter_table;
extern sys_var_thd_bool sys_old_passwords;
extern LEX_STRING default_key_cache_base;
extern LEX_STRING maria_key_cache_base;
/* For sql_yacc */
struct sys_var_with_base
......
......@@ -180,7 +180,7 @@ class Time_zone;
struct system_variables
{
ulonglong myisam_max_extra_sort_file_size;
ulonglong maria_max_sort_file_size;
ulonglong myisam_max_sort_file_size;
ha_rows select_limit;
ha_rows max_join_size;
......@@ -195,6 +195,9 @@ struct system_variables
ulong max_sort_length;
ulong max_tmp_tables;
ulong max_insert_delayed_threads;
ulong maria_repair_threads;
ulong maria_sort_buff_size;
ulong maria_stats_method;
ulong multi_range_count;
ulong myisam_repair_threads;
ulong myisam_sort_buff_size;
......
......@@ -35,7 +35,9 @@
the callback function 'unpack_addon_fields'.
*/
typedef struct st_sort_addon_field { /* Sort addon packed field */
typedef struct st_sort_addon_field
{
/* Sort addon packed field */
Field *field; /* Original field */
uint offset; /* Offset from the last sorted field */
uint null_offset; /* Offset to to null bit from the last sorted field */
......@@ -43,13 +45,6 @@ typedef struct st_sort_addon_field { /* Sort addon packed field */
uint8 null_bit; /* Null bit mask for the field */
} SORT_ADDON_FIELD;
typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */
my_off_t file_pos; /* Where we are in the sort file */
uchar *base,*key; /* key pointers */
ha_rows count; /* Number of rows in table */
ulong mem_count; /* numbers of keys in memory */
ulong max_keys; /* Max keys in buffert */
} BUFFPEK;
typedef struct st_sort_param {
uint rec_length; /* Length of sorted records */
......
......@@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST =
SUBDIRS =
DIST_SUBDIRS = . csv example bdb heap innobase myisam myisammrg ndb archive
DIST_SUBDIRS = . csv example bdb heap innobase myisam myisammrg maria ndb archive
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -112,7 +112,8 @@ handlerton tina_hton= {
NULL, /* Fill FILES Table */
HTON_CAN_RECREATE,
NULL, /* binlog_func */
NULL /* binlog_log_query */
NULL, /* binlog_log_query */
NULL /* release_temporary_latches */
};
/*****************************************************************************
......
# 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
EXTRA_DIST = ma_test_all.sh ma_test_all.res ma_ft_stem.c cmakelists.txt
pkgdata_DATA = ma_test_all ma_test_all.res
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmaria.a \
$(top_builddir)/storage/myisam/libmyisam.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
pkglib_LIBRARIES = libmaria.a
bin_PROGRAMS = maria_chk maria_log maria_pack maria_ftdump
maria_chk_DEPENDENCIES= $(LIBRARIES)
maria_log_DEPENDENCIES= $(LIBRARIES)
maria_pack_DEPENDENCIES=$(LIBRARIES)
noinst_PROGRAMS = ma_test1 ma_test2 ma_test3 ma_rt_test ma_sp_test
noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h ma_sp_defs.h ma_fulltext.h ma_ftdefs.h ma_ft_test1.h ma_ft_eval.h
ma_test1_DEPENDENCIES= $(LIBRARIES)
ma_test2_DEPENDENCIES= $(LIBRARIES)
ma_test3_DEPENDENCIES= $(LIBRARIES)
#ma_ft_test1_DEPENDENCIES= $(LIBRARIES)
#ma_ft_eval_DEPENDENCIES= $(LIBRARIES)
maria_ftdump_DEPENDENCIES= $(LIBRARIES)
ma_rt_test_DEPENDENCIES= $(LIBRARIES)
ma_sp_test_DEPENDENCIES= $(LIBRARIES)
libmaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \
ma_rnext.c ma_rnext_same.c \
ma_search.c ma_page.c ma_key.c ma_locking.c \
ma_rrnd.c ma_scan.c ma_cache.c \
ma_statrec.c ma_packrec.c ma_dynrec.c \
ma_update.c ma_write.c ma_unique.c \
ma_delete.c \
ma_rprev.c ma_rfirst.c ma_rlast.c ma_rsame.c \
ma_rsamepos.c ma_panic.c ma_close.c ma_create.c\
ma_range.c ma_dbug.c ma_checksum.c ma_log.c \
ma_changed.c ma_static.c ma_delete_all.c \
ma_delete_table.c ma_rename.c ma_check.c \
ma_keycache.c ma_preload.c ma_ft_parser.c \
ma_ft_update.c ma_ft_boolean_search.c \
ma_ft_nlq_search.c ft_maria.c ma_sort.c \
ma_rt_index.c ma_rt_key.c ma_rt_mbr.c ma_rt_split.c \
ma_sp_key.c
CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA?
DEFS =
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 $@
# Don't update the files from bitkeeper
%::SCCS/s.%
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
ft_stopwords.c ft_update.c mi_cache.c mi_changed.c mi_check.c
mi_checksum.c mi_close.c mi_create.c mi_dbug.c mi_delete.c
mi_delete_all.c mi_delete_table.c mi_dynrec.c mi_extra.c mi_info.c
mi_key.c mi_keycache.c mi_locking.c mi_log.c mi_open.c
mi_packrec.c mi_page.c mi_panic.c mi_preload.c mi_range.c mi_rename.c
mi_rfirst.c mi_rlast.c mi_rnext.c mi_rnext_same.c mi_rprev.c mi_rrnd.c
mi_rsame.c mi_rsamepos.c mi_scan.c mi_search.c mi_static.c mi_statrec.c
mi_unique.c mi_update.c mi_write.c rt_index.c rt_key.c rt_mbr.c
rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamchk myisamchk.c)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamlog myisamlog.c)
TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
ADD_EXECUTABLE(myisampack myisampack.c)
TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)
/* Copyright (C) 2006 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 */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/*
This function is for interface functions between fulltext and maria
*/
#include "ma_ftdefs.h"
FT_INFO *maria_ft_init_search(uint flags, void *info, uint keynr,
byte *query, uint query_len, CHARSET_INFO *cs,
byte *record)
{
FT_INFO *res;
if (flags & FT_BOOL)
res= maria_ft_init_boolean_search((MARIA_HA *) info, keynr, query,
query_len, cs);
else
res= maria_ft_init_nlq_search((MARIA_HA *) info, keynr, query, query_len,
flags, record);
return res;
}
const struct _ft_vft _ma_ft_vft_nlq = {
maria_ft_nlq_read_next, maria_ft_nlq_find_relevance,
maria_ft_nlq_close_search, maria_ft_nlq_get_relevance,
maria_ft_nlq_reinit_search
};
const struct _ft_vft _ma_ft_vft_boolean = {
maria_ft_boolean_read_next, maria_ft_boolean_find_relevance,
maria_ft_boolean_close_search, maria_ft_boolean_get_relevance,
maria_ft_boolean_reinit_search
};
/* Copyright (C) 2006 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 */
/*
Functions for read record cacheing with maria
Used for reading dynamic/compressed records from datafile.
Can fetch data directly from file (outside cache),
if reading a small chunk straight before the cached part (with possible
overlap).
Can be explicitly asked not to use cache (by not setting READING_NEXT in
flag) - useful for occasional out-of-cache reads, when the next read is
expected to hit the cache again.
Allows "partial read" errors in the record header (when READING_HEADER flag
is set) - unread part is bzero'ed
Note: out-of-cache reads are enabled for shared IO_CACHE's too,
as these reads will be cached by OS cache (and my_pread is always atomic)
*/
#include "maria_def.h"
int _ma_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
int flag)
{
uint read_length,in_buff_length;
my_off_t offset;
char *in_buff_pos;
DBUG_ENTER("_ma_read_cache");
if (pos < info->pos_in_file)
{
read_length=length;
if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
read_length=(uint) (info->pos_in_file-pos);
info->seek_not_done=1;
if (my_pread(info->file,buff,read_length,pos,MYF(MY_NABP)))
DBUG_RETURN(1);
if (!(length-=read_length))
DBUG_RETURN(0);
pos+=read_length;
buff+=read_length;
}
if (pos >= info->pos_in_file &&
(offset= (my_off_t) (pos - info->pos_in_file)) <
(my_off_t) (info->read_end - info->request_pos))
{
in_buff_pos=info->request_pos+(uint) offset;
in_buff_length= min(length,(uint) (info->read_end-in_buff_pos));
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
if (!(length-=in_buff_length))
DBUG_RETURN(0);
pos+=in_buff_length;
buff+=in_buff_length;
}
else
in_buff_length=0;
if (flag & READING_NEXT)
{
if (pos != (info->pos_in_file +
(uint) (info->read_end - info->request_pos)))
{
info->pos_in_file=pos; /* Force start here */
info->read_pos=info->read_end=info->request_pos; /* Everything used */
info->seek_not_done=1;
}
else
info->read_pos=info->read_end; /* All block used */
if (!(*info->read_function)(info,buff,length))
DBUG_RETURN(0);
read_length=info->error;
}
else
{
info->seek_not_done=1;
if ((read_length=my_pread(info->file,buff,length,pos,MYF(0))) == length)
DBUG_RETURN(0);
}
if (!(flag & READING_HEADER) || (int) read_length == -1 ||
read_length+in_buff_length < 3)
{
DBUG_PRINT("error",
("Error %d reading next-multi-part block (Got %d bytes)",
my_errno, (int) read_length));
if (!my_errno || my_errno == -1)
my_errno=HA_ERR_WRONG_IN_RECORD;
DBUG_RETURN(1);
}
bzero(buff+read_length,MARIA_BLOCK_INFO_HEADER_LENGTH - in_buff_length -
read_length);
DBUG_RETURN(0);
} /* _ma_read_cache */
/* Copyright (C) 2006 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 */
/* Check if somebody has changed table since last check. */
#include "maria_def.h"
/* Return 0 if table isn't changed */
int maria_is_changed(MARIA_HA *info)
{
int result;
DBUG_ENTER("maria_is_changed");
if (fast_ma_readinfo(info))
DBUG_RETURN(-1);
VOID(_ma_writeinfo(info,0));
result=(int) info->data_changed;
info->data_changed=0;
DBUG_PRINT("exit",("result: %d",result));
DBUG_RETURN(result);
}
This diff is collapsed.
/* Copyright (C) 2006 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 */
/* Calculate a checksum for a row */
#include "maria_def.h"
ha_checksum _ma_checksum(MARIA_HA *info, const byte *buf)
{
uint i;
ha_checksum crc=0;
MARIA_COLUMNDEF *rec=info->s->rec;
for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
{
const byte *pos;
ulong length;
switch (rec->type) {
case FIELD_BLOB:
{
length= _ma_calc_blob_length(rec->length-
maria_portable_sizeof_char_ptr,
buf);
memcpy((char*) &pos, buf+rec->length- maria_portable_sizeof_char_ptr,
sizeof(char*));
break;
}
case FIELD_VARCHAR:
{
uint pack_length= HA_VARCHAR_PACKLENGTH(rec->length-1);
if (pack_length == 1)
length= (ulong) *(uchar*) buf;
else
length= uint2korr(buf);
pos= buf+pack_length;
break;
}
default:
length=rec->length;
pos=buf;
break;
}
crc=my_checksum(crc, pos ? pos : "", length);
}
return crc;
}
ha_checksum _ma_static_checksum(MARIA_HA *info, const byte *pos)
{
return my_checksum(0, pos, info->s->base.reclength);
}
/* Copyright (C) 2006 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 */
/* close a isam-database */
/*
TODO:
We need to have a separate mutex on the closed file to allow other threads
to open other files during the time we flush the cache and close this file
*/
#include "maria_def.h"
int maria_close(register MARIA_HA *info)
{
int error=0,flag;
MARIA_SHARE *share=info->s;
DBUG_ENTER("maria_close");
DBUG_PRINT("enter",("base: %lx reopen: %u locks: %u",
info,(uint) share->reopen, (uint) share->tot_locks));
pthread_mutex_lock(&THR_LOCK_maria);
if (info->lock_type == F_EXTRA_LCK)
info->lock_type=F_UNLCK; /* HA_EXTRA_NO_USER_CHANGE */
if (share->reopen == 1 && share->kfile >= 0)
_ma_decrement_open_count(info);
if (info->lock_type != F_UNLCK)
{
if (maria_lock_database(info,F_UNLCK))
error=my_errno;
}
pthread_mutex_lock(&share->intern_lock);
if (share->options & HA_OPTION_READ_ONLY_DATA)
{
share->r_locks--;
share->tot_locks--;
}
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
if (end_io_cache(&info->rec_cache))
error=my_errno;
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
}
flag= !--share->reopen;
maria_open_list=list_delete(maria_open_list,&info->open_list);
pthread_mutex_unlock(&share->intern_lock);
my_free(_ma_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
if (flag)
{
if (share->kfile >= 0 &&
flush_key_blocks(share->key_cache, share->kfile,
share->temporary ? FLUSH_IGNORE_CHANGED :
FLUSH_RELEASE))
error=my_errno;
if (share->kfile >= 0)
{
/*
If we are crashed, we can safely flush the current state as it will
not change the crashed state.
We can NOT write the state in other cases as other threads
may be using the file at this point
*/
if (share->mode != O_RDONLY && maria_is_crashed(info))
_ma_state_info_write(share->kfile, &share->state, 1);
if (my_close(share->kfile,MYF(0)))
error = my_errno;
}
#ifdef HAVE_MMAP
if (share->file_map)
_ma_unmap_file(info);
#endif
if (share->decode_trees)
{
my_free((gptr) share->decode_trees,MYF(0));
my_free((gptr) share->decode_tables,MYF(0));
}
#ifdef THREAD
thr_lock_delete(&share->lock);
VOID(pthread_mutex_destroy(&share->intern_lock));
{
int i,keys;
keys = share->state.header.keys;
VOID(rwlock_destroy(&share->mmap_lock));
for(i=0; i<keys; i++) {
VOID(rwlock_destroy(&share->key_root_lock[i]));
}
}
#endif
my_free((gptr) info->s,MYF(0));
}
pthread_mutex_unlock(&THR_LOCK_maria);
if (info->ftparser_param)
{
my_free((gptr)info->ftparser_param, MYF(0));
info->ftparser_param= 0;
}
if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
error = my_errno;
maria_log_command(MARIA_LOG_CLOSE,info,NULL,0,error);
my_free((gptr) info,MYF(0));
if (error)
{
DBUG_RETURN(my_errno=error);
}
DBUG_RETURN(0);
} /* maria_close */
This diff is collapsed.
/* Copyright (C) 2006 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 */
/* Support rutiner with are using with dbug */
#include "maria_def.h"
/* Print a key in user understandable format */
void _ma_print_key(FILE *stream, register HA_KEYSEG *keyseg,
const uchar *key, uint length)
{
int flag;
short int s_1;
long int l_1;
float f_1;
double d_1;
const uchar *end;
const uchar *key_end=key+length;
VOID(fputs("Key: \"",stream));
flag=0;
for (; keyseg->type && key < key_end ;keyseg++)
{
if (flag++)
VOID(putc('-',stream));
end= key+ keyseg->length;
if (keyseg->flag & HA_NULL_PART)
{
/* A NULL value is encoded by a 1-byte flag. Zero means NULL. */
if (! *(key++))
{
fprintf(stream,"NULL");
continue;
}
}
switch (keyseg->type) {
case HA_KEYTYPE_BINARY:
if (!(keyseg->flag & HA_SPACE_PACK) && keyseg->length == 1)
{ /* packed binary digit */
VOID(fprintf(stream,"%d",(uint) *key++));
break;
}
/* fall through */
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_NUM:
if (keyseg->flag & HA_SPACE_PACK)
{
VOID(fprintf(stream,"%.*s",(int) *key,key+1));
key+= (int) *key+1;
}
else
{
VOID(fprintf(stream,"%.*s",(int) keyseg->length,key));
key=end;
}
break;
case HA_KEYTYPE_INT8:
VOID(fprintf(stream,"%d",(int) *((signed char*) key)));
key=end;
break;
case HA_KEYTYPE_SHORT_INT:
s_1= mi_sint2korr(key);
VOID(fprintf(stream,"%d",(int) s_1));
key=end;
break;
case HA_KEYTYPE_USHORT_INT:
{
ushort u_1;
u_1= mi_uint2korr(key);
VOID(fprintf(stream,"%u",(uint) u_1));
key=end;
break;
}
case HA_KEYTYPE_LONG_INT:
l_1=mi_sint4korr(key);
VOID(fprintf(stream,"%ld",l_1));
key=end;
break;
case HA_KEYTYPE_ULONG_INT:
l_1=mi_sint4korr(key);
VOID(fprintf(stream,"%lu",(ulong) l_1));
key=end;
break;
case HA_KEYTYPE_INT24:
VOID(fprintf(stream,"%ld",(long) mi_sint3korr(key)));
key=end;
break;
case HA_KEYTYPE_UINT24:
VOID(fprintf(stream,"%lu",(ulong) mi_uint3korr(key)));
key=end;
break;
case HA_KEYTYPE_FLOAT:
mi_float4get(f_1,key);
VOID(fprintf(stream,"%g",(double) f_1));
key=end;
break;
case HA_KEYTYPE_DOUBLE:
mi_float8get(d_1,key);
VOID(fprintf(stream,"%g",d_1));
key=end;
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
{
char buff[21];
longlong2str(mi_sint8korr(key),buff,-10);
VOID(fprintf(stream,"%s",buff));
key=end;
break;
}
case HA_KEYTYPE_ULONGLONG:
{
char buff[21];
longlong2str(mi_sint8korr(key),buff,10);
VOID(fprintf(stream,"%s",buff));
key=end;
break;
}
case HA_KEYTYPE_BIT:
{
uint i;
fputs("0x",stream);
for (i=0 ; i < keyseg->length ; i++)
fprintf(stream, "%02x", (uint) *key++);
key= end;
break;
}
#endif
case HA_KEYTYPE_VARTEXT1: /* VARCHAR and TEXT */
case HA_KEYTYPE_VARTEXT2: /* VARCHAR and TEXT */
case HA_KEYTYPE_VARBINARY1: /* VARBINARY and BLOB */
case HA_KEYTYPE_VARBINARY2: /* VARBINARY and BLOB */
{
uint tmp_length;
get_key_length(tmp_length,key);
/*
The following command sometimes gives a warning from valgrind.
Not yet sure if the bug is in valgrind, glibc or mysqld
*/
VOID(fprintf(stream,"%.*s",(int) tmp_length,key));
key+=tmp_length;
break;
}
default: break; /* This never happens */
}
}
VOID(fputs("\"\n",stream));
return;
} /* print_key */
#ifdef EXTRA_DEBUG
my_bool _ma_check_table_is_closed(const char *name, const char *where)
{
char filename[FN_REFLEN];
LIST *pos;
DBUG_ENTER("_ma_check_table_is_closed");
(void) fn_format(filename,name,"",MARIA_NAME_IEXT,4+16+32);
for (pos=maria_open_list ; pos ; pos=pos->next)
{
MARIA_HA *info=(MARIA_HA*) pos->data;
MARIA_SHARE *share=info->s;
if (!strcmp(share->unique_file_name,filename))
{
if (share->last_version)
{
fprintf(stderr,"Warning: Table: %s is open on %s\n", name,where);
DBUG_PRINT("warning",("Table: %s is open on %s", name,where));
DBUG_RETURN(1);
}
}
}
DBUG_RETURN(0);
}
#endif /* EXTRA_DEBUG */
This diff is collapsed.
/* Copyright (C) 2006 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 */
/* Remove all rows from a MARIA table */
/* This clears the status information and truncates files */
#include "maria_def.h"
int maria_delete_all_rows(MARIA_HA *info)
{
uint i;
char buf[22];
MARIA_SHARE *share=info->s;
MARIA_STATE_INFO *state=&share->state;
DBUG_ENTER("maria_delete_all_rows");
if (share->options & HA_OPTION_READ_ONLY_DATA)
{
DBUG_RETURN(my_errno=EACCES);
}
if (_ma_readinfo(info,F_WRLCK,1))
DBUG_RETURN(my_errno);
if (_ma_mark_file_changed(info))
goto err;
info->state->records=info->state->del=state->split=0;
state->dellink = HA_OFFSET_ERROR;
state->sortkey= (ushort) ~0;
info->state->key_file_length=share->base.keystart;
info->state->data_file_length=0;
info->state->empty=info->state->key_empty=0;
info->state->checksum=0;
for (i=share->base.max_key_block_length/MARIA_MIN_KEY_BLOCK_LENGTH ; i-- ; )
state->key_del[i]= HA_OFFSET_ERROR;
for (i=0 ; i < share->base.keys ; i++)
state->key_root[i]= HA_OFFSET_ERROR;
maria_log_command(MARIA_LOG_DELETE_ALL,info,(byte*) 0,0,0);
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
*/
flush_key_blocks(share->key_cache, share->kfile, FLUSH_IGNORE_CHANGED);
if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
goto err;
VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
#ifdef HAVE_MMAP
/* Resize mmaped area */
rw_wrlock(&info->s->mmap_lock);
_ma_remap_file(info, (my_off_t)0);
rw_unlock(&info->s->mmap_lock);
#endif
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
err:
{
int save_errno=my_errno;
VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno);
}
} /* maria_delete */
/* Copyright (C) 2006 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 */
/*
deletes a table
*/
#include "ma_fulltext.h"
int maria_delete_table(const char *name)
{
char from[FN_REFLEN];
#ifdef USE_RAID
uint raid_type=0,raid_chunks=0;
#endif
DBUG_ENTER("maria_delete_table");
#ifdef EXTRA_DEBUG
_ma_check_table_is_closed(name,"delete");
#endif
#ifdef USE_RAID
{
MARIA_HA *info;
/* we use 'open_for_repair' to be able to delete a crashed table */
if (!(info=maria_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR)))
DBUG_RETURN(my_errno);
raid_type = info->s->base.raid_type;
raid_chunks = info->s->base.raid_chunks;
maria_close(info);
}
#ifdef EXTRA_DEBUG
_ma_check_table_is_closed(name,"delete");
#endif
#endif /* USE_RAID */
fn_format(from,name,"",MARIA_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
if (my_delete_with_symlink(from, MYF(MY_WME)))
DBUG_RETURN(my_errno);
fn_format(from,name,"",MARIA_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
#ifdef USE_RAID
if (raid_type)
DBUG_RETURN(my_raid_delete(from, raid_chunks, MYF(MY_WME)) ? my_errno : 0);
#endif
DBUG_RETURN(my_delete_with_symlink(from, MYF(MY_WME)) ? my_errno : 0);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment