diff options
author | unknown <aivanov@mysql.com> | 2005-12-13 16:49:24 +0300 |
---|---|---|
committer | unknown <aivanov@mysql.com> | 2005-12-13 16:49:24 +0300 |
commit | ad4d8773506e1c13d39f7b89a4ce4dce63b9ad49 (patch) | |
tree | 2b49f5bf8c4bd1ae14a7c9930b7364deb447f530 /storage/innobase | |
parent | 2309be62e54ac54877645e0c264797646a379b32 (diff) | |
download | mariadb-git-ad4d8773506e1c13d39f7b89a4ce4dce63b9ad49.tar.gz |
Changes from the innodb-5.1-ss28 snapshot.
Removed include/Makefile.am and the reference to it.
Deleted db/db0err.h and db directory.
Check index column sizes in a better way (bug 13315).
Fixed comments for memory allocation functions and added
some extra checks. Adapted callers.
BitKeeper/deleted/.del-Makefile.am~ab5c84d46412dc2e:
Delete: storage/innobase/include/Makefile.am
BitKeeper/deleted/.del-db0err.h~bfeec2efe86ac48b:
Delete: storage/innobase/db/db0err.h
mysql-test/r/innodb.result:
Changes from the innodb-5.1-ss28 snapshot.
mysql-test/t/innodb.test:
Changes from the innodb-5.1-ss28 snapshot.
sql/ha_innodb.cc:
Changes from the innodb-5.1-ss28 snapshot.
sql/ha_innodb.h:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/Makefile.am:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/configure.in:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/ha/ha0ha.c:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/include/ha0ha.h:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/include/ha0ha.ic:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/include/mem0mem.h:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/include/mem0mem.ic:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/lock/lock0lock.c:
Changes from the innodb-5.1-ss28 snapshot.
storage/innobase/mem/mem0mem.c:
Changes from the innodb-5.1-ss28 snapshot.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/Makefile.am | 2 | ||||
-rw-r--r-- | storage/innobase/configure.in | 2 | ||||
-rw-r--r-- | storage/innobase/db/db0err.h | 44 | ||||
-rw-r--r-- | storage/innobase/ha/ha0ha.c | 5 | ||||
-rw-r--r-- | storage/innobase/include/Makefile.am | 60 | ||||
-rw-r--r-- | storage/innobase/include/ha0ha.h | 15 | ||||
-rw-r--r-- | storage/innobase/include/ha0ha.ic | 27 | ||||
-rw-r--r-- | storage/innobase/include/mem0mem.h | 38 | ||||
-rw-r--r-- | storage/innobase/include/mem0mem.ic | 45 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.c | 18 | ||||
-rw-r--r-- | storage/innobase/mem/mem0mem.c | 16 |
11 files changed, 61 insertions, 211 deletions
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index 8ff90d16a2c..9b13df9e057 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -23,7 +23,7 @@ TAR = gtar noinst_HEADERS = ib_config.h SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \ - ha ibuf include lock log mach mem mtr page \ + ha ibuf lock log mach mem mtr page \ pars que read rem row srv sync thr trx usr # Don't update the files from bitkeeper diff --git a/storage/innobase/configure.in b/storage/innobase/configure.in index c56bd8274c4..e0521471c2f 100644 --- a/storage/innobase/configure.in +++ b/storage/innobase/configure.in @@ -128,7 +128,7 @@ AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl buf/Makefile data/Makefile dnl dict/Makefile dyn/Makefile dnl eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl - ha/Makefile ibuf/Makefile include/Makefile dnl + ha/Makefile ibuf/Makefile dnl lock/Makefile log/Makefile dnl mach/Makefile mem/Makefile mtr/Makefile dnl page/Makefile pars/Makefile que/Makefile dnl diff --git a/storage/innobase/db/db0err.h b/storage/innobase/db/db0err.h deleted file mode 100644 index 34513545faa..00000000000 --- a/storage/innobase/db/db0err.h +++ /dev/null @@ -1,44 +0,0 @@ -/****************************************************** -Global error codes for the database - -(c) 1996 Innobase Oy - -Created 5/24/1996 Heikki Tuuri -*******************************************************/ - -#ifndef db0err_h -#define db0err_h - - -#define DB_SUCCESS 10 - -/* The following are error codes */ -#define DB_ERROR 11 -#define DB_OUT_OF_MEMORY 12 -#define DB_OUT_OF_FILE_SPACE 13 -#define DB_LOCK_WAIT 14 -#define DB_DEADLOCK 15 -#define DB_ROLLBACK 16 -#define DB_DUPLICATE_KEY 17 -#define DB_QUE_THR_SUSPENDED 18 -#define DB_MISSING_HISTORY 19 /* required history data has been - deleted due to lack of space in - rollback segment */ -#define DB_CLUSTER_NOT_FOUND 30 -#define DB_TABLE_NOT_FOUND 31 -#define DB_MUST_GET_MORE_FILE_SPACE 32 /* the database has to be stopped - and restrated with more file space */ -#define DB_TABLE_IS_BEING_USED 33 -#define DB_TOO_BIG_RECORD 34 /* a record in an index would become - bigger than 1/2 free space in a page - frame */ - -/* The following are partial failure codes */ -#define DB_FAIL 1000 -#define DB_OVERFLOW 1001 -#define DB_UNDERFLOW 1002 -#define DB_STRONG_FAIL 1003 -#define DB_RECORD_NOT_FOUND 1500 -#define DB_END_OF_INDEX 1501 - -#endif diff --git a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c index ad1391ff83e..fdc3d48c14b 100644 --- a/storage/innobase/ha/ha0ha.c +++ b/storage/innobase/ha/ha0ha.c @@ -40,9 +40,13 @@ ha_create( table->adaptive = FALSE; } + /* Creating MEM_HEAP_BTR_SEARCH type heaps can potentially fail, + but in practise it never should in this case, hence the asserts. */ + if (n_mutexes == 0) { if (in_btr_search) { table->heap = mem_heap_create_in_btr_search(4096); + ut_a(table->heap); } else { table->heap = mem_heap_create_in_buffer(4096); } @@ -57,6 +61,7 @@ ha_create( for (i = 0; i < n_mutexes; i++) { if (in_btr_search) { table->heaps[i] = mem_heap_create_in_btr_search(4096); + ut_a(table->heaps[i]); } else { table->heaps[i] = mem_heap_create_in_buffer(4096); } diff --git a/storage/innobase/include/Makefile.am b/storage/innobase/include/Makefile.am deleted file mode 100644 index b83aee06680..00000000000 --- a/storage/innobase/include/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB -# & Innobase Oy -# -# 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 - -noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \ - btr0pcur.h btr0pcur.ic btr0sea.h btr0sea.ic btr0types.h \ - buf0buf.h buf0buf.ic buf0flu.h buf0flu.ic buf0lru.h \ - buf0lru.ic buf0rea.h buf0types.h data0data.h data0data.ic data0type.h \ - data0type.ic data0types.h db0err.h dict0boot.h \ - dict0boot.ic dict0crea.h dict0crea.ic dict0dict.h \ - dict0dict.ic dict0load.h dict0load.ic dict0mem.h \ - dict0mem.ic dict0types.h dyn0dyn.h dyn0dyn.ic eval0eval.h \ - eval0eval.ic eval0proc.h eval0proc.ic fil0fil.h fsp0fsp.h \ - fsp0fsp.ic fut0fut.h fut0fut.ic fut0lst.h fut0lst.ic \ - ha0ha.h ha0ha.ic hash0hash.h hash0hash.ic \ - ibuf0ibuf.h ibuf0ibuf.ic ibuf0types.h lock0lock.h \ - lock0lock.ic lock0types.h log0log.h log0log.ic log0recv.h \ - log0recv.ic mach0data.h mach0data.ic \ - mem0dbg.h mem0dbg.ic mem0mem.h mem0mem.ic mem0pool.h \ - mem0pool.ic mtr0log.h mtr0log.ic mtr0mtr.h mtr0mtr.ic \ - mtr0types.h os0file.h os0proc.h os0proc.ic \ - os0sync.h os0sync.ic os0thread.h \ - os0thread.ic page0cur.h page0cur.ic page0page.h \ - page0page.ic page0types.h pars0grm.h pars0opt.h \ - pars0opt.ic pars0pars.h pars0pars.ic pars0sym.h \ - pars0sym.ic pars0types.h que0que.h que0que.ic que0types.h \ - read0read.h read0read.ic read0types.h rem0cmp.h \ - rem0cmp.ic rem0rec.h rem0rec.ic rem0types.h row0ins.h \ - row0ins.ic row0mysql.h row0mysql.ic row0purge.h \ - row0purge.ic row0row.h row0row.ic row0sel.h row0sel.ic \ - row0types.h row0uins.h row0uins.ic row0umod.h row0umod.ic \ - row0undo.h row0undo.ic row0upd.h row0upd.ic row0vers.h \ - row0vers.ic srv0que.h srv0srv.h srv0srv.ic srv0start.h \ - sync0arr.h sync0arr.ic sync0rw.h \ - sync0rw.ic sync0sync.h sync0sync.ic sync0types.h \ - thr0loc.h thr0loc.ic trx0purge.h trx0purge.ic trx0rec.h \ - trx0rec.ic trx0roll.h trx0roll.ic trx0rseg.h trx0rseg.ic \ - trx0sys.h trx0sys.ic trx0trx.h trx0trx.ic trx0types.h \ - trx0undo.h trx0undo.ic trx0xa.h univ.i \ - usr0sess.h usr0sess.ic usr0types.h ut0byte.h ut0byte.ic \ - ut0dbg.h ut0lst.h ut0mem.h ut0mem.ic ut0rnd.h ut0rnd.ic \ - ut0sort.h ut0ut.h ut0ut.ic - -EXTRA_DIST = Makefile.i - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index bdaecfcc57a..60ccb0be5d5 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -68,21 +68,6 @@ ha_insert_for_fold( node is created! */ void* data); /* in: data, must not be NULL */ /***************************************************************** -Reserves the necessary hash table mutex and inserts an entry into the hash -table. */ -UNIV_INLINE -ibool -ha_insert_for_fold_mutex( -/*=====================*/ - /* out: TRUE if succeed, FALSE if no more - memory could be allocated */ - hash_table_t* table, /* in: hash table */ - ulint fold, /* in: folded value of data; if a node with - the same fold value already exists, it is - updated to point to the same data, and no new - node is created! */ - void* data); /* in: data, must not be NULL */ -/***************************************************************** Deletes an entry from a hash table. */ void diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.ic index 63cd19fafc3..1584e1ff4bf 100644 --- a/storage/innobase/include/ha0ha.ic +++ b/storage/innobase/include/ha0ha.ic @@ -191,30 +191,3 @@ ha_search_and_delete_if_found( return(FALSE); } - -/***************************************************************** -Reserves the necessary hash table mutex and inserts an entry into the hash -table. */ -UNIV_INLINE -ibool -ha_insert_for_fold_mutex( -/*=====================*/ - /* out: TRUE if succeed, FALSE if no more - memory could be allocated */ - hash_table_t* table, /* in: hash table */ - ulint fold, /* in: folded value of data; if a node with - the same fold value already exists, it is - updated to point to the same data, and no new - node is created! */ - void* data) /* in: data, must not be NULL */ -{ - ibool ret; - - hash_mutex_enter(table, fold); - - ret = ha_insert_for_fold(table, fold, data); - - hash_mutex_exit(table, fold); - - return(ret); -} diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index 3768e93c03e..399ab8a338e 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -31,13 +31,18 @@ typedef mem_block_info_t mem_block_t; typedef mem_block_t mem_heap_t; /* Types of allocation for memory heaps: DYNAMIC means allocation from the -dynamic memory pool of the C compiler, BUFFER means allocation from the index -page buffer pool; the latter method is used for very big heaps */ +dynamic memory pool of the C compiler, BUFFER means allocation from the +buffer pool; the latter method is used for very big heaps */ #define MEM_HEAP_DYNAMIC 0 /* the most common type */ #define MEM_HEAP_BUFFER 1 -#define MEM_HEAP_BTR_SEARCH 2 /* this flag can be ORed to the - previous */ +#define MEM_HEAP_BTR_SEARCH 2 /* this flag can optionally be + ORed to MEM_HEAP_BUFFER, in which + case heap->free_block is used in + some cases for memory allocations, + and if it's NULL, the memory + allocation functions can return + NULL. */ /* The following start size is used for the first block in the memory heap if the size is not specified, i.e., 0 is given as the parameter in the call of @@ -98,13 +103,15 @@ heap freeing. */ (heap), __FILE__, __LINE__) /********************************************************************* NOTE: Use the corresponding macros instead of this function. Creates a -memory heap which allocates memory from dynamic space. For debugging -purposes, takes also the file name and line as argument. */ +memory heap. For debugging purposes, takes also the file name and line as +arguments. */ UNIV_INLINE mem_heap_t* mem_heap_create_func( /*=================*/ - /* out, own: memory heap */ + /* out, own: memory heap, NULL if + did not succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps)*/ ulint n, /* in: desired start block size, this means that a single user buffer of size n will fit in the block, @@ -121,11 +128,9 @@ mem_heap_create_func( block is not unintentionally erased (if allocated in the stack), before the memory heap is explicitly freed. */ - ulint type, /* in: MEM_HEAP_DYNAMIC - or MEM_HEAP_BUFFER */ + ulint type, /* in: heap type */ const char* file_name, /* in: file name where created */ - ulint line /* in: line where created */ - ); + ulint line); /* in: line where created */ /********************************************************************* NOTE: Use the corresponding macro instead of this function. Frees the space occupied by a memory heap. In the debug version erases the heap memory @@ -143,8 +148,9 @@ UNIV_INLINE void* mem_heap_alloc( /*===========*/ - /* out: allocated storage, NULL if - did not succeed */ + /* out: allocated storage, NULL if did not + succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps) */ mem_heap_t* heap, /* in: memory heap */ ulint n); /* in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be @@ -220,8 +226,7 @@ UNIV_INLINE void* mem_alloc_func( /*===========*/ - /* out, own: free storage, NULL - if did not succeed */ + /* out, own: free storage */ ulint n, /* in: desired number of bytes */ const char* file_name, /* in: file name where created */ ulint line /* in: line where created */ @@ -235,8 +240,7 @@ with mem_free. */ void* mem_alloc_func_noninline( /*=====================*/ - /* out, own: free storage, - NULL if did not succeed */ + /* out, own: free storage */ ulint n, /* in: desired number of bytes */ const char* file_name, /* in: file name where created */ ulint line /* in: line where created */ diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 28562f7c9f8..291b68723b4 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -16,8 +16,9 @@ Creates a memory heap block where data can be allocated. */ mem_block_t* mem_heap_create_block( /*==================*/ - /* out, own: memory heap block, - NULL if did not succeed */ + /* out, own: memory heap block, NULL if + did not succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps) */ mem_heap_t* heap, /* in: memory heap or NULL if first block should be created */ ulint n, /* in: number of bytes needed for user data, or @@ -50,7 +51,8 @@ mem_block_t* mem_heap_add_block( /*===============*/ /* out: created block, NULL if did not - succeed */ + succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps)*/ mem_heap_t* heap, /* in: memory heap */ ulint n); /* in: number of bytes user needs */ @@ -126,7 +128,9 @@ UNIV_INLINE void* mem_heap_alloc( /*===========*/ - /* out: allocated storage */ + /* out: allocated storage, NULL if did not + succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps) */ mem_heap_t* heap, /* in: memory heap */ ulint n) /* in: number of bytes; if the heap is allowed to grow into the buffer pool, this must be @@ -370,13 +374,15 @@ mem_heap_free_top( /********************************************************************* NOTE: Use the corresponding macros instead of this function. Creates a -memory heap which allocates memory from dynamic space. For debugging -purposes, takes also the file name and line as argument. */ +memory heap. For debugging purposes, takes also the file name and line as +argument. */ UNIV_INLINE mem_heap_t* mem_heap_create_func( /*=================*/ - /* out, own: memory heap */ + /* out, own: memory heap, NULL if + did not succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps)*/ ulint n, /* in: desired start block size, this means that a single user buffer of size n will fit in the block, @@ -393,11 +399,9 @@ mem_heap_create_func( block is not unintentionally erased (if allocated in the stack), before the memory heap is explicitly freed. */ - ulint type, /* in: MEM_HEAP_DYNAMIC - or MEM_HEAP_BUFFER */ + ulint type, /* in: heap type */ const char* file_name, /* in: file name where created */ - ulint line /* in: line where created */ - ) + ulint line) /* in: line where created */ { mem_block_t* block; @@ -409,8 +413,11 @@ mem_heap_create_func( init_block, type, file_name, line); } - ut_ad(block); - + if (block == NULL) { + + return(NULL); + } + UT_LIST_INIT(block->base); /* Add the created block itself as the first block in the list */ @@ -418,11 +425,6 @@ mem_heap_create_func( #ifdef UNIV_MEM_DEBUG - if (block == NULL) { - - return(block); - } - mem_hash_insert(block, file_name, line); #endif @@ -484,8 +486,7 @@ UNIV_INLINE void* mem_alloc_func( /*===========*/ - /* out, own: free storage, NULL - if did not succeed */ + /* out, own: free storage */ ulint n, /* in: desired number of bytes */ const char* file_name, /* in: file name where created */ ulint line /* in: line where created */ @@ -496,11 +497,7 @@ mem_alloc_func( heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name, line); - if (heap == NULL) { - return(NULL); - } - /* Note that as we created the first block in the heap big enough for the buffer requested by the caller, the buffer will be in the first block and thus we can calculate the pointer to the heap from diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 7844991613f..ae42dc31f82 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -1705,7 +1705,7 @@ static lock_t* lock_rec_create( /*============*/ - /* out: created lock, NULL if out of memory */ + /* out: created lock */ ulint type_mode,/* in: lock mode and wait flag, type is ignored and replaced by LOCK_REC */ rec_t* rec, /* in: record on page */ @@ -1746,11 +1746,6 @@ lock_rec_create( n_bytes = 1 + n_bits / 8; lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t) + n_bytes); - - if (UNIV_UNLIKELY(lock == NULL)) { - - return(NULL); - } UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock); @@ -1886,8 +1881,7 @@ static lock_t* lock_rec_add_to_queue( /*==================*/ - /* out: lock where the bit was set, NULL if out - of memory */ + /* out: lock where the bit was set */ ulint type_mode,/* in: lock mode, wait, gap etc. flags; type is ignored and replaced by LOCK_REC */ rec_t* rec, /* in: record on page */ @@ -3405,8 +3399,7 @@ UNIV_INLINE lock_t* lock_table_create( /*==============*/ - /* out, own: new lock object, or NULL if - out of memory */ + /* out, own: new lock object */ dict_table_t* table, /* in: database table in dictionary cache */ ulint type_mode,/* in: lock mode possibly ORed with LOCK_WAIT */ @@ -3432,11 +3425,6 @@ lock_table_create( lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t)); } - if (lock == NULL) { - - return(NULL); - } - UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock); lock->type_mode = type_mode | LOCK_TABLE; diff --git a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c index daf78008d45..e1911097ca5 100644 --- a/storage/innobase/mem/mem0mem.c +++ b/storage/innobase/mem/mem0mem.c @@ -92,12 +92,10 @@ with mem_free. */ void* mem_alloc_func_noninline( /*=====================*/ - /* out, own: free storage, - NULL if did not succeed */ + /* out, own: free storage */ ulint n, /* in: desired number of bytes */ const char* file_name, /* in: file name where created */ - ulint line /* in: line where created */ - ) + ulint line) /* in: line where created */ { return(mem_alloc_func(n, file_name, line)); } @@ -122,8 +120,9 @@ Creates a memory heap block where data can be allocated. */ mem_block_t* mem_heap_create_block( /*==================*/ - /* out, own: memory heap block, - NULL if did not succeed */ + /* out, own: memory heap block, NULL if + did not succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps) */ mem_heap_t* heap, /* in: memory heap or NULL if first block should be created */ ulint n, /* in: number of bytes needed for user data, or @@ -182,6 +181,8 @@ mem_heap_create_block( } if (block == NULL) { + /* Only MEM_HEAP_BTR_SEARCH allocation should ever fail. */ + ut_a(type & MEM_HEAP_BTR_SEARCH); return(NULL); } @@ -222,7 +223,8 @@ mem_block_t* mem_heap_add_block( /*===============*/ /* out: created block, NULL if did not - succeed */ + succeed (only possible for + MEM_HEAP_BTR_SEARCH type heaps)*/ mem_heap_t* heap, /* in: memory heap */ ulint n) /* in: number of bytes user needs */ { |