Commit 00bd872d authored by brian@brian-akers-computer.local's avatar brian@brian-akers-computer.local

Resolving merge issues between archive and most recent changes by Monty/NDB

parents fdaf6d42 467cad0b
...@@ -25,6 +25,7 @@ bell@laptop.sanja.is.com.ua ...@@ -25,6 +25,7 @@ bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua bell@sanja.is.com.ua
bk@admin.bk bk@admin.bk
bk@mysql.r18.ru bk@mysql.r18.ru
brian@avenger.(none)
brian@brian-akers-computer.local brian@brian-akers-computer.local
carsten@tsort.bitbybit.dk carsten@tsort.bitbybit.dk
davida@isil.mysql.com davida@isil.mysql.com
......
...@@ -115,6 +115,9 @@ ...@@ -115,6 +115,9 @@
/* Builds Example DB */ /* Builds Example DB */
#undef HAVE_EXAMPLE_DB #undef HAVE_EXAMPLE_DB
/* Builds Archive Storage Engine */
#undef HAVE_ARCHIVE_DB
/* fp_except from ieeefp.h */ /* fp_except from ieeefp.h */
#undef HAVE_FP_EXCEPT #undef HAVE_FP_EXCEPT
......
...@@ -1332,6 +1332,36 @@ dnl --------------------------------------------------------------------------- ...@@ -1332,6 +1332,36 @@ dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_EXAMPLE SECTION dnl END OF MYSQL_CHECK_EXAMPLE SECTION
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_ARCHIVEDB
dnl Sets HAVE_ARCHIVE_DB if --with-archive-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_ARCHIVEDB], [
AC_ARG_WITH([archive-storage-engine],
[
--with-archive-storage-engine
Enable the Archive Storge Engine],
[archivedb="$withval"],
[archivedb=no])
AC_MSG_CHECKING([for archive storage engine])
case "$archivedb" in
yes )
AC_DEFINE(HAVE_ARCHIVE_DB)
AC_MSG_RESULT([yes])
[archivedb=yes]
;;
* )
AC_MSG_RESULT([no])
[archivedb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_ARCHIVE SECTION
dnl ---------------------------------------------------------------------------
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_NDBCLUSTER dnl Macro: MYSQL_CHECK_NDBCLUSTER
dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
......
...@@ -1851,8 +1851,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \ ...@@ -1851,8 +1851,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
# isinf() could be a function or a macro (HPUX) # isinf() could be a function or a macro (HPUX)
AC_MSG_CHECKING(for isinf with <math.h>) AC_MSG_CHECKING(for isinf with <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)], AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]),
AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]),
AC_MSG_RESULT(no)) AC_MSG_RESULT(no))
CFLAGS="$ORG_CFLAGS" CFLAGS="$ORG_CFLAGS"
...@@ -2229,6 +2228,7 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then ...@@ -2229,6 +2228,7 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
# For NetWare, do not need readline # For NetWare, do not need readline
echo "Skipping readline" echo "Skipping readline"
else else
mkdir include/readline
if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"] if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
then then
...@@ -2236,7 +2236,7 @@ then ...@@ -2236,7 +2236,7 @@ then
readline_basedir="libedit" readline_basedir="libedit"
readline_dir="$readline_topdir/$readline_basedir" readline_dir="$readline_topdir/$readline_basedir"
readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a" readline_link="\$(top_builddir)/cmd-line-utils/libedit/liblibedit.a"
readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/libedit/readline readline" readline_h_ln_cmd="\$(LN) \$(top_builddir)/cmd-line-utils/libedit/readline/*.h readline/"
compile_libedit=yes compile_libedit=yes
AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE) AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE)
elif test "$with_readline" = "yes" elif test "$with_readline" = "yes"
...@@ -2245,7 +2245,7 @@ then ...@@ -2245,7 +2245,7 @@ then
readline_basedir="readline" readline_basedir="readline"
readline_dir="$readline_topdir/$readline_basedir" readline_dir="$readline_topdir/$readline_basedir"
readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a" readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
readline_h_ln_cmd="\$(LN) -s \$(top_builddir)/cmd-line-utils/readline readline" readline_h_ln_cmd="\$(LN) \$(top_builddir)/cmd-line-utils/readline/*.h readline/"
compile_readline=yes compile_readline=yes
AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE) AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE)
else else
...@@ -2619,6 +2619,7 @@ MYSQL_CHECK_ISAM ...@@ -2619,6 +2619,7 @@ MYSQL_CHECK_ISAM
MYSQL_CHECK_BDB MYSQL_CHECK_BDB
MYSQL_CHECK_INNODB MYSQL_CHECK_INNODB
MYSQL_CHECK_EXAMPLEDB MYSQL_CHECK_EXAMPLEDB
MYSQL_CHECK_ARCHIVEDB
MYSQL_CHECK_NDBCLUSTER MYSQL_CHECK_NDBCLUSTER
# If we have threads generate some library functions and test programs # If we have threads generate some library functions and test programs
...@@ -2758,7 +2759,6 @@ EOF ...@@ -2758,7 +2759,6 @@ EOF
no) flag="-R" ;; no) flag="-R" ;;
*) flag="-D" ;; *) flag="-D" ;;
esac esac
flag="$flag --VERSION=$VERSION --PACKAGE=$PACKAGE"
(cd ndb && ./configure $flag) \ (cd ndb && ./configure $flag) \
|| AC_MSG_ERROR([could not configure NDB Cluster]) || AC_MSG_ERROR([could not configure NDB Cluster])
echo "END OF NDB CLUSTER CONFIGURATION" echo "END OF NDB CLUSTER CONFIGURATION"
......
...@@ -16,11 +16,12 @@ ...@@ -16,11 +16,12 @@
#called from the top level Makefile #called from the top level Makefile
MYSQLDATAdir = $(localstatedir) MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir) MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix) MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ \ INCLUDES = @MT_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \ @bdb_includes@ @innodb_includes@ \
-I$(top_srcdir)/include -I$(top_srcdir)/regex \ -I$(top_srcdir)/include -I$(top_srcdir)/regex \
-I$(srcdir) $(openssl_includes) -I$(srcdir) $(openssl_includes)
WRAPLIBS= @WRAPLIBS@ WRAPLIBS= @WRAPLIBS@
...@@ -41,7 +42,6 @@ LDADD = @isam_libs@ \ ...@@ -41,7 +42,6 @@ LDADD = @isam_libs@ \
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \ @bdb_libs@ @innodb_libs@ @pstack_libs@ \
@innodb_system_libs@ \ @innodb_system_libs@ \
@ndbcluster_libs@ @ndbcluster_system_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@
noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_strfunc.h item_timefunc.h item_uniq.h \ item_strfunc.h item_timefunc.h item_uniq.h \
...@@ -52,13 +52,13 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ ...@@ -52,13 +52,13 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
field.h handler.h \ field.h handler.h \
ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_isammrg.h ha_isam.h ha_myisammrg.h\
ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \
ha_ndbcluster.h opt_range.h protocol.h \ opt_range.h protocol.h \
sql_select.h structs.h table.h sql_udf.h hash_filo.h\ sql_select.h structs.h table.h sql_udf.h hash_filo.h\
lex.h lex_symbol.h sql_acl.h sql_crypt.h \ lex.h lex_symbol.h sql_acl.h sql_crypt.h \
log_event.h sql_repl.h slave.h \ log_event.h sql_repl.h slave.h \
stacktrace.h sql_sort.h sql_cache.h set_var.h \ stacktrace.h sql_sort.h sql_cache.h set_var.h \
spatial.h gstream.h client_settings.h \ spatial.h gstream.h client_settings.h \
examples/ha_example.h examples/ha_example.h examples/ha_archive.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc \ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
...@@ -76,11 +76,11 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ ...@@ -76,11 +76,11 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
procedure.cc item_uniq.cc sql_test.cc \ procedure.cc item_uniq.cc sql_test.cc \
log.cc log_event.cc init.cc derror.cc sql_acl.cc \ log.cc log_event.cc init.cc derror.cc sql_acl.cc \
unireg.cc des_key_file.cc \ unireg.cc des_key_file.cc \
discover.cc time.cc opt_range.cc opt_sum.cc \ time.cc opt_range.cc opt_sum.cc \
records.cc filesort.cc handler.cc \ records.cc filesort.cc handler.cc \
ha_heap.cc ha_myisam.cc ha_myisammrg.cc \ ha_heap.cc ha_myisam.cc ha_myisammrg.cc \
ha_berkeley.cc ha_innodb.cc \ ha_berkeley.cc ha_innodb.cc \
ha_isam.cc ha_isammrg.cc ha_ndbcluster.cc \ ha_isam.cc ha_isammrg.cc \
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \ sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
...@@ -88,7 +88,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ ...@@ -88,7 +88,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
client.c sql_client.cc mini_client_errors.c pack.c\ client.c sql_client.cc mini_client_errors.c pack.c\
stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\ stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc\
gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \
examples/ha_example.cc examples/ha_example.cc examples/ha_archive.cc
gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
......
/* 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; 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 __GNUC__
#pragma implementation // gcc: Class implementation
#endif
#include <mysql_priv.h>
#ifdef HAVE_ARCHIVE_DB
#include "ha_archive.h"
/*
First, if you want to understand storage engines you should look at
ha_example.cc and ha_example.h.
This example was written as a test case for a customer who needed
a storage engine without indexes that could compress data very well.
So, welcome to a completely compressed storage engine. This storage
engine only does inserts. No replace or updates. All reads are
complete table scans. Compression is done through gzip (bzip compresses
better, but only marginally, if someone asks I could add support for
it too, but beaware that it costs a lot more in CPU time then gzip).
We keep a file pointer open for each instance of ha_archive for each read
but for writes we keep one open file handle just for that. We flush it
only if we have a read occur. gzip handles compressing lots of records
at once much better then doing lots of little records between writes.
It is possible to not lock on writes but this would then mean we couldn't
handle bulk inserts as well (that is if someone was trying to read at
the same time since we would want to flush).
No attempts at durability are made. You can corrupt your data.
For performance as far as table scans go it is quite fast. I don't have
good numbers but locally it has out performed both Innodb and MyISAM. For
Innodb the question will be if the table can be fit into the buffer
pool. For MyISAM its a question of how much the file system caches the
MyISAM file. With enough free memory MyISAM is faster. Its only when the OS
doesn't have enough memory to cache entire table that archive turns out
to be any faster. For writes it is always a bit slower then MyISAM. It has no
internal limits though for row length.
TODO:
Add bzip optional support.
Allow users to set compression level.
Add truncate table command.
Implement versioning, should be easy.
Implement optimize so we can fix broken tables.
Allow for errors, find a way to mark bad rows.
See if during an optimize you can make the table smaller.
Talk to the gzip guys, come up with a writable format so that updates are doable
without switching to a block method.
-Brian
*/
/* Variables for archive share methods */
pthread_mutex_t archive_mutex;
static HASH archive_open_tables;
static int archive_init= 0;
/* The file extension */
#define ARZ ".ARZ"
/*
Used for hash table that tracks open tables.
*/
static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
return (byte*) share->table_name;
}
/*
Example of simple lock controls.
See ha_example.cc for a description.
*/
static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table)
{
ARCHIVE_SHARE *share;
uint length;
char *tmp_name;
if (!archive_init)
{
/* Hijack a mutex for init'ing the storage engine */
pthread_mutex_lock(&LOCK_mysql_create_db);
if (!archive_init)
{
archive_init++;
VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&archive_open_tables,system_charset_info,32,0,0,
(hash_get_key) archive_get_key,0,0);
}
pthread_mutex_unlock(&LOCK_mysql_create_db);
}
pthread_mutex_lock(&archive_mutex);
length=(uint) strlen(table_name);
if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables,
(byte*) table_name,
length)))
{
if (!(share=(ARCHIVE_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share),
&tmp_name, length+1,
NullS)))
{
pthread_mutex_unlock(&archive_mutex);
return NULL;
}
share->use_count=0;
share->table_name_length=length;
share->table_name=tmp_name;
fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME);
strmov(share->table_name,table_name);
if (my_hash_insert(&archive_open_tables, (byte*) share))
goto error;
/*
It is expensive to open and close the data files and since you can'thave
a gzip file that can be both read and written we keep two files open
that are shared amoung all open tables.
*/
if ((share->archive_write = gzopen(share->data_file_name, "ab")) == NULL)
goto error;
thr_lock_init(&share->lock);
if (pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST))
goto error2;
}
share->use_count++;
pthread_mutex_unlock(&archive_mutex);
return share;
error2:
thr_lock_delete(&share->lock);
/* We close, but ignore errors since we already have errors */
(void)gzclose(share->archive_write);
error:
pthread_mutex_unlock(&archive_mutex);
my_free((gptr) share, MYF(0));
return NULL;
}
/*
Free lock controls.
See ha_example.cc for a description.
*/
static int free_share(ARCHIVE_SHARE *share)
{
int rc= 0;
pthread_mutex_lock(&archive_mutex);
if (!--share->use_count)
{
hash_delete(&archive_open_tables, (byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
my_free((gptr) share, MYF(0));
if (gzclose(share->archive_write) == Z_ERRNO)
rc = -1;
}
pthread_mutex_unlock(&archive_mutex);
return rc;
}
/*
We just implement one additional file extension.
*/
const char **ha_archive::bas_ext() const
{ static const char *ext[]= { ARZ, NullS }; return ext; }
/*
When opening a file we:
Create/get our shared structure.
Init out lock.
We open the file we will read from.
Set the size of ref_length.
*/
int ha_archive::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_archive::open");
if (!(share = get_share(name, table)))
DBUG_RETURN(1);
thr_lock_data_init(&share->lock,&lock,NULL);
if ((archive = gzopen(share->data_file_name, "rb")) == NULL)
DBUG_RETURN(-1);
DBUG_RETURN(0);
}
/*
Closes the file. We first close this storage engines file handle to the
archive and then remove our referece count to the table (and possibly
free it as well).
*/
int ha_archive::close(void)
{
DBUG_ENTER("ha_archive::close");
int rc= 0;
if (gzclose(archive) == Z_ERRNO)
rc =-1;
rc |= free_share(share);
DBUG_RETURN();
}
/*
We create our data file here. The format is pretty simple. The first bytes in
any file are the version number. Currently we do nothing with this, but in
the future this gives us the ability to figure out version if we change the
format at all. After the version we starting writing our rows. Unlike other
storage engines we do not "pack" our data. Since we are about to do a general
compression, packing would just be a waste of CPU time. If the table has blobs
they are written after the row in the order of creation.
So to read a row we:
Read the version
Read the record and copy it into buf
Loop through any blobs and read them
*/
int ha_archive::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info)
{
File create_file;
char name_buff[FN_REFLEN];
size_t written;
DBUG_ENTER("ha_archive::create");
if ((create_file = my_create(fn_format(name_buff,name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME),0,
O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
DBUG_RETURN(-1);
if ((archive = gzdopen(create_file, "ab")) == NULL)
DBUG_RETURN(-1);
version = ARCHIVE_VERSION;
written = gzwrite(archive, &version, sizeof(version));
if (written == 0 || written != sizeof(version))
DBUG_RETURN(-1);
gzclose(archive);
(void)my_close(create_file,MYF(0));
DBUG_RETURN(0);
}
/*
Looop at ha_archive::open() for an explanation of the row format.
Here we just write out the row.
*/
int ha_archive::write_row(byte * buf)
{
char *pos;
z_off_t written;
DBUG_ENTER("ha_archive::write_row");
statistic_increment(ha_write_count,&LOCK_status);
if (table->timestamp_default_now)
update_timestamp(record+table->timestamp_default_now-1);
written = gzwrite(share->archive_write, buf, table->reclength);
share->dirty= true;
if (written == 0 || written != table->reclength)
DBUG_RETURN(-1);
for (Field_blob **field=table->blob_field ; *field ; field++)
{
char *ptr;
uint32 size= (*field)->get_length();
(*field)->get_ptr(&ptr);
written = gzwrite(share->archive_write, ptr, (unsigned)size);
if (written == 0 || written != size)
DBUG_RETURN(-1);
}
DBUG_RETURN(0);
}
/*
All calls that need to scan the table start with this method. If we are told
that it is a table scan we rewind the file to the beginning, otherwise
we assume the position will be set.
*/
int ha_archive::rnd_init(bool scan)
{
DBUG_ENTER("ha_archive::rnd_init");
int read; // gzread() returns int, and we use this to check the header
/* We rewind the file so that we can read from the beginning if scan */
if(scan)
if (gzrewind(archive))
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
/*
If dirty, we lock, and then reset/flush the data.
I found that just calling gzflush() doesn't always work.
*/
if (share->dirty == true)
{
pthread_mutex_lock(&share->mutex);
if (share->dirty == true)
{
gzclose(share->archive_write);
if ((share->archive_write = gzopen(share->data_file_name, "ab")) == NULL)
{
pthread_mutex_unlock(&share->mutex);
DBUG_RETURN(-1);
}
share->dirty= false;
}
pthread_mutex_unlock(&share->mutex);
}
/*
At the moment we just check the size of version to make sure the header is
intact.
*/
read= gzread(archive, &version, sizeof(version));
if (written == 0 || written != sizeof(version))
DBUG_RETURN(-1);
records = 0;
DBUG_RETURN(0);
}
/*
This is the method that is used to read a row. It assumes that the row is
positioned where you want it.
*/
int ha_archive::read_row(byte *buf)
{
int read; // Bytes read, gzread() returns int
char *last;
size_t total_blob_length= 0;
DBUG_ENTER("ha_archive::read_row");
read = gzread(archive, buf, table->reclength);
/* If we read nothing we are at the end of the file */
if (read == 0)
DBUG_RETURN(HA_ERR_END_OF_FILE);
/* If the record is the wrong size, the file is probably damaged */
if (read != table->reclength)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
/* Calculate blob length, we use this for our buffer */
for (Field_blob **field=table->blob_field; *field ; field++)
total_blob_length += (*field)->get_length();
/* Adjust our row buffer if we need be */
buffer.alloc(total_blob_length);
last = (char *)buffer.ptr();
/* Loopp through our blobs and read them */
for (Field_blob **field=table->blob_field; *field ; field++)
{
/* Need to setup buffer tomorrow so that it is sued to contain all blobs */
size_t size= (*field)->get_length();
read = gzread(archive, last, size);
if (read == 0 || read != size)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
(*field)->set_ptr(size, last);
last += size;
}
DBUG_RETURN(0);
}
/*
Called during ORDER BY. Its position is either from being called sequentially
or by having had ha_archive::rnd_pos() called before it is called.
*/
int ha_archive::rnd_next(byte *buf)
{
DBUG_ENTER("ha_archive::rnd_next");
int rc;
statistic_increment(ha_read_rnd_next_count,&LOCK_status);
current_position = gztell(archive);
rc = read_row(buf);
if (!(HA_ERR_END_OF_FILE == rc))
records++;
DBUG_RETURN(rc);
}
/*
Thanks to the table flag HA_REC_NOT_IN_SEQ this will be called after
each call to ha_archive::rnd_next() if an ordering of the rows is
needed.
*/
void ha_archive::position(const byte *record)
{
DBUG_ENTER("ha_archive::position");
ha_store_ptr(ref, ref_length, current_position);
DBUG_VOID_RETURN;
}
/*
This is called after a table scan for each row if the results of the scan need
to be ordered. It will take *pos and use it to move the cursor in the file so
that the next row that is called is the correctly ordered row.
*/
int ha_archive::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_archive::rnd_pos");
statistic_increment(ha_read_rnd_count,&LOCK_status);
current_position = ha_get_ptr(pos, ref_length);
z_off_t seek= gzseek(archive, current_position, SEEK_SET);
DBUG_RETURN(read_row(buf));
}
/******************************************************************************
Everything below here is default, please look at ha_example.cc for
descriptions.
******************************************************************************/
int ha_archive::update_row(const byte * old_data, byte * new_data)
{
DBUG_ENTER("ha_archive::update_row");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::delete_row(const byte * buf)
{
DBUG_ENTER("ha_archive::delete_row");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_read(byte * buf, const byte * key,
uint key_len __attribute__((unused)),
enum ha_rkey_function find_flag
__attribute__((unused)))
{
DBUG_ENTER("ha_archive::index_read");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len __attribute__((unused)),
enum ha_rkey_function find_flag
__attribute__((unused)))
{
DBUG_ENTER("ha_archive::index_read_idx");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_next(byte * buf)
{
DBUG_ENTER("ha_archive::index_next");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_prev(byte * buf)
{
DBUG_ENTER("ha_archive::index_prev");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_first(byte * buf)
{
DBUG_ENTER("ha_archive::index_first");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
int ha_archive::index_last(byte * buf)
{
DBUG_ENTER("ha_archive::index_last");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
void ha_archive::info(uint flag)
{
DBUG_ENTER("ha_archive::info");
/* This is a lie, but you don't want the optimizer to see zero or 1 */
if (records < 2)
records = 2;
DBUG_VOID_RETURN;
}
int ha_archive::extra(enum ha_extra_function operation)
{
DBUG_ENTER("ha_archive::extra");
DBUG_RETURN(0);
}
int ha_archive::reset(void)
{
DBUG_ENTER("ha_archive::reset");
DBUG_RETURN(0);
}
int ha_archive::external_lock(THD *thd, int lock_type)
{
DBUG_ENTER("ha_archive::external_lock");
DBUG_RETURN(0);
}
THR_LOCK_DATA **ha_archive::store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
{
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
lock.type=lock_type;
*to++= &lock;
return to;
}
ha_rows ha_archive::records_in_range(int inx,
const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag)
{
DBUG_ENTER("ha_archive::records_in_range ");
DBUG_RETURN(records); // HA_ERR_NOT_IMPLEMENTED
}
#endif /* HAVE_ARCHIVE_DB */
/* 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; 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 */
#include <zlib.h>
/*
Please read ha_archive.cc first. If you are looking for more general
answers on how storage engines work, look at ha_example.cc and
ha_example.h.
*/
typedef struct st_archive_share {
char *table_name;
char data_file_name[FN_REFLEN];
uint table_name_length,use_count;
pthread_mutex_t mutex;
THR_LOCK lock;
gzFile archive_write; /* Archive file we are working with */
bool dirty; /* Flag for if a flush should occur */
} ARCHIVE_SHARE;
/*
Version for file format.
1 - Initial Version
*/
#define ARCHIVE_VERSION 1
class ha_archive: public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
ARCHIVE_SHARE *share; /* Shared lock info */
gzFile archive; /* Archive file we are working with */
z_off_t current_position; /* The position of the row we just read */
byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
String buffer; /* Buffer used for blob storage */
unsigned int version; /* Used for recording version */
public:
ha_archive(TABLE *table): handler(table)
{
/* Set our original buffer from pre-allocated memory */
buffer.set(byte_buffer, IO_SIZE, system_charset_info);
/* The size of the offset value we will use for position() */
ref_length = sizeof(z_off_t);
}
~ha_archive()
{
}
const char *table_type() const { return "ARCHIVE"; }
const char *index_type(uint inx) { return "NONE"; }
const char **bas_ext() const;
ulong table_flags() const
{
return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_NO_WRITE_DELAYED |
HA_NO_AUTO_INCREMENT );
}
ulong index_flags(uint inx) const
{
return 0;
}
/*
This is just a default, there is no real limit as far as
archive is concerned.
*/
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; }
uint max_key_length() const { return 0; }
/*
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time() { return (double) (records+deleted) / 20.0+10; }
/* The next method will never be called */
virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; }
virtual bool fast_key_read() { return 1;}
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_next(byte * buf);
int index_prev(byte * buf);
int index_first(byte * buf);
int index_last(byte * buf);
int rnd_init(bool scan=1);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
int ha_archive::read_row(byte *buf);
void position(const byte *record);
void info(uint);
int extra(enum ha_extra_function operation);
int reset(void);
int external_lock(THD *thd, int lock_type);
ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag);
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);
};
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
#ifdef HAVE_EXAMPLE_DB #ifdef HAVE_EXAMPLE_DB
#include "examples/ha_example.h" #include "examples/ha_example.h"
#endif #endif
#ifdef HAVE_ARCHIVE_DB
#include "examples/ha_archive.h"
#endif
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
#include "ha_innodb.h" #include "ha_innodb.h"
#else #else
#define innobase_query_caching_of_table_permitted(X,Y,Z) 1 #define innobase_query_caching_of_table_permitted(X,Y,Z) 1
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB
#include "ha_ndbcluster.h"
#endif
#include <myisampack.h> #include <myisampack.h>
#include <errno.h> #include <errno.h>
...@@ -54,7 +54,7 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ...@@ -54,7 +54,7 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
ha_read_key_count, ha_read_next_count, ha_read_prev_count, ha_read_key_count, ha_read_next_count, ha_read_prev_count,
ha_read_first_count, ha_read_last_count, ha_read_first_count, ha_read_last_count,
ha_commit_count, ha_rollback_count, ha_commit_count, ha_rollback_count,
ha_read_rnd_count, ha_read_rnd_next_count, ha_discover_count; ha_read_rnd_count, ha_read_rnd_next_count;
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES; static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
...@@ -82,12 +82,10 @@ struct show_table_type_st sys_table_types[]= ...@@ -82,12 +82,10 @@ struct show_table_type_st sys_table_types[]=
"Supports transactions and page-level locking", DB_TYPE_BERKELEY_DB}, "Supports transactions and page-level locking", DB_TYPE_BERKELEY_DB},
{"BERKELEYDB",&have_berkeley_db, {"BERKELEYDB",&have_berkeley_db,
"Alias for BDB", DB_TYPE_BERKELEY_DB}, "Alias for BDB", DB_TYPE_BERKELEY_DB},
{"NDBCLUSTER", &have_ndbcluster,
"Clustered, fault tolerant memory based tables", DB_TYPE_NDBCLUSTER},
{"NDB", &have_ndbcluster,
"Alias for NDBCLUSTER", DB_TYPE_NDBCLUSTER},
{"EXAMPLE",&have_example_db, {"EXAMPLE",&have_example_db,
"Example storage engine", DB_TYPE_EXAMPLE_DB}, "Example storage engine", DB_TYPE_EXAMPLE_DB},
{"ARCHIVE",&have_archive_db,
"Archive storage engine", DB_TYPE_ARCHIVE_DB},
{NullS, NULL, NullS, DB_TYPE_UNKNOWN} {NullS, NULL, NullS, DB_TYPE_UNKNOWN}
}; };
...@@ -103,16 +101,15 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", ...@@ -103,16 +101,15 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
enum db_type ha_resolve_by_name(const char *name, uint namelen) enum db_type ha_resolve_by_name(const char *name, uint namelen)
{ {
THD *thd=current_thd; if (!my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) {
if (thd && !my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) { return(enum db_type) current_thd->variables.table_type;
return (enum db_type) thd->variables.table_type;
} }
show_table_type_st *types; show_table_type_st *types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
if (!my_strcasecmp(&my_charset_latin1, name, types->type)) if (!my_strcasecmp(&my_charset_latin1, name, types->type))
return (enum db_type) types->db_type; return(enum db_type)types->db_type;
} }
return DB_TYPE_UNKNOWN; return DB_TYPE_UNKNOWN;
} }
...@@ -189,9 +186,9 @@ handler *get_new_handler(TABLE *table, enum db_type db_type) ...@@ -189,9 +186,9 @@ handler *get_new_handler(TABLE *table, enum db_type db_type)
case DB_TYPE_EXAMPLE_DB: case DB_TYPE_EXAMPLE_DB:
return new ha_example(table); return new ha_example(table);
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_ARCHIVE_DB
case DB_TYPE_NDBCLUSTER: case DB_TYPE_ARCHIVE_DB:
return new ha_ndbcluster(table); return new ha_archive(table);
#endif #endif
case DB_TYPE_HEAP: case DB_TYPE_HEAP:
return new ha_heap(table); return new ha_heap(table);
...@@ -236,18 +233,6 @@ int ha_init() ...@@ -236,18 +233,6 @@ int ha_init()
else else
opt_using_transactions=1; opt_using_transactions=1;
} }
#endif
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
{
if (ndbcluster_init())
{
have_ndbcluster= SHOW_OPTION_DISABLED;
error= 1;
}
else
opt_using_transactions=1;
}
#endif #endif
return error; return error;
} }
...@@ -275,10 +260,6 @@ int ha_panic(enum ha_panic_function flag) ...@@ -275,10 +260,6 @@ int ha_panic(enum ha_panic_function flag)
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
if (have_innodb == SHOW_OPTION_YES) if (have_innodb == SHOW_OPTION_YES)
error|=innobase_end(); error|=innobase_end();
#endif
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
error|=ndbcluster_end();
#endif #endif
return error; return error;
} /* ha_panic */ } /* ha_panic */
...@@ -289,10 +270,6 @@ void ha_drop_database(char* path) ...@@ -289,10 +270,6 @@ void ha_drop_database(char* path)
if (have_innodb == SHOW_OPTION_YES) if (have_innodb == SHOW_OPTION_YES)
innobase_drop_database(path); innobase_drop_database(path);
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
ndbcluster_drop_database(path);
#endif
} }
void ha_close_connection(THD* thd) void ha_close_connection(THD* thd)
...@@ -301,10 +278,6 @@ void ha_close_connection(THD* thd) ...@@ -301,10 +278,6 @@ void ha_close_connection(THD* thd)
if (have_innodb == SHOW_OPTION_YES) if (have_innodb == SHOW_OPTION_YES)
innobase_close_connection(thd); innobase_close_connection(thd);
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
ndbcluster_close_connection(thd);
#endif
} }
/* /*
...@@ -464,19 +437,6 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) ...@@ -464,19 +437,6 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
WRITE_CACHE, (my_off_t) 0, 0, 1); WRITE_CACHE, (my_off_t) 0, 0, 1);
thd->transaction.trans_log.end_of_file= max_binlog_cache_size; thd->transaction.trans_log.end_of_file= max_binlog_cache_size;
} }
#ifdef HAVE_NDBCLUSTER_DB
if (trans->ndb_tid)
{
if ((error=ndbcluster_commit(thd,trans->ndb_tid)))
{
my_error(ER_ERROR_DURING_COMMIT, MYF(0), error);
error=1;
}
if (trans == &thd->transaction.all)
operation_done= transaction_commited= 1;
trans->ndb_tid=0;
}
#endif
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
if (trans->bdb_tid) if (trans->bdb_tid)
{ {
...@@ -530,18 +490,6 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) ...@@ -530,18 +490,6 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
if (opt_using_transactions) if (opt_using_transactions)
{ {
bool operation_done=0; bool operation_done=0;
#ifdef HAVE_NDBCLUSTER_DB
if (trans->ndb_tid)
{
if ((error=ndbcluster_rollback(thd, trans->ndb_tid)))
{
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error);
error=1;
}
trans->ndb_tid = 0;
operation_done=1;
}
#endif
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
if (trans->bdb_tid) if (trans->bdb_tid)
{ {
...@@ -1185,7 +1133,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen) ...@@ -1185,7 +1133,7 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
int error; int error;
if (!(error=index_next(buf))) if (!(error=index_next(buf)))
{ {
if (key_cmp_if_same(table, key, active_index, keylen)) if (key_cmp(table, key, active_index, keylen))
{ {
table->status=STATUS_NOT_FOUND; table->status=STATUS_NOT_FOUND;
error=HA_ERR_END_OF_FILE; error=HA_ERR_END_OF_FILE;
...@@ -1221,10 +1169,8 @@ bool handler::caching_allowed(THD* thd, char* table_key, ...@@ -1221,10 +1169,8 @@ bool handler::caching_allowed(THD* thd, char* table_key,
** Some general functions that isn't in the handler class ** Some general functions that isn't in the handler class
****************************************************************************/ ****************************************************************************/
/* /* Initiates table-file and calls apropriate database-creator */
Initiates table-file and calls apropriate database-creator /* Returns 1 if something got wrong */
Returns 1 if something got wrong
*/
int ha_create_table(const char *name, HA_CREATE_INFO *create_info, int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
bool update_create_info) bool update_create_info)
...@@ -1240,7 +1186,7 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, ...@@ -1240,7 +1186,7 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
{ {
update_create_info_from_table(create_info, &table); update_create_info_from_table(create_info, &table);
if (table.file->table_flags() & HA_DROP_BEFORE_CREATE) if (table.file->table_flags() & HA_DROP_BEFORE_CREATE)
table.file->delete_table(name); table.file->delete_table(name); // Needed for BDB tables
} }
if (lower_case_table_names == 2 && if (lower_case_table_names == 2 &&
!(table.file->table_flags() & HA_FILE_BASED)) !(table.file->table_flags() & HA_FILE_BASED))
...@@ -1361,26 +1307,6 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache, ...@@ -1361,26 +1307,6 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
} }
/*
Try to discover one table from handler(s)
*/
int ha_discover(const char* dbname, const char* name,
const void** frmblob, uint* frmlen)
{
int error= 1; // Table does not exist in any handler
DBUG_ENTER("ha_discover");
DBUG_PRINT("enter", ("db: %s, name: %s", dbname, name));
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
error= ndbcluster_discover(dbname, name, frmblob, frmlen);
#endif
if (!error)
statistic_increment(ha_discover_count,&LOCK_status);
DBUG_RETURN(error);
}
/* /*
Read first row between two ranges. Read first row between two ranges.
Store ranges for future calls to read_range_next Store ranges for future calls to read_range_next
...@@ -1389,7 +1315,6 @@ int ha_discover(const char* dbname, const char* name, ...@@ -1389,7 +1315,6 @@ int ha_discover(const char* dbname, const char* name,
read_range_first() read_range_first()
start_key Start key. Is 0 if no min range start_key Start key. Is 0 if no min range
end_key End key. Is 0 if no max range end_key End key. Is 0 if no max range
eq_range_arg Set to 1 if start_key == end_key
sorted Set to 1 if result should be sorted per key sorted Set to 1 if result should be sorted per key
NOTES NOTES
...@@ -1403,12 +1328,11 @@ int ha_discover(const char* dbname, const char* name, ...@@ -1403,12 +1328,11 @@ int ha_discover(const char* dbname, const char* name,
int handler::read_range_first(const key_range *start_key, int handler::read_range_first(const key_range *start_key,
const key_range *end_key, const key_range *end_key,
bool eq_range_arg, bool sorted) bool sorted)
{ {
int result; int result;
DBUG_ENTER("handler::read_range_first"); DBUG_ENTER("handler::read_range_first");
eq_range= eq_range_arg;
end_range= 0; end_range= 0;
if (end_key) if (end_key)
{ {
...@@ -1419,6 +1343,7 @@ int handler::read_range_first(const key_range *start_key, ...@@ -1419,6 +1343,7 @@ int handler::read_range_first(const key_range *start_key,
} }
range_key_part= table->key_info[active_index].key_part; range_key_part= table->key_info[active_index].key_part;
if (!start_key) // Read first record if (!start_key) // Read first record
result= index_first(table->record[0]); result= index_first(table->record[0]);
else else
...@@ -1440,6 +1365,7 @@ int handler::read_range_first(const key_range *start_key, ...@@ -1440,6 +1365,7 @@ int handler::read_range_first(const key_range *start_key,
SYNOPSIS SYNOPSIS
read_range_next() read_range_next()
eq_range Set to 1 if start_key == end_key
NOTES NOTES
Record is read into table->record[0] Record is read into table->record[0]
...@@ -1450,19 +1376,17 @@ int handler::read_range_first(const key_range *start_key, ...@@ -1450,19 +1376,17 @@ int handler::read_range_first(const key_range *start_key,
# Error code # Error code
*/ */
int handler::read_range_next() int handler::read_range_next(bool eq_range)
{ {
int result; int result;
DBUG_ENTER("handler::read_range_next"); DBUG_ENTER("handler::read_range_next");
if (eq_range) if (eq_range)
{ result= index_next_same(table->record[0],
/* We trust that index_next_same always gives a row in range */ end_range->key,
DBUG_RETURN(index_next_same(table->record[0], end_range->length);
end_range->key, else
end_range->length)); result= index_next(table->record[0]);
}
result= index_next(table->record[0]);
if (result) if (result)
DBUG_RETURN(result); DBUG_RETURN(result);
DBUG_RETURN(compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE); DBUG_RETURN(compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE);
...@@ -1470,18 +1394,16 @@ int handler::read_range_next() ...@@ -1470,18 +1394,16 @@ int handler::read_range_next()
/* /*
Compare if found key (in row) is over max-value Compare if found key is over max-value
SYNOPSIS SYNOPSIS
compare_key compare_key
range range to compare to row. May be 0 for no range range key to compare to row
NOTES NOTES
See key.cc::key_cmp() for details For this to work, the row must be stored in table->record[0]
RETURN RETURN
The return value is SIGN(key_in_row - range_key):
0 Key is equal to range or 'range' == 0 (no range) 0 Key is equal to range or 'range' == 0 (no range)
-1 Key is less than range -1 Key is less than range
1 Key is larger than range 1 Key is larger than range
...@@ -1489,11 +1411,35 @@ int handler::read_range_next() ...@@ -1489,11 +1411,35 @@ int handler::read_range_next()
int handler::compare_key(key_range *range) int handler::compare_key(key_range *range)
{ {
int cmp; KEY_PART_INFO *key_part= range_key_part;
uint store_length;
if (!range) if (!range)
return 0; // No max range return 0; // No max range
cmp= key_cmp(range_key_part, range->key, range->length);
if (!cmp) for (const char *key=range->key, *end=key+range->length;
cmp= key_compare_result_on_equal; key < end;
return cmp; key+= store_length, key_part++)
{
int cmp;
store_length= key_part->store_length;
if (key_part->null_bit)
{
if (*key)
{
if (!key_part->field->is_null())
return 1;
continue;
}
else if (key_part->field->is_null())
return 0;
key++; // Skip null byte
store_length--;
}
if ((cmp=key_part->field->key_cmp((byte*) key, key_part->length)) < 0)
return -1;
if (cmp > 0)
return 1;
}
return key_compare_result_on_equal;
} }
/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
#define NO_HASH /* Not yet implemented */ #define NO_HASH /* Not yet implemented */
#endif #endif
#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || \ #if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB)
defined(HAVE_NDBCLUSTER_DB)
#define USING_TRANSACTIONS #define USING_TRANSACTIONS
#endif #endif
...@@ -81,6 +80,7 @@ ...@@ -81,6 +80,7 @@
#define HA_FILE_BASED (1 << 26) #define HA_FILE_BASED (1 << 26)
/* bits in index_flags(index_number) for what you can do with index */ /* bits in index_flags(index_number) for what you can do with index */
#define HA_WRONG_ASCII_ORDER 1 /* Can't use sorting through key */ #define HA_WRONG_ASCII_ORDER 1 /* Can't use sorting through key */
#define HA_READ_NEXT 2 /* Read next record with same key */ #define HA_READ_NEXT 2 /* Read next record with same key */
...@@ -91,13 +91,6 @@ ...@@ -91,13 +91,6 @@
#define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */ #define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */
/* operations for disable/enable indexes */
#define HA_KEY_SWITCH_NONUNIQ 0
#define HA_KEY_SWITCH_ALL 1
#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
#define HA_KEY_SWITCH_ALL_SAVE 3
/* /*
Bits in index_ddl_flags(KEY *wanted_index) Bits in index_ddl_flags(KEY *wanted_index)
for what ddl you can do with index for what ddl you can do with index
...@@ -145,23 +138,15 @@ ...@@ -145,23 +138,15 @@
/* Table caching type */ /* Table caching type */
#define HA_CACHE_TBL_NONTRANSACT 0 #define HA_CACHE_TBL_NONTRANSACT 0
#define HA_CACHE_TBL_NOCACHE 1 #define HA_CACHE_TBL_ASKTRANSACT 1
#define HA_CACHE_TBL_ASKTRANSACT 2 #define HA_CACHE_TBL_TRANSACT 2
#define HA_CACHE_TBL_TRANSACT 4
enum db_type { DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
DB_TYPE_HASH,DB_TYPE_MISAM,DB_TYPE_PISAM,
enum db_type DB_TYPE_RMS_ISAM, DB_TYPE_HEAP, DB_TYPE_ISAM,
{ DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM,
DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1, DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB, DB_TYPE_GEMINI,
DB_TYPE_HASH,DB_TYPE_MISAM,DB_TYPE_PISAM, DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_DEFAULT };
DB_TYPE_RMS_ISAM, DB_TYPE_HEAP, DB_TYPE_ISAM,
DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM,
DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
DB_TYPE_EXAMPLE_DB,
DB_TYPE_DEFAULT // Must be last
};
struct show_table_type_st { struct show_table_type_st {
const char *type; const char *type;
...@@ -191,7 +176,6 @@ typedef struct st_thd_trans { ...@@ -191,7 +176,6 @@ typedef struct st_thd_trans {
void *bdb_tid; void *bdb_tid;
void *innobase_tid; void *innobase_tid;
bool innodb_active_trans; bool innodb_active_trans;
void *ndb_tid;
} THD_TRANS; } THD_TRANS;
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED, enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
...@@ -234,6 +218,14 @@ typedef struct st_ha_check_opt ...@@ -234,6 +218,14 @@ typedef struct st_ha_check_opt
} HA_CHECK_OPT; } HA_CHECK_OPT;
typedef struct st_key_range
{
const byte *key;
uint length;
enum ha_rkey_function flag;
} key_range;
class handler :public Sql_alloc class handler :public Sql_alloc
{ {
protected: protected:
...@@ -260,7 +252,6 @@ class handler :public Sql_alloc ...@@ -260,7 +252,6 @@ class handler :public Sql_alloc
key_range save_end_range, *end_range; key_range save_end_range, *end_range;
KEY_PART_INFO *range_key_part; KEY_PART_INFO *range_key_part;
int key_compare_result_on_equal; int key_compare_result_on_equal;
bool eq_range;
uint errkey; /* Last dup key */ uint errkey; /* Last dup key */
uint sortkey, key_used_on_scan; uint sortkey, key_used_on_scan;
...@@ -322,15 +313,14 @@ class handler :public Sql_alloc ...@@ -322,15 +313,14 @@ class handler :public Sql_alloc
{ {
return (my_errno=HA_ERR_WRONG_COMMAND); return (my_errno=HA_ERR_WRONG_COMMAND);
} }
virtual int read_range_first(const key_range *start_key, virtual int handler::read_range_first(const key_range *start_key,
const key_range *end_key, const key_range *end_key,
bool eq_range, bool sorted); bool sorted);
virtual int read_range_next(); virtual int handler::read_range_next(bool eq_range);
int compare_key(key_range *range); int handler::compare_key(key_range *range);
virtual int ft_init() virtual int ft_init()
{ return -1; } { return -1; }
virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, virtual FT_INFO *ft_init_ext(uint flags,uint inx,const byte *key, uint keylen)
uint keylen)
{ return NULL; } { return NULL; }
virtual int ft_read(byte *buf) { return -1; } virtual int ft_read(byte *buf) { return -1; }
virtual int rnd_init(bool scan=1)=0; virtual int rnd_init(bool scan=1)=0;
...@@ -339,8 +329,11 @@ class handler :public Sql_alloc ...@@ -339,8 +329,11 @@ class handler :public Sql_alloc
virtual int rnd_pos(byte * buf, byte *pos)=0; virtual int rnd_pos(byte * buf, byte *pos)=0;
virtual int read_first_row(byte *buf, uint primary_key); virtual int read_first_row(byte *buf, uint primary_key);
virtual int restart_rnd_next(byte *buf, byte *pos); virtual int restart_rnd_next(byte *buf, byte *pos);
virtual ha_rows records_in_range(uint inx, key_range *min_key, virtual ha_rows records_in_range(int inx,
key_range *max_key) const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag)
{ return (ha_rows) 10; } { return (ha_rows) 10; }
virtual void position(const byte *record)=0; virtual void position(const byte *record)=0;
virtual my_off_t row_position() { return HA_OFFSET_ERROR; } virtual my_off_t row_position() { return HA_OFFSET_ERROR; }
...@@ -371,9 +364,8 @@ class handler :public Sql_alloc ...@@ -371,9 +364,8 @@ class handler :public Sql_alloc
*/ */
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt); virtual int restore(THD* thd, HA_CHECK_OPT* check_opt);
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; } virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int disable_indexes(bool all, bool save) { return HA_ERR_WRONG_COMMAND; }
virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int enable_indexes() { return HA_ERR_WRONG_COMMAND; }
virtual int indexes_are_disabled(void) {return 0;}
virtual void start_bulk_insert(ha_rows rows) {} virtual void start_bulk_insert(ha_rows rows) {}
virtual int end_bulk_insert() {return 0; } virtual int end_bulk_insert() {return 0; }
virtual int discard_or_import_tablespace(my_bool discard) {return -1;} virtual int discard_or_import_tablespace(my_bool discard) {return -1;}
...@@ -487,5 +479,3 @@ bool ha_flush_logs(void); ...@@ -487,5 +479,3 @@ bool ha_flush_logs(void);
int ha_recovery_logging(THD *thd, bool on); int ha_recovery_logging(THD *thd, bool on);
int ha_change_key_cache(KEY_CACHE *old_key_cache, int ha_change_key_cache(KEY_CACHE *old_key_cache,
KEY_CACHE *new_key_cache); KEY_CACHE *new_key_cache);
int ha_discover(const char* dbname, const char* name,
const void** frmblob, uint* frmlen);
...@@ -754,12 +754,11 @@ void mysql_print_status(THD *thd); ...@@ -754,12 +754,11 @@ void mysql_print_status(THD *thd);
int find_ref_key(TABLE *form,Field *field, uint *offset); int find_ref_key(TABLE *form,Field *field, uint *offset);
void key_copy(byte *key,TABLE *form,uint index,uint key_length); void key_copy(byte *key,TABLE *form,uint index,uint key_length);
void key_restore(TABLE *form,byte *key,uint index,uint key_length); void key_restore(TABLE *form,byte *key,uint index,uint key_length);
bool key_cmp_if_same(TABLE *form,const byte *key,uint index,uint key_length); int key_cmp(TABLE *form,const byte *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index); void key_unpack(String *to,TABLE *form,uint index);
bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields); bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields);
int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
bool init_errmessage(void); bool init_errmessage(void);
void sql_perror(const char *message); void sql_perror(const char *message);
void sql_print_error(const char *format,...) void sql_print_error(const char *format,...)
__attribute__ ((format (printf, 1, 2))); __attribute__ ((format (printf, 1, 2)));
...@@ -838,7 +837,7 @@ extern ulong server_id, concurrency; ...@@ -838,7 +837,7 @@ extern ulong server_id, concurrency;
extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count; extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count;
extern ulong ha_read_key_count, ha_read_next_count, ha_read_prev_count; extern ulong ha_read_key_count, ha_read_next_count, ha_read_prev_count;
extern ulong ha_read_first_count, ha_read_last_count; extern ulong ha_read_first_count, ha_read_last_count;
extern ulong ha_read_rnd_count, ha_read_rnd_next_count, ha_discover_count; extern ulong ha_read_rnd_count, ha_read_rnd_next_count;
extern ulong ha_commit_count, ha_rollback_count,table_cache_size; extern ulong ha_commit_count, ha_rollback_count,table_cache_size;
extern ulong max_connections,max_connect_errors, connect_timeout; extern ulong max_connections,max_connect_errors, connect_timeout;
extern ulong slave_net_timeout; extern ulong slave_net_timeout;
...@@ -892,7 +891,6 @@ extern SHOW_VAR init_vars[],status_vars[], internal_vars[]; ...@@ -892,7 +891,6 @@ extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
extern SHOW_COMP_OPTION have_isam; extern SHOW_COMP_OPTION have_isam;
extern SHOW_COMP_OPTION have_innodb; extern SHOW_COMP_OPTION have_innodb;
extern SHOW_COMP_OPTION have_berkeley_db; extern SHOW_COMP_OPTION have_berkeley_db;
extern SHOW_COMP_OPTION have_ndbcluster;
extern struct system_variables global_system_variables; extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables; extern struct system_variables max_system_variables;
extern struct rand_struct sql_rand; extern struct rand_struct sql_rand;
...@@ -910,7 +908,8 @@ extern struct my_option my_long_options[]; ...@@ -910,7 +908,8 @@ extern struct my_option my_long_options[];
/* optional things, have_* variables */ /* optional things, have_* variables */
extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db, have_example_db; extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db;
extern SHOW_COMP_OPTION have_example_db, have_archive_db;
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink; extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb; extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_crypt;
...@@ -962,10 +961,6 @@ int format_number(uint inputflag,uint max_length,my_string pos,uint length, ...@@ -962,10 +961,6 @@ int format_number(uint inputflag,uint max_length,my_string pos,uint length,
my_string *errpos); my_string *errpos);
int openfrm(const char *name,const char *alias,uint filestat,uint prgflag, int openfrm(const char *name,const char *alias,uint filestat,uint prgflag,
uint ha_open_flags, TABLE *outparam); uint ha_open_flags, TABLE *outparam);
int readfrm(const char *name, const void** data, uint* length);
int writefrm(const char* name, const void* data, uint len);
int create_table_from_handler(const char *db, const char *name,
bool create_if_found);
int closefrm(TABLE *table); int closefrm(TABLE *table);
db_type get_table_type(const char *name); db_type get_table_type(const char *name);
int read_string(File file, gptr *to, uint length); int read_string(File file, gptr *to, uint length);
...@@ -1043,7 +1038,8 @@ void reset_host_errors(struct in_addr *in); ...@@ -1043,7 +1038,8 @@ void reset_host_errors(struct in_addr *in);
bool hostname_cache_init(); bool hostname_cache_init();
void hostname_cache_free(); void hostname_cache_free();
void hostname_cache_refresh(void); void hostname_cache_refresh(void);
bool get_interval_info(const char *str,uint length,uint count,
long *values);
/* sql_cache.cc */ /* sql_cache.cc */
extern bool sql_cache_init(); extern bool sql_cache_init();
extern void sql_cache_free(); extern void sql_cache_free();
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
#ifdef HAVE_ISAM #ifdef HAVE_ISAM
#include "ha_isam.h" #include "ha_isam.h"
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB
#include "ha_ndbcluster.h"
#endif
#include <nisam.h> #include <nisam.h>
#include <thr_alarm.h> #include <thr_alarm.h>
#include <ft_global.h> #include <ft_global.h>
...@@ -264,7 +261,7 @@ my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; ...@@ -264,7 +261,7 @@ my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0; my_bool opt_log_slave_updates= 0;
my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam, opt_ndbcluster; my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam;
my_bool opt_readonly, use_temp_pool, relay_log_purge; my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_sync_bdb_logs, opt_sync_frm; my_bool opt_sync_bdb_logs, opt_sync_frm;
my_bool opt_secure_auth= 0; my_bool opt_secure_auth= 0;
...@@ -373,8 +370,7 @@ KEY_CACHE *sql_key_cache; ...@@ -373,8 +370,7 @@ KEY_CACHE *sql_key_cache;
CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *system_charset_info, *files_charset_info ;
CHARSET_INFO *national_charset_info, *table_alias_charset; CHARSET_INFO *national_charset_info, *table_alias_charset;
SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_example_db, have_archive_db;
have_ndbcluster, have_example_db;
SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache; SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache;
SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_crypt, have_compress;
...@@ -2328,17 +2324,6 @@ Warning: you need to use --log-bin to make --log-slave-updates work. \ ...@@ -2328,17 +2324,6 @@ Warning: you need to use --log-bin to make --log-slave-updates work. \
Now disabling --log-slave-updates."); Now disabling --log-slave-updates.");
} }
#ifdef HAVE_REPLICATION
if (opt_log_slave_updates && replicate_same_server_id)
{
sql_print_error("\
Error: using --replicate-same-server-id in conjunction with \
--log-slave-updates is impossible, it would lead to infinite loops in this \
server.");
unireg_abort(1);
}
#endif
if (opt_error_log) if (opt_error_log)
{ {
if (!log_error_file_ptr[0]) if (!log_error_file_ptr[0])
...@@ -3627,7 +3612,7 @@ enum options_mysqld ...@@ -3627,7 +3612,7 @@ enum options_mysqld
OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE, OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE,
OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE, OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE,
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID, OPT_REPLICATE_WILD_IGNORE_TABLE,
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_DISCONNECT_SLAVE_EVENT_COUNT,
OPT_ABORT_SLAVE_EVENT_COUNT, OPT_ABORT_SLAVE_EVENT_COUNT,
OPT_INNODB_DATA_HOME_DIR, OPT_INNODB_DATA_HOME_DIR,
...@@ -3640,7 +3625,7 @@ enum options_mysqld ...@@ -3640,7 +3625,7 @@ enum options_mysqld
OPT_INNODB_FAST_SHUTDOWN, OPT_INNODB_FAST_SHUTDOWN,
OPT_INNODB_FILE_PER_TABLE, OPT_INNODB_FILE_PER_TABLE,
OPT_SAFE_SHOW_DB, OPT_SAFE_SHOW_DB,
OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_SKIP_SAFEMALLOC, OPT_INNODB, OPT_ISAM, OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_TX_ISOLATION,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
...@@ -3672,7 +3657,7 @@ enum options_mysqld ...@@ -3672,7 +3657,7 @@ enum options_mysqld
OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
OPT_MAX_LENGTH_FOR_SORT_DATA, OPT_MAX_LENGTH_FOR_SORT_DATA,
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
OPT_MAX_ERROR_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, OPT_MAX_ERROR_COUNT,
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_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_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
...@@ -4101,15 +4086,6 @@ master-ssl", ...@@ -4101,15 +4086,6 @@ master-ssl",
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB, {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
"Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.", "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_REPLICATION
{"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
"In replication, if set to 1, do not skip events having our server id. \
Default value is 0 (to break infinite loops in circular replication). \
Can't be set to 1 if --log-slave-updates is used.",
(gptr*) &replicate_same_server_id,
(gptr*) &replicate_same_server_id,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
// In replication, we may need to tell the other servers how to connect // In replication, we may need to tell the other servers how to connect
{"report-host", OPT_REPORT_HOST, {"report-host", OPT_REPORT_HOST,
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", "Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.",
...@@ -4163,7 +4139,7 @@ relay logs.", ...@@ -4163,7 +4139,7 @@ relay logs.",
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO,
"Show user and password in SHOW SLAVE HOSTS on this master", "Show user and password in SHOW SLAVE HOSTS.",
(gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0, (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"concurrent-insert", OPT_CONCURRENT_INSERT, {"concurrent-insert", OPT_CONCURRENT_INSERT,
...@@ -4182,10 +4158,6 @@ Disable with --skip-innodb (will save memory).", ...@@ -4182,10 +4158,6 @@ Disable with --skip-innodb (will save memory).",
Disable with --skip-isam.", Disable with --skip-isam.",
(gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 1, 0, 0, (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0}, 0, 0, 0},
{"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports it). \
Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK, {"skip-locking", OPT_SKIP_LOCK,
"Deprecated option, use --skip-external-locking instead.", "Deprecated option, use --skip-external-locking instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
...@@ -4535,11 +4507,6 @@ The minimum value for this variable is 4096.", ...@@ -4535,11 +4507,6 @@ The minimum value for this variable is 4096.",
(gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, (gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
0, MI_MIN_KEY_BLOCK_LENGTH, 0}, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
"Default pointer size to be used for MyISAM tables.",
(gptr*) &myisam_data_pointer_size,
(gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
4, 2, 7, 0, 1, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Used to help MySQL to decide when to use the slow but safe key cache index create method.", "Used to help MySQL to decide when to use the slow but safe key cache index create method.",
(gptr*) &global_system_variables.myisam_max_extra_sort_file_size, (gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
...@@ -4861,13 +4828,10 @@ struct show_var_st status_vars[]= { ...@@ -4861,13 +4828,10 @@ struct show_var_st status_vars[]= {
{"Handler_rollback", (char*) &ha_rollback_count, SHOW_LONG}, {"Handler_rollback", (char*) &ha_rollback_count, SHOW_LONG},
{"Handler_update", (char*) &ha_update_count, SHOW_LONG}, {"Handler_update", (char*) &ha_update_count, SHOW_LONG},
{"Handler_write", (char*) &ha_write_count, SHOW_LONG}, {"Handler_write", (char*) &ha_write_count, SHOW_LONG},
{"Handler_discover", (char*) &ha_discover_count, SHOW_LONG},
{"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed, {"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed,
SHOW_KEY_CACHE_LONG}, SHOW_KEY_CACHE_LONG},
{"Key_blocks_used", (char*) &dflt_key_cache_var.blocks_used, {"Key_blocks_used", (char*) &dflt_key_cache_var.global_blocks_used,
SHOW_KEY_CACHE_CONST_LONG}, SHOW_KEY_CACHE_LONG},
{"Key_blocks_unused", (char*) &dflt_key_cache_var.blocks_unused,
SHOW_KEY_CACHE_CONST_LONG},
{"Key_read_requests", (char*) &dflt_key_cache_var.global_cache_r_requests, {"Key_read_requests", (char*) &dflt_key_cache_var.global_cache_r_requests,
SHOW_KEY_CACHE_LONG}, SHOW_KEY_CACHE_LONG},
{"Key_reads", (char*) &dflt_key_cache_var.global_cache_read, {"Key_reads", (char*) &dflt_key_cache_var.global_cache_read,
...@@ -5162,10 +5126,10 @@ static void mysql_init_variables(void) ...@@ -5162,10 +5126,10 @@ static void mysql_init_variables(void)
#else #else
have_example_db= SHOW_OPTION_NO; have_example_db= SHOW_OPTION_NO;
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_ARCHIVE_DB
have_ndbcluster=SHOW_OPTION_DISABLED; have_archive_db= SHOW_OPTION_YES;
#else #else
have_ndbcluster=SHOW_OPTION_NO; have_archive_db= SHOW_OPTION_NO;
#endif #endif
#ifdef USE_RAID #ifdef USE_RAID
have_raid=SHOW_OPTION_YES; have_raid=SHOW_OPTION_YES;
...@@ -5635,14 +5599,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5635,14 +5599,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_isam= SHOW_OPTION_YES; have_isam= SHOW_OPTION_YES;
else else
have_isam= SHOW_OPTION_DISABLED; have_isam= SHOW_OPTION_DISABLED;
#endif
break;
case OPT_NDBCLUSTER:
#ifdef HAVE_NDBCLUSTER_DB
if (opt_ndbcluster)
have_ndbcluster=SHOW_OPTION_YES;
else
have_ndbcluster=SHOW_OPTION_DISABLED;
#endif #endif
break; break;
case OPT_INNODB: case OPT_INNODB:
......
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