Commit 5f032c0e authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new
parents b5b0a3d6 9ca31046
...@@ -2437,7 +2437,9 @@ a b ...@@ -2437,7 +2437,9 @@ a b
20 NULL 20 NULL
drop table t1; drop table t1;
create table t1 (v varchar(65530), key(v)); create table t1 (v varchar(65530), key(v));
ERROR HY000: Can't create table 'test.t1' (errno: 139) Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
drop table t1;
create table t1 (v varchar(65536)); create table t1 (v varchar(65536));
Warnings: Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT Note 1246 Converting column 'v' from VARCHAR to TEXT
...@@ -2577,22 +2579,49 @@ create table t8 (col1 blob, index(col1(767))) ...@@ -2577,22 +2579,49 @@ create table t8 (col1 blob, index(col1(767)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
show create table t9;
Table Create Table
t9 CREATE TABLE `t9` (
`col1` varchar(512) default NULL,
`col2` varchar(512) default NULL,
KEY `col1` (`col1`,`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
create table t1 (col1 varchar(768), index (col1)) create table t1 (col1 varchar(768), index(col1))
character set = latin1 engine = innodb;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
create table t2 (col1 varbinary(768), index(col1))
character set = latin1 engine = innodb;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
create table t3 (col1 text, index(col1(768)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
ERROR HY000: Can't create table 'test.t1' (errno: 139) Warnings:
create table t2 (col1 varchar(768) primary key) Warning 1071 Specified key was too long; max key length is 767 bytes
create table t4 (col1 blob, index(col1(768)))
character set = latin1 engine = innodb;
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`col1` varchar(768) default NULL,
KEY `col1` (`col1`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4;
create table t1 (col1 varchar(768) primary key)
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
ERROR HY000: Can't create table 'test.t2' (errno: 139) ERROR 42000: Specified key was too long; max key length is 767 bytes
create table t3 (col1 varbinary(768) primary key) create table t2 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
ERROR HY000: Can't create table 'test.t3' (errno: 139) ERROR 42000: Specified key was too long; max key length is 767 bytes
create table t4 (col1 text, index(col1(768))) create table t3 (col1 text, primary key(col1(768)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
ERROR HY000: Can't create table 'test.t4' (errno: 139) ERROR 42000: Specified key was too long; max key length is 767 bytes
create table t5 (col1 blob, index(col1(768))) create table t4 (col1 blob, primary key(col1(768)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
ERROR HY000: Can't create table 'test.t5' (errno: 139) ERROR 42000: Specified key was too long; max key length is 767 bytes
CREATE TABLE t1 CREATE TABLE t1
( (
id INT PRIMARY KEY id INT PRIMARY KEY
......
...@@ -1356,8 +1356,8 @@ source include/varchar.inc; ...@@ -1356,8 +1356,8 @@ source include/varchar.inc;
# Clean up filename -- embedded server reports whole path without .frm, # Clean up filename -- embedded server reports whole path without .frm,
# regular server reports relative path with .frm (argh!) # regular server reports relative path with .frm (argh!)
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 --replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1
--error 1005
create table t1 (v varchar(65530), key(v)); create table t1 (v varchar(65530), key(v));
drop table t1;
create table t1 (v varchar(65536)); create table t1 (v varchar(65536));
show create table t1; show create table t1;
drop table t1; drop table t1;
...@@ -1485,7 +1485,7 @@ CREATE TEMPORARY TABLE t2 ...@@ -1485,7 +1485,7 @@ CREATE TEMPORARY TABLE t2
DROP TABLE t1; DROP TABLE t1;
# #
# Test that index column max sizes are checked (bug #13315) # Test that index column max sizes are honored (bug #13315)
# #
# prefix index # prefix index
...@@ -1512,22 +1512,36 @@ create table t8 (col1 blob, index(col1(767))) ...@@ -1512,22 +1512,36 @@ create table t8 (col1 blob, index(col1(767)))
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
show create table t9;
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
--error 1005 # these should have their index length trimmed
create table t1 (col1 varchar(768), index (col1)) create table t1 (col1 varchar(768), index(col1))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
--error 1005 create table t2 (col1 varbinary(768), index(col1))
create table t2 (col1 varchar(768) primary key)
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
--error 1005 create table t3 (col1 text, index(col1(768)))
create table t3 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
--error 1005 create table t4 (col1 blob, index(col1(768)))
create table t4 (col1 text, index(col1(768)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
--error 1005
create table t5 (col1 blob, index(col1(768))) show create table t1;
drop table t1, t2, t3, t4;
# these should be refused
--error 1071
create table t1 (col1 varchar(768) primary key)
character set = latin1 engine = innodb;
--error 1071
create table t2 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb;
--error 1071
create table t3 (col1 text, primary key(col1(768)))
character set = latin1 engine = innodb;
--error 1071
create table t4 (col1 blob, primary key(col1(768)))
character set = latin1 engine = innodb; character set = latin1 engine = innodb;
# #
......
...@@ -968,9 +968,9 @@ drop table t1; ...@@ -968,9 +968,9 @@ drop table t1;
--error 1 --error 1
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out --exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
# The .out file should be empty, cat will fail! # The .out file should be empty
--error 1 --error 1
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out --exec test -s $MYSQL_TEST_DIR/var/tmp/bug11731.out
drop table t1; drop table t1;
......
...@@ -52,9 +52,8 @@ start slave; ...@@ -52,9 +52,8 @@ start slave;
# which proves that the transaction restarted at # which proves that the transaction restarted at
# the right place. # the right place.
# We must wait for the transaction to commit before # We must wait for the transaction to commit before
# reading, MASTER_POS_WAIT() will do it for sure # reading:
# (the only statement with position>=3000 is COMMIT). sync_with_master;
select master_pos_wait('master-bin.001',3000)>=0;
select max(a) from t1; select max(a) from t1;
connection master; connection master;
......
...@@ -2540,6 +2540,12 @@ ha_innobase::open( ...@@ -2540,6 +2540,12 @@ ha_innobase::open(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
uint
ha_innobase::max_supported_key_part_length() const
{
return(DICT_MAX_INDEX_COL_LEN - 1);
}
/********************************************************************** /**********************************************************************
Closes a handle to an InnoDB table. */ Closes a handle to an InnoDB table. */
...@@ -4698,6 +4704,9 @@ create_index( ...@@ -4698,6 +4704,9 @@ create_index(
0, prefix_len); 0, prefix_len);
} }
/* Even though we've defined max_supported_key_part_length, we
still do our own checking using field_lengths to be absolutely
sure we don't create too long indexes. */
error = row_create_index_for_mysql(index, trx, field_lengths); error = row_create_index_for_mysql(index, trx, field_lengths);
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
......
...@@ -110,7 +110,7 @@ class ha_innobase: public handler ...@@ -110,7 +110,7 @@ class ha_innobase: public handler
but currently MySQL does not work with keys but currently MySQL does not work with keys
whose size is > MAX_KEY_LENGTH */ whose size is > MAX_KEY_LENGTH */
uint max_supported_key_length() const { return 3500; } uint max_supported_key_length() const { return 3500; }
uint max_supported_key_part_length() const { return 3500; } uint max_supported_key_part_length() const;
const key_map *keys_to_use_for_scanning() { return &key_map_full; } const key_map *keys_to_use_for_scanning() { return &key_map_full; }
bool has_transactions() { return 1;} bool has_transactions() { return 1;}
......
...@@ -886,7 +886,7 @@ void sp_head::recursion_level_error() ...@@ -886,7 +886,7 @@ void sp_head::recursion_level_error()
THD *thd= current_thd; THD *thd= current_thd;
my_error(ER_SP_RECURSION_LIMIT, MYF(0), my_error(ER_SP_RECURSION_LIMIT, MYF(0),
thd->variables.max_sp_recursion_depth, thd->variables.max_sp_recursion_depth,
m_name); m_name.str);
} }
else else
my_error(ER_SP_NO_RECURSION, MYF(0)); my_error(ER_SP_NO_RECURSION, MYF(0));
......
...@@ -1877,13 +1877,12 @@ File create_frm(THD *thd, const char *name, const char *db, ...@@ -1877,13 +1877,12 @@ File create_frm(THD *thd, const char *name, const char *db,
if (create_info->options & HA_LEX_CREATE_TMP_TABLE) if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= O_EXCL | O_NOFOLLOW; create_flags|= O_EXCL | O_NOFOLLOW;
#if SIZEOF_OFF_T > 4
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */ /* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
if (create_info->max_rows > UINT_MAX32) if (create_info->max_rows > UINT_MAX32)
create_info->max_rows= UINT_MAX32; create_info->max_rows= UINT_MAX32;
if (create_info->min_rows > UINT_MAX32) if (create_info->min_rows > UINT_MAX32)
create_info->min_rows= UINT_MAX32; create_info->min_rows= UINT_MAX32;
#endif
/* /*
Ensure that raid_chunks can't be larger than 255, as this would cause Ensure that raid_chunks can't be larger than 255, as this would cause
problems with drop database problems with drop database
......
...@@ -23,7 +23,7 @@ TAR = gtar ...@@ -23,7 +23,7 @@ TAR = gtar
noinst_HEADERS = ib_config.h noinst_HEADERS = ib_config.h
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \ 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 pars que read rem row srv sync thr trx usr
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
......
...@@ -128,7 +128,7 @@ AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl ...@@ -128,7 +128,7 @@ AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
buf/Makefile data/Makefile dnl buf/Makefile data/Makefile dnl
dict/Makefile dyn/Makefile dnl dict/Makefile dyn/Makefile dnl
eval/Makefile fil/Makefile fsp/Makefile fut/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 lock/Makefile log/Makefile dnl
mach/Makefile mem/Makefile mtr/Makefile dnl mach/Makefile mem/Makefile mtr/Makefile dnl
page/Makefile pars/Makefile que/Makefile dnl page/Makefile pars/Makefile que/Makefile dnl
......
/******************************************************
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
...@@ -40,9 +40,13 @@ ha_create( ...@@ -40,9 +40,13 @@ ha_create(
table->adaptive = FALSE; 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 (n_mutexes == 0) {
if (in_btr_search) { if (in_btr_search) {
table->heap = mem_heap_create_in_btr_search(4096); table->heap = mem_heap_create_in_btr_search(4096);
ut_a(table->heap);
} else { } else {
table->heap = mem_heap_create_in_buffer(4096); table->heap = mem_heap_create_in_buffer(4096);
} }
...@@ -57,6 +61,7 @@ ha_create( ...@@ -57,6 +61,7 @@ ha_create(
for (i = 0; i < n_mutexes; i++) { for (i = 0; i < n_mutexes; i++) {
if (in_btr_search) { if (in_btr_search) {
table->heaps[i] = mem_heap_create_in_btr_search(4096); table->heaps[i] = mem_heap_create_in_btr_search(4096);
ut_a(table->heaps[i]);
} else { } else {
table->heaps[i] = mem_heap_create_in_buffer(4096); table->heaps[i] = mem_heap_create_in_buffer(4096);
} }
......
# 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.%
...@@ -68,21 +68,6 @@ ha_insert_for_fold( ...@@ -68,21 +68,6 @@ ha_insert_for_fold(
node is created! */ node is created! */
void* data); /* in: data, must not be NULL */ 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. */ Deletes an entry from a hash table. */
void void
......
...@@ -191,30 +191,3 @@ ha_search_and_delete_if_found( ...@@ -191,30 +191,3 @@ ha_search_and_delete_if_found(
return(FALSE); 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);
}
...@@ -31,13 +31,18 @@ typedef mem_block_info_t mem_block_t; ...@@ -31,13 +31,18 @@ typedef mem_block_info_t mem_block_t;
typedef mem_block_t mem_heap_t; typedef mem_block_t mem_heap_t;
/* Types of allocation for memory heaps: DYNAMIC means allocation from the /* Types of allocation for memory heaps: DYNAMIC means allocation from the
dynamic memory pool of the C compiler, BUFFER means allocation from the index dynamic memory pool of the C compiler, BUFFER means allocation from the
page buffer pool; the latter method is used for very big heaps */ buffer pool; the latter method is used for very big heaps */
#define MEM_HEAP_DYNAMIC 0 /* the most common type */ #define MEM_HEAP_DYNAMIC 0 /* the most common type */
#define MEM_HEAP_BUFFER 1 #define MEM_HEAP_BUFFER 1
#define MEM_HEAP_BTR_SEARCH 2 /* this flag can be ORed to the #define MEM_HEAP_BTR_SEARCH 2 /* this flag can optionally be
previous */ 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 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 the size is not specified, i.e., 0 is given as the parameter in the call of
...@@ -98,13 +103,15 @@ heap freeing. */ ...@@ -98,13 +103,15 @@ heap freeing. */
(heap), __FILE__, __LINE__) (heap), __FILE__, __LINE__)
/********************************************************************* /*********************************************************************
NOTE: Use the corresponding macros instead of this function. Creates a NOTE: Use the corresponding macros instead of this function. Creates a
memory heap which allocates memory from dynamic space. For debugging memory heap. For debugging purposes, takes also the file name and line as
purposes, takes also the file name and line as argument. */ arguments. */
UNIV_INLINE UNIV_INLINE
mem_heap_t* mem_heap_t*
mem_heap_create_func( 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, ulint n, /* in: desired start block size,
this means that a single user buffer this means that a single user buffer
of size n will fit in the block, of size n will fit in the block,
...@@ -121,11 +128,9 @@ mem_heap_create_func( ...@@ -121,11 +128,9 @@ mem_heap_create_func(
block is not unintentionally erased block is not unintentionally erased
(if allocated in the stack), before (if allocated in the stack), before
the memory heap is explicitly freed. */ the memory heap is explicitly freed. */
ulint type, /* in: MEM_HEAP_DYNAMIC ulint type, /* in: heap type */
or MEM_HEAP_BUFFER */
const char* file_name, /* in: file name where created */ 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 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 occupied by a memory heap. In the debug version erases the heap memory
...@@ -143,8 +148,9 @@ UNIV_INLINE ...@@ -143,8 +148,9 @@ UNIV_INLINE
void* void*
mem_heap_alloc( mem_heap_alloc(
/*===========*/ /*===========*/
/* out: allocated storage, NULL if /* out: allocated storage, NULL if did not
did not succeed */ succeed (only possible for
MEM_HEAP_BTR_SEARCH type heaps) */
mem_heap_t* heap, /* in: memory heap */ mem_heap_t* heap, /* in: memory heap */
ulint n); /* in: number of bytes; if the heap is allowed ulint n); /* in: number of bytes; if the heap is allowed
to grow into the buffer pool, this must be to grow into the buffer pool, this must be
...@@ -220,8 +226,7 @@ UNIV_INLINE ...@@ -220,8 +226,7 @@ UNIV_INLINE
void* void*
mem_alloc_func( mem_alloc_func(
/*===========*/ /*===========*/
/* out, own: free storage, NULL /* out, own: free storage */
if did not succeed */
ulint n, /* in: desired number of bytes */ ulint n, /* in: desired number of bytes */
const char* file_name, /* in: file name where created */ const char* file_name, /* in: file name where created */
ulint line /* in: line where created */ ulint line /* in: line where created */
...@@ -235,8 +240,7 @@ with mem_free. */ ...@@ -235,8 +240,7 @@ with mem_free. */
void* void*
mem_alloc_func_noninline( mem_alloc_func_noninline(
/*=====================*/ /*=====================*/
/* out, own: free storage, /* out, own: free storage */
NULL if did not succeed */
ulint n, /* in: desired number of bytes */ ulint n, /* in: desired number of bytes */
const char* file_name, /* in: file name where created */ const char* file_name, /* in: file name where created */
ulint line /* in: line where created */ ulint line /* in: line where created */
......
...@@ -16,8 +16,9 @@ Creates a memory heap block where data can be allocated. */ ...@@ -16,8 +16,9 @@ Creates a memory heap block where data can be allocated. */
mem_block_t* mem_block_t*
mem_heap_create_block( mem_heap_create_block(
/*==================*/ /*==================*/
/* out, own: memory heap block, /* out, own: memory heap block, NULL if
NULL if did not succeed */ did not succeed (only possible for
MEM_HEAP_BTR_SEARCH type heaps) */
mem_heap_t* heap, /* in: memory heap or NULL if first block mem_heap_t* heap, /* in: memory heap or NULL if first block
should be created */ should be created */
ulint n, /* in: number of bytes needed for user data, or ulint n, /* in: number of bytes needed for user data, or
...@@ -50,7 +51,8 @@ mem_block_t* ...@@ -50,7 +51,8 @@ mem_block_t*
mem_heap_add_block( mem_heap_add_block(
/*===============*/ /*===============*/
/* out: created block, NULL if did not /* 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 */ mem_heap_t* heap, /* in: memory heap */
ulint n); /* in: number of bytes user needs */ ulint n); /* in: number of bytes user needs */
...@@ -126,7 +128,9 @@ UNIV_INLINE ...@@ -126,7 +128,9 @@ UNIV_INLINE
void* void*
mem_heap_alloc( 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 */ mem_heap_t* heap, /* in: memory heap */
ulint n) /* in: number of bytes; if the heap is allowed ulint n) /* in: number of bytes; if the heap is allowed
to grow into the buffer pool, this must be to grow into the buffer pool, this must be
...@@ -370,13 +374,15 @@ mem_heap_free_top( ...@@ -370,13 +374,15 @@ mem_heap_free_top(
/********************************************************************* /*********************************************************************
NOTE: Use the corresponding macros instead of this function. Creates a NOTE: Use the corresponding macros instead of this function. Creates a
memory heap which allocates memory from dynamic space. For debugging memory heap. For debugging purposes, takes also the file name and line as
purposes, takes also the file name and line as argument. */ argument. */
UNIV_INLINE UNIV_INLINE
mem_heap_t* mem_heap_t*
mem_heap_create_func( 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, ulint n, /* in: desired start block size,
this means that a single user buffer this means that a single user buffer
of size n will fit in the block, of size n will fit in the block,
...@@ -393,11 +399,9 @@ mem_heap_create_func( ...@@ -393,11 +399,9 @@ mem_heap_create_func(
block is not unintentionally erased block is not unintentionally erased
(if allocated in the stack), before (if allocated in the stack), before
the memory heap is explicitly freed. */ the memory heap is explicitly freed. */
ulint type, /* in: MEM_HEAP_DYNAMIC ulint type, /* in: heap type */
or MEM_HEAP_BUFFER */
const char* file_name, /* in: file name where created */ 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; mem_block_t* block;
...@@ -409,7 +413,10 @@ mem_heap_create_func( ...@@ -409,7 +413,10 @@ mem_heap_create_func(
init_block, type, file_name, line); init_block, type, file_name, line);
} }
ut_ad(block); if (block == NULL) {
return(NULL);
}
UT_LIST_INIT(block->base); UT_LIST_INIT(block->base);
...@@ -418,11 +425,6 @@ mem_heap_create_func( ...@@ -418,11 +425,6 @@ mem_heap_create_func(
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
if (block == NULL) {
return(block);
}
mem_hash_insert(block, file_name, line); mem_hash_insert(block, file_name, line);
#endif #endif
...@@ -484,8 +486,7 @@ UNIV_INLINE ...@@ -484,8 +486,7 @@ UNIV_INLINE
void* void*
mem_alloc_func( mem_alloc_func(
/*===========*/ /*===========*/
/* out, own: free storage, NULL /* out, own: free storage */
if did not succeed */
ulint n, /* in: desired number of bytes */ ulint n, /* in: desired number of bytes */
const char* file_name, /* in: file name where created */ const char* file_name, /* in: file name where created */
ulint line /* in: line where created */ ulint line /* in: line where created */
...@@ -496,10 +497,6 @@ mem_alloc_func( ...@@ -496,10 +497,6 @@ mem_alloc_func(
heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name, heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name,
line); line);
if (heap == NULL) {
return(NULL);
}
/* Note that as we created the first block in the heap big enough /* 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 for the buffer requested by the caller, the buffer will be in the
......
...@@ -1705,7 +1705,7 @@ static ...@@ -1705,7 +1705,7 @@ static
lock_t* lock_t*
lock_rec_create( 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 ulint type_mode,/* in: lock mode and wait flag, type is
ignored and replaced by LOCK_REC */ ignored and replaced by LOCK_REC */
rec_t* rec, /* in: record on page */ rec_t* rec, /* in: record on page */
...@@ -1747,11 +1747,6 @@ lock_rec_create( ...@@ -1747,11 +1747,6 @@ lock_rec_create(
lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t) + n_bytes); 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); UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
lock->trx = trx; lock->trx = trx;
...@@ -1886,8 +1881,7 @@ static ...@@ -1886,8 +1881,7 @@ static
lock_t* lock_t*
lock_rec_add_to_queue( lock_rec_add_to_queue(
/*==================*/ /*==================*/
/* out: lock where the bit was set, NULL if out /* out: lock where the bit was set */
of memory */
ulint type_mode,/* in: lock mode, wait, gap etc. flags; ulint type_mode,/* in: lock mode, wait, gap etc. flags;
type is ignored and replaced by LOCK_REC */ type is ignored and replaced by LOCK_REC */
rec_t* rec, /* in: record on page */ rec_t* rec, /* in: record on page */
...@@ -3405,8 +3399,7 @@ UNIV_INLINE ...@@ -3405,8 +3399,7 @@ UNIV_INLINE
lock_t* lock_t*
lock_table_create( lock_table_create(
/*==============*/ /*==============*/
/* out, own: new lock object, or NULL if /* out, own: new lock object */
out of memory */
dict_table_t* table, /* in: database table in dictionary cache */ dict_table_t* table, /* in: database table in dictionary cache */
ulint type_mode,/* in: lock mode possibly ORed with ulint type_mode,/* in: lock mode possibly ORed with
LOCK_WAIT */ LOCK_WAIT */
...@@ -3432,11 +3425,6 @@ lock_table_create( ...@@ -3432,11 +3425,6 @@ lock_table_create(
lock = mem_heap_alloc(trx->lock_heap, sizeof(lock_t)); 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); UT_LIST_ADD_LAST(trx_locks, trx->trx_locks, lock);
lock->type_mode = type_mode | LOCK_TABLE; lock->type_mode = type_mode | LOCK_TABLE;
......
...@@ -92,12 +92,10 @@ with mem_free. */ ...@@ -92,12 +92,10 @@ with mem_free. */
void* void*
mem_alloc_func_noninline( mem_alloc_func_noninline(
/*=====================*/ /*=====================*/
/* out, own: free storage, /* out, own: free storage */
NULL if did not succeed */
ulint n, /* in: desired number of bytes */ ulint n, /* in: desired number of bytes */
const char* file_name, /* in: file name where created */ 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)); return(mem_alloc_func(n, file_name, line));
} }
...@@ -122,8 +120,9 @@ Creates a memory heap block where data can be allocated. */ ...@@ -122,8 +120,9 @@ Creates a memory heap block where data can be allocated. */
mem_block_t* mem_block_t*
mem_heap_create_block( mem_heap_create_block(
/*==================*/ /*==================*/
/* out, own: memory heap block, /* out, own: memory heap block, NULL if
NULL if did not succeed */ did not succeed (only possible for
MEM_HEAP_BTR_SEARCH type heaps) */
mem_heap_t* heap, /* in: memory heap or NULL if first block mem_heap_t* heap, /* in: memory heap or NULL if first block
should be created */ should be created */
ulint n, /* in: number of bytes needed for user data, or ulint n, /* in: number of bytes needed for user data, or
...@@ -182,6 +181,8 @@ mem_heap_create_block( ...@@ -182,6 +181,8 @@ mem_heap_create_block(
} }
if (block == NULL) { if (block == NULL) {
/* Only MEM_HEAP_BTR_SEARCH allocation should ever fail. */
ut_a(type & MEM_HEAP_BTR_SEARCH);
return(NULL); return(NULL);
} }
...@@ -222,7 +223,8 @@ mem_block_t* ...@@ -222,7 +223,8 @@ mem_block_t*
mem_heap_add_block( mem_heap_add_block(
/*===============*/ /*===============*/
/* out: created block, NULL if did not /* 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 */ mem_heap_t* heap, /* in: memory heap */
ulint n) /* in: number of bytes user needs */ ulint n) /* in: number of bytes user needs */
{ {
......
...@@ -368,7 +368,6 @@ BuildMySQL "--disable-shared \ ...@@ -368,7 +368,6 @@ BuildMySQL "--disable-shared \
--with-mysqld-ldflags='-all-static' \ --with-mysqld-ldflags='-all-static' \
--with-client-ldflags='-all-static' \ --with-client-ldflags='-all-static' \
$USE_OTHER_LIBC_DIR \ $USE_OTHER_LIBC_DIR \
%else
%endif %endif
--with-zlib-dir=bundled \ --with-zlib-dir=bundled \
--with-comment=\"MySQL Community Edition - Standard (GPL)\" \ --with-comment=\"MySQL Community Edition - Standard (GPL)\" \
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
pkglib_LTLIBRARIES=libz.la pkglib_LTLIBRARIES=libz.la
libz_la_LDFLAGS= -version-info 3:3:2
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \ noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \
inftrees.h trees.h zconf.h zlib.h zutil.h inftrees.h trees.h zconf.h zlib.h zutil.h
......
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