diff options
author | unknown <acurtis@xiphis.org> | 2006-04-13 13:49:29 -0700 |
---|---|---|
committer | unknown <acurtis@xiphis.org> | 2006-04-13 13:49:29 -0700 |
commit | 83583111cadd1a411c6a51c1891e7ca5a4e45223 (patch) | |
tree | 7d7b722a3af9812d173de1c5398f625484467670 /storage/blackhole | |
parent | 087cae1a1e5c5681886955c44726bddec2c5d94a (diff) | |
download | mariadb-git-83583111cadd1a411c6a51c1891e7ca5a4e45223.tar.gz |
WL#3201
" Configure support for server plugins "
storage/blackhole/ha_blackhole.h:
Rename: sql/ha_blackhole.h -> storage/blackhole/ha_blackhole.h
BitKeeper/deleted/.del-storage.m4~24bf2fffdaa328ad:
Delete: config/ac-macros/storage.m4
BitKeeper/deleted/.del-ha_archive.m4~a07fac7110b39294:
Delete: config/ac-macros/ha_archive.m4
BitKeeper/deleted/.del-ha_blackhole.m4~8ed06eb91f6420ed:
Delete: config/ac-macros/ha_blackhole.m4
BitKeeper/deleted/.del-ha_example.m4~1dfb268163297708:
Delete: config/ac-macros/ha_example.m4
BitKeeper/deleted/.del-ha_federated.m4~7acddd58286acfd6:
Delete: config/ac-macros/ha_federated.m4
BitKeeper/deleted/.del-ha_innodb.m4~6f141fb5b80c1f39:
Delete: config/ac-macros/ha_innodb.m4
BitKeeper/deleted/.del-ha_partition.m4~bc57067550be5f89:
Delete: config/ac-macros/ha_partition.m4
BitKeeper/deleted/.del-ha_tina.m4~f658506ebbc113ca:
Delete: config/ac-macros/ha_tina.m4
BitKeeper/deleted/.del-handlerton.cc.in~377156e7b06067cc:
Delete: sql/handlerton.cc.in
BitKeeper/deleted/.del-handlerton-win.cc~322a7e59507976df:
Delete: sql/handlerton-win.cc
BUILD/SETUP.sh:
WL#3201
Changes in configure arguments
Makefile.am:
WL#3201
changes in build subst names
config/ac-macros/ha_berkeley.m4:
WL#3201
remove unused variable
Makefile is always made
config/ac-macros/ha_ndbcluster.m4:
WL#3201
remove unused variables
Split big macro
configure.in:
WL#3201
out with storage.m4, in with plugins.m4
change how plugins are declared
include makefiles, remove handlerton.cc, add sql_builtin.cc
include/mysql/plugin.h:
WL#3201
support static and dynamic build - MYSQL_DYNAMIC_PLUGIN
libmysqld/Makefile.am:
WL#3201
Storage engine files still left in sql subdir are not conditionally
compiled. Should move them out soon,
plugin/Makefile.am:
WL#3201
update makefile
plugin/fulltext/Makefile.am:
WL#3201
update makefile
plugin/fulltext/plugin_example.c:
WL#3201
change to mysql_declare_plugin macro
sql/Makefile.am:
WL#3201
Storage engine files still left in sql subdir are not conditionally
compiled. Should move them out soon,
sql/ha_berkeley.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_federated.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_heap.cc:
WL#3201
make into a plugin
sql/ha_innodb.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_myisam.cc:
WL#3201
make into a plugin
sql/ha_myisammrg.cc:
WL#3201
make into a plugin
sql/ha_ndbcluster.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_ndbcluster_binlog.cc:
WL#3201
make into a plugin
conditionally compile content
sql/ha_partition.cc:
WL#3201
make into a plugin
conditionally compile content
sql/handler.cc:
WL#3201
Simplify how storage engines are found by db_type
(hopefully we can get rid of it soon)
Code cleanup
sql/handler.h:
WL#3201
new DB_TYPE_FIRST_DYNAMIC
new func ha_finalize_handlerton()
remove ha_register_builtin_plugins()
sql/log.cc:
WL#3201
make into a plugin
sql/mysqld.cc:
WL#3201
remove ha_register_builtin_plugins()
alter init order so that storage engines are initialized before first use
sql/partition_info.cc:
WL#3201
conditionally compile content
sql/sql_delete.cc:
WL#3201
conditionally include ha_innodb.h
sql/sql_plugin.cc:
WL#3201
All compiled in plugins are in mysqld_builtins[]
add funcs for plugin finalization
install builtin plugins on initialization
sql/sql_show.cc:
WL#3201
Fix to use plugin_foreach()
sql/sql_yacc.yy:
WL#3201
SHOW FULL PLUGIN
storage/archive/Makefile.am:
WL#3201
setup as plugin makefile
storage/archive/ha_archive.cc:
WL#3201
Convert into a plugin
storage/archive/ha_archive.h:
WL#3201
azlib.h now in local dir
storage/blackhole/ha_blackhole.cc:
WL#3201
convert into a plugin
storage/csv/Makefile.am:
WL#3201
setup as plugin makefile
storage/csv/ha_tina.cc:
WL#3201
remove conditional compilation on MYSQL_PLUGIN
mysql_declare_plugin macro change
storage/example/Makefile.am:
WL#3201
fix as new-style plugin makefile
storage/example/ha_example.cc:
WL#3201
remove conditional compilation on MYSQL_PLUGIN
mysql_declare_plugin macro change
storage/innobase/Makefile.am:
WL#3201
Lets make life easier and reduce innodb into a single library file
config/ac-macros/plugins.m4:
New BitKeeper file ``config/ac-macros/plugins.m4''
sql/sql_builtin.cc.in:
New BitKeeper file ``sql/sql_builtin.cc.in''
storage/blackhole/Makefile.am:
New BitKeeper file ``storage/blackhole/Makefile.am''
Diffstat (limited to 'storage/blackhole')
-rw-r--r-- | storage/blackhole/Makefile.am | 51 | ||||
-rw-r--r-- | storage/blackhole/ha_blackhole.cc | 266 | ||||
-rw-r--r-- | storage/blackhole/ha_blackhole.h | 88 |
3 files changed, 405 insertions, 0 deletions
diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am new file mode 100644 index 00000000000..060eaffce66 --- /dev/null +++ b/storage/blackhole/Makefile.am @@ -0,0 +1,51 @@ +# 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 + +#called from the top level Makefile + +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +INCLUDES = -I$(top_srcdir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/sql \ + -I$(srcdir) +WRAPLIBS= + +LDADD = + +DEFS = @DEFS@ + +noinst_HEADERS = ha_blackhole.h + +EXTRA_LTLIBRARIES = ha_blackhole.la +pkglib_LTLIBRARIES = @plugin_blackhole_shared_target@ +ha_blackhole_la_LDFLAGS=-module -rpath $(MYSQLLIBdir) +ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_SOURCES=ha_blackhole.cc + + +EXTRA_LIBRARIES = libblackhole.a +noinst_LIBRARIES = @plugin_blackhole_static_target@ +libblackhole_a_CXXFLAGS=$(AM_CFLAGS) +libblackhole_a_CFLAGS = $(AM_CFLAGS) +libblackhole_a_SOURCES= ha_blackhole.cc + + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc new file mode 100644 index 00000000000..31d0b0c3917 --- /dev/null +++ b/storage/blackhole/ha_blackhole.cc @@ -0,0 +1,266 @@ +/* Copyright (C) 2005 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 USE_PRAGMA_IMPLEMENTATION +#pragma implementation // gcc: Class implementation +#endif + +#include "mysql_priv.h" +#include "ha_blackhole.h" + +#include <mysql/plugin.h> + +/* Static declarations for handlerton */ + +static handler *blackhole_create_handler(TABLE_SHARE *table); + + +/* Blackhole storage engine handlerton */ + +handlerton blackhole_hton= { + MYSQL_HANDLERTON_INTERFACE_VERSION, + "BLACKHOLE", + SHOW_OPTION_YES, + "/dev/null storage engine (anything you write to it disappears)", + DB_TYPE_BLACKHOLE_DB, + NULL, + 0, /* slot */ + 0, /* savepoint size. */ + NULL, /* close_connection */ + NULL, /* savepoint */ + NULL, /* rollback to savepoint */ + NULL, /* release savepoint */ + NULL, /* commit */ + NULL, /* rollback */ + NULL, /* prepare */ + NULL, /* recover */ + NULL, /* commit_by_xid */ + NULL, /* rollback_by_xid */ + NULL, /* create_cursor_read_view */ + NULL, /* set_cursor_read_view */ + NULL, /* close_cursor_read_view */ + blackhole_create_handler, /* Create a new handler */ + NULL, /* Drop a database */ + NULL, /* Panic call */ + NULL, /* Start Consistent Snapshot */ + NULL, /* Flush logs */ + NULL, /* Show status */ + NULL, /* Partition flags */ + NULL, /* Alter table flags */ + NULL, /* Alter Tablespace */ + NULL, /* Fill FILES table */ + HTON_CAN_RECREATE, + NULL, /* binlog_func */ + NULL, /* binlog_log_query */ + NULL /* release_temporary_latches */ +}; + + +static handler *blackhole_create_handler(TABLE_SHARE *table) +{ + return new ha_blackhole(table); +} + + +/***************************************************************************** +** BLACKHOLE tables +*****************************************************************************/ + +ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg) + :handler(&blackhole_hton, table_arg) +{} + + +static const char *ha_blackhole_exts[] = { + NullS +}; + +const char **ha_blackhole::bas_ext() const +{ + return ha_blackhole_exts; +} + +int ha_blackhole::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_blackhole::open"); + thr_lock_init(&thr_lock); + thr_lock_data_init(&thr_lock,&lock,NULL); + DBUG_RETURN(0); +} + +int ha_blackhole::close(void) +{ + DBUG_ENTER("ha_blackhole::close"); + thr_lock_delete(&thr_lock); + DBUG_RETURN(0); +} + +int ha_blackhole::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) +{ + DBUG_ENTER("ha_blackhole::create"); + DBUG_RETURN(0); +} + +const char *ha_blackhole::index_type(uint key_number) +{ + DBUG_ENTER("ha_blackhole::index_type"); + DBUG_RETURN((table_share->key_info[key_number].flags & HA_FULLTEXT) ? + "FULLTEXT" : + (table_share->key_info[key_number].flags & HA_SPATIAL) ? + "SPATIAL" : + (table_share->key_info[key_number].algorithm == + HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE"); +} + +int ha_blackhole::write_row(byte * buf) +{ + DBUG_ENTER("ha_blackhole::write_row"); + DBUG_RETURN(0); +} + +int ha_blackhole::rnd_init(bool scan) +{ + DBUG_ENTER("ha_blackhole::rnd_init"); + DBUG_RETURN(0); +} + + +int ha_blackhole::rnd_next(byte *buf) +{ + DBUG_ENTER("ha_blackhole::rnd_next"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::rnd_pos(byte * buf, byte *pos) +{ + DBUG_ENTER("ha_blackhole::rnd_pos"); + DBUG_ASSERT(0); + DBUG_RETURN(0); +} + + +void ha_blackhole::position(const byte *record) +{ + DBUG_ENTER("ha_blackhole::position"); + DBUG_ASSERT(0); + DBUG_VOID_RETURN; +} + + +void ha_blackhole::info(uint flag) +{ + DBUG_ENTER("ha_blackhole::info"); + + records= 0; + deleted= 0; + errkey= 0; + mean_rec_length= 0; + data_file_length= 0; + index_file_length= 0; + max_data_file_length= 0; + delete_length= 0; + if (flag & HA_STATUS_AUTO) + auto_increment_value= 1; + DBUG_VOID_RETURN; +} + +int ha_blackhole::external_lock(THD *thd, int lock_type) +{ + DBUG_ENTER("ha_blackhole::external_lock"); + DBUG_RETURN(0); +} + + +uint ha_blackhole::lock_count(void) const +{ + DBUG_ENTER("ha_blackhole::lock_count"); + DBUG_RETURN(0); +} + +THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + DBUG_ENTER("ha_blackhole::store_lock"); + DBUG_RETURN(to); +} + + +int ha_blackhole::index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag) +{ + DBUG_ENTER("ha_blackhole::index_read"); + DBUG_RETURN(0); +} + + +int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key, + uint key_len, enum ha_rkey_function find_flag) +{ + DBUG_ENTER("ha_blackhole::index_read_idx"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_read_last(byte * buf, const byte * key, uint key_len) +{ + DBUG_ENTER("ha_blackhole::index_read_last"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_next(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_next"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_prev(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_prev"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_first(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_first"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + + +int ha_blackhole::index_last(byte * buf) +{ + DBUG_ENTER("ha_blackhole::index_last"); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +mysql_declare_plugin(blackhole) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &blackhole_hton, + blackhole_hton.name, + "MySQL AB", + "Blackhole Storage Engine", + NULL, /* Plugin Init */ + NULL, /* Plugin Deinit */ + 0x0100 /* 1.0 */, +} +mysql_declare_plugin_end; diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h new file mode 100644 index 00000000000..15e12659aa0 --- /dev/null +++ b/storage/blackhole/ha_blackhole.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2005 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 USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +/* + Class definition for the blackhole storage engine + "Dumbest named feature ever" +*/ +class ha_blackhole: public handler +{ + THR_LOCK_DATA lock; /* MySQL lock */ + THR_LOCK thr_lock; + +public: + ha_blackhole(TABLE_SHARE *table_arg); + ~ha_blackhole() + { + } + /* The name that will be used for display purposes */ + const char *table_type() const { return "BLACKHOLE"; } + /* + The name of the index type that will be used for display + don't implement this method unless you really have indexes + */ + const char *index_type(uint key_number); + const char **bas_ext() const; + ulong table_flags() const + { + return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | + HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | + HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME | + HA_CAN_INSERT_DELAYED); + } + 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); + } + /* The following defines can be increased if necessary */ +#define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */ +#define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ +#define BLACKHOLE_MAX_KEY_LENGTH 1000 + uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } + uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } + int open(const char *name, int mode, uint test_if_locked); + int close(void); + int write_row(byte * buf); + int rnd_init(bool scan); + int rnd_next(byte *buf); + int rnd_pos(byte * buf, byte *pos); + 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); + void position(const byte *record); + void info(uint flag); + int external_lock(THD *thd, int lock_type); + uint lock_count(void) const; + int create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info); + THR_LOCK_DATA **store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + bool has_transactions() { return 1; } +}; |