diff options
Diffstat (limited to 'storage/heap')
-rw-r--r-- | storage/heap/Makefile.am | 73 | ||||
-rw-r--r-- | storage/heap/ha_heap.cc | 11 | ||||
-rw-r--r-- | storage/heap/ha_heap.h | 3 | ||||
-rw-r--r-- | storage/heap/heapdef.h | 7 | ||||
-rw-r--r-- | storage/heap/hp_block.c | 2 | ||||
-rw-r--r-- | storage/heap/hp_create.c | 4 | ||||
-rw-r--r-- | storage/heap/hp_delete.c | 2 | ||||
-rw-r--r-- | storage/heap/hp_open.c | 2 | ||||
-rw-r--r-- | storage/heap/hp_static.c | 4 | ||||
-rw-r--r-- | storage/heap/hp_test2.c | 8 | ||||
-rw-r--r-- | storage/heap/plug.in | 7 |
11 files changed, 15 insertions, 108 deletions
diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am deleted file mode 100644 index 677b2d60269..00000000000 --- a/storage/heap/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (C) 2000-2002, 2005-2006 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ -pkglib_LIBRARIES = libheap.a -noinst_PROGRAMS = hp_test1 hp_test2 -noinst_LIBRARIES = libheap.a -hp_test1_LDFLAGS = @NOINST_LDFLAGS@ -hp_test1_LDADD = libheap.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a -hp_test2_LDFLAGS = @NOINST_LDFLAGS@ -hp_test2_LDADD = libheap.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a -noinst_HEADERS = heapdef.h ha_heap.h -libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ - hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \ - hp_rsame.c hp_create.c hp_rename.c hp_rfirst.c \ - hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \ - hp_rkey.c hp_block.c \ - ha_heap.cc \ - hp_hash.c _check.c _rectest.c hp_static.c - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -libheap_a_LIBADD = probes_mysql.o -libheap_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = ha_heap.o -DTRACEPROVIDER = probes_mysql.d -CLEANFILES += $(DTRACEPROVIDER) dtrace_sources - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ -endif diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 93bee5ad7f1..fc6e89e54e0 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -157,11 +157,11 @@ int ha_heap::close(void) DESCRIPTION Do same as default implementation but use file->s->name instead of table->s->path. This is needed by Windows where the clone() call sees - '/'-delimited path in table->s->path, while ha_peap::open() was called + '/'-delimited path in table->s->path, while ha_heap::open() was called with '\'-delimited path. */ -handler *ha_heap::clone(MEM_ROOT *mem_root) +handler *ha_heap::clone(const char *name, MEM_ROOT *mem_root) { handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); if (new_handler && !new_handler->ha_open(table, file->s->name, table->db_stat, @@ -455,6 +455,13 @@ int ha_heap::delete_all_rows() } +int ha_heap::truncate() +{ + int error= delete_all_rows(); + return error ? error : reset_auto_increment(0); +} + + int ha_heap::reset_auto_increment(ulonglong value) { file->s->auto_increment= value; diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index 7185fbc7720..cc335870f06 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -35,7 +35,7 @@ class ha_heap: public handler public: ha_heap(handlerton *hton, TABLE_SHARE *table); ~ha_heap() {} - handler *clone(MEM_ROOT *mem_root); + handler *clone(const char *name, MEM_ROOT *mem_root); const char *table_type() const { return (table->in_use->variables.sql_mode & MODE_MYSQL323) ? @@ -99,6 +99,7 @@ public: int reset(); int external_lock(THD *thd, int lock_type); int delete_all_rows(void); + int truncate(); int reset_auto_increment(ulonglong value); int disable_indexes(uint mode); int enable_indexes(uint mode); diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index bc3c6bf7239..87866678c2f 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -17,9 +17,7 @@ #include <my_base.h> /* This includes global */ C_MODE_START -#ifdef THREAD #include <my_pthread.h> -#endif #include "heap.h" /* Structs & some defines */ #include "my_tree.h" @@ -102,14 +100,11 @@ extern void hp_clear(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info); extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, key_part_map keypart_map); -#ifdef THREAD + extern mysql_mutex_t THR_LOCK_heap; -#endif #ifdef HAVE_PSI_INTERFACE -#ifdef THREAD extern PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; -#endif /* THREAD */ void init_heap_psi_keys(); #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 7f6cc1ef90a..41391fba060 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -86,7 +86,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) } else { - dont_break(); /* Dont allow SIGHUP or SIGINT */ if ((uint) i == block->levels) { /* Adding a new level on top of the existing ones. */ @@ -117,7 +116,6 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length) allocated bytes. Use it as a leaf block. */ block->level_info[0].last_blocks= root; - allow_break(); /* Allow SIGHUP & SIGINT */ } return 0; } diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index bbf649c5e46..67fe0b3136f 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -192,11 +192,9 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, my_free(share); goto err; } -#ifdef THREAD thr_lock_init(&share->lock); mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock, &share->intern_lock, MY_MUTEX_INIT_FAST); -#endif if (!create_info->internal_table) { share->open_list.data= (void*) share; @@ -301,10 +299,8 @@ void hp_free(HP_SHARE *share) if (share->open_list.data) /* If not internal table */ heap_share_list= list_delete(heap_share_list, &share->open_list); hp_clear(share); /* Remove blocks from memory */ -#ifdef THREAD thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->intern_lock); -#endif my_free(share->name); my_free(share); return; diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c index 9e9e28da335..ceba0fcf12e 100644 --- a/storage/heap/hp_delete.c +++ b/storage/heap/hp_delete.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2002, 2004-200 MySQL AB +/* Copyright (C) 2000-2002, 2004-2007 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index 12d9bfe1ed3..5ac4da22e0a 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -37,9 +37,7 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode) DBUG_RETURN(0); } share->open_count++; -#ifdef THREAD thr_lock_data_init(&share->lock,&info->lock,NULL); -#endif info->s= share; info->lastkey= (uchar*) (info + 1); info->recbuf= (uchar*) (info->lastkey + share->max_key_length); diff --git a/storage/heap/hp_static.c b/storage/heap/hp_static.c index e1ca7d1f445..a58ecb8b754 100644 --- a/storage/heap/hp_static.c +++ b/storage/heap/hp_static.c @@ -25,7 +25,6 @@ LIST *heap_open_list=0,*heap_share_list=0; #ifdef HAVE_PSI_INTERFACE -#ifdef THREAD PSI_mutex_key hp_key_mutex_HP_SHARE_intern_lock; static PSI_mutex_info all_heap_mutexes[]= @@ -36,11 +35,9 @@ static PSI_mutex_info all_heap_mutexes[]= THR_LOCK_heap is part of mysys, not storage/heap. */ }; -#endif /* THREAD */ void init_heap_psi_keys() { -#ifdef THREAD const char* category= "memory"; int count; @@ -49,7 +46,6 @@ void init_heap_psi_keys() count= array_elements(all_heap_mutexes); PSI_server->register_mutex(category, all_heap_mutexes, count); -#endif /* THREAD */ } #endif /* HAVE_PSI_INTERFACE */ diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 3ee903be7ed..af388867c3c 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2003, 2006 MySQL AB +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -656,11 +657,6 @@ static int rnd(int max_value) static sig_handler endprog(int sig_number __attribute__((unused))) { -#ifndef THREAD - if (my_dont_interrupt) - my_remember_signal(sig_number,endprog); - else -#endif { hp_panic(HA_PANIC_CLOSE); my_end(1); diff --git a/storage/heap/plug.in b/storage/heap/plug.in deleted file mode 100644 index 50f31c60f2b..00000000000 --- a/storage/heap/plug.in +++ /dev/null @@ -1,7 +0,0 @@ -MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], - [Volatile memory based tables]) -MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap]) -MYSQL_PLUGIN_STATIC(heap, [libheap.a]) -MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(heap, [ha_heap.cc]) - |