summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-06-18 04:38:58 +0300
committerunknown <monty@mysql.com>2004-06-18 04:38:58 +0300
commit2b9a8afa50c3575f924587588ce13852933d4d15 (patch)
tree7b3b07f5c8491e5a81ca71b19d92dc87ec314192 /innobase/include
parent7d52eabb39d1733f4f10cac0f8f4d0555346ed9a (diff)
parent5fa063ba7eda4bbe70e758b2e5662dbd4edfe961 (diff)
downloadmariadb-git-2b9a8afa50c3575f924587588ce13852933d4d15.tar.gz
Merge with 4.0.21
BitKeeper/etc/logging_ok: auto-union Build-tools/mysql-copyright-2: Auto merged include/violite.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/buf/buf0flu.c: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/fsp/fsp0fsp.c: Auto merged innobase/fut/fut0lst.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/buf0buf.ic: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/data0data.h: Auto merged innobase/include/dict0dict.h: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/fsp0fsp.h: Auto merged innobase/include/hash0hash.h: Auto merged innobase/include/lock0lock.h: Auto merged innobase/include/log0log.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mem0dbg.ic: Auto merged innobase/include/mem0pool.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/sync0rw.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0roll.h: Auto merged innobase/include/trx0trx.h: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/que/que0que.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/sync/sync0sync.c: Auto merged innobase/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/usr/usr0sess.c: Auto merged innobase/ut/ut0mem.c: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_decimal.test: Auto merged mysys/mf_tempfile.c: Auto merged netware/BUILD/nwbootstrap: Auto merged netware/Makefile.am: Auto merged scripts/mysqld_safe.sh: Auto merged sql/item_cmpfunc.cc: Auto merged mysql-test/t/func_if.test: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_parse.cc: Auto merged support-files/my-innodb-heavy-4G.cnf.sh: Auto merged Build-tools/Do-compile: Merge with 4.0 Build-tools/mysql-copyright: Merge with 4.0 client/mysqltest.c: Merge with 4.0 include/my_global.h: Merge with 4.0 innobase/buf/buf0rea.c: Merge with 4.0 innobase/data/data0type.c: Merge with 4.0 innobase/ibuf/ibuf0ibuf.c: Merge with 4.0 innobase/include/buf0buf.h: Merge with 4.0 innobase/include/data0type.h: Merge with 4.0 innobase/include/mem0mem.h: Merge with 4.0 innobase/include/mem0mem.ic: Merge with 4.0 innobase/log/log0recv.c: Merge with 4.0 libmysql/libmysql.c: Merge with 4.0 libmysqld/Makefile.am: Merge with 4.0 mysql-test/r/range.result: Merge with 4.0 mysql-test/r/type_decimal.result: Merge with 4.0 mysql-test/t/range.test: Merge with 4.0 netware/BUILD/mwenv: Merge with 4.0 netware/mysql_test_run.c: Merge with 4.0 scripts/mysql_install_db.sh: Merge with 4.0 sql/field.cc: Merge with 4.0 sql/field.h: Merge with 4.0 sql/item_cmpfunc.h: Merge with 4.0 support-files/my-huge.cnf.sh: Merge with 4.0 support-files/my-large.cnf.sh: Merge with 4.0 support-files/my-medium.cnf.sh: Merge with 4.0 support-files/my-small.cnf.sh: Merge with 4.0 support-files/mysql.spec.sh: Merge with 4.0
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/Makefile.am2
-rw-r--r--innobase/include/btr0btr.h2
-rw-r--r--innobase/include/buf0buf.h10
-rw-r--r--innobase/include/buf0buf.ic4
-rw-r--r--innobase/include/buf0flu.h2
-rw-r--r--innobase/include/buf0lru.h2
-rw-r--r--innobase/include/data0data.h6
-rw-r--r--innobase/include/data0type.h3
-rw-r--r--innobase/include/dict0dict.h14
-rw-r--r--innobase/include/dict0mem.h17
-rw-r--r--innobase/include/fsp0fsp.h2
-rw-r--r--innobase/include/fut0lst.h3
-rw-r--r--innobase/include/hash0hash.h20
-rw-r--r--innobase/include/hash0hash.ic8
-rw-r--r--innobase/include/lock0lock.h6
-rw-r--r--innobase/include/log0log.h4
-rw-r--r--innobase/include/log0log.ic2
-rw-r--r--innobase/include/mem0dbg.h17
-rw-r--r--innobase/include/mem0dbg.ic3
-rw-r--r--innobase/include/mem0mem.h12
-rw-r--r--innobase/include/mem0mem.ic18
-rw-r--r--innobase/include/mem0pool.h3
-rw-r--r--innobase/include/mtr0mtr.h16
-rw-r--r--innobase/include/pars0opt.h2
-rw-r--r--innobase/include/que0que.h38
-rw-r--r--innobase/include/que0que.ic18
-rw-r--r--innobase/include/row0ins.h5
-rw-r--r--innobase/include/row0upd.h5
-rw-r--r--innobase/include/srv0que.h53
-rw-r--r--innobase/include/sync0rw.h2
-rw-r--r--innobase/include/sync0sync.h2
-rw-r--r--innobase/include/trx0roll.h21
-rw-r--r--innobase/include/trx0trx.h31
-rw-r--r--innobase/include/usr0sess.h6
-rw-r--r--innobase/include/ut0mem.h31
35 files changed, 246 insertions, 144 deletions
diff --git a/innobase/include/Makefile.am b/innobase/include/Makefile.am
index 5ec70da97a2..102d25566da 100644
--- a/innobase/include/Makefile.am
+++ b/innobase/include/Makefile.am
@@ -43,7 +43,7 @@ noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \
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 srv0srv.h srv0srv.ic srv0start.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 \
diff --git a/innobase/include/btr0btr.h b/innobase/include/btr0btr.h
index e904db3272f..8606fcd2a5c 100644
--- a/innobase/include/btr0btr.h
+++ b/innobase/include/btr0btr.h
@@ -392,7 +392,6 @@ btr_page_free_low(
page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */
-#ifdef UNIV_DEBUG
/*****************************************************************
Prints size info of a B-tree. */
@@ -409,7 +408,6 @@ btr_print_tree(
dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start
and end */
-#endif /* UNIV_DEBUG */
/****************************************************************
Checks the size and number of fields in a record based on the definition of
the index. */
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 9590fea1276..53599d03c73 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -54,11 +54,9 @@ Created 11/5/1995 Heikki Tuuri
#define BUF_KEEP_OLD 52
extern buf_pool_t* buf_pool; /* The buffer pool of the database */
-#ifdef UNIV_DEBUG
extern ibool buf_debug_prints;/* If this is set TRUE, the program
prints info whenever read or flush
occurs */
-#endif /* UNIV_DEBUG */
/************************************************************************
Creates the buffer pool. */
@@ -478,14 +476,12 @@ buf_pool_is_block(
/*==============*/
/* out: TRUE if pointer to block */
void* ptr); /* in: pointer to memory */
-#ifdef UNIV_DEBUG
/*************************************************************************
Validates the buffer pool data structure. */
ibool
buf_validate(void);
/*==============*/
-#endif /* UNIV_DEBUG */
/************************************************************************
Prints a page to stderr. */
@@ -897,7 +893,7 @@ struct buf_pool_struct{
ulint n_pend_reads; /* number of pending read operations */
- time_t last_printout_time; /* when buf_print_io was last time
+ time_t last_printout_time; /* when buf_print was last time
called */
ulint n_pages_read; /* number read operations */
ulint n_pages_written;/* number write operations */
@@ -912,10 +908,10 @@ struct buf_pool_struct{
ulint n_pages_awe_remapped; /* if AWE is enabled, the
number of remaps of blocks to
buffer frames */
- ulint n_page_gets_old;/* n_page_gets when buf_print_io was
+ ulint n_page_gets_old;/* n_page_gets when buf_print was
last time called: used to calculate
hit rate */
- ulint n_pages_read_old;/* n_pages_read when buf_print_io was
+ ulint n_pages_read_old;/* n_pages_read when buf_print was
last time called */
ulint n_pages_written_old;/* number write operations */
ulint n_pages_created_old;/* number of pages created in
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index fa8421b63ad..681a0ef000a 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -11,6 +11,10 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0rea.h"
#include "mtr0mtr.h"
+extern ulint buf_dbg_counter; /* This is used to insert validation
+ operations in execution in the
+ debug version */
+
/************************************************************************
Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
diff --git a/innobase/include/buf0flu.h b/innobase/include/buf0flu.h
index 6f39eef7210..1b40acaa269 100644
--- a/innobase/include/buf0flu.h
+++ b/innobase/include/buf0flu.h
@@ -97,7 +97,6 @@ buf_flush_ready_for_replace(
/* out: TRUE if can replace immediately */
buf_block_t* block); /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */
-#ifdef UNIV_DEBUG
/**********************************************************************
Validates the flush list. */
@@ -105,7 +104,6 @@ ibool
buf_flush_validate(void);
/*====================*/
/* out: TRUE if ok */
-#endif /* UNIV_DEBUG */
/* When buf_flush_free_margin is called, it tries to make this many blocks
available to replacement in the free list and at the end of the LRU list (to
diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h
index 98aa0252e12..69a376f8cab 100644
--- a/innobase/include/buf0lru.h
+++ b/innobase/include/buf0lru.h
@@ -112,7 +112,6 @@ void
buf_LRU_make_block_old(
/*===================*/
buf_block_t* block); /* in: control block */
-#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */
@@ -125,7 +124,6 @@ Prints the LRU list. */
void
buf_LRU_print(void);
/*===============*/
-#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL
#include "buf0lru.ic"
diff --git a/innobase/include/data0data.h b/innobase/include/data0data.h
index e2de13d0520..2136de0f9b3 100644
--- a/innobase/include/data0data.h
+++ b/innobase/include/data0data.h
@@ -395,11 +395,9 @@ struct dtuple_struct {
UT_LIST_NODE_T(dtuple_t) tuple_list;
/* data tuples can be linked into a
list using this field */
-#ifdef UNIV_DEBUG
- ulint magic_n;
-#define DATA_TUPLE_MAGIC_N 65478679
-#endif /* UNIV_DEBUG */
+ ulint magic_n;
};
+#define DATA_TUPLE_MAGIC_N 65478679
/* A slot for a field in a big rec vector */
diff --git a/innobase/include/data0type.h b/innobase/include/data0type.h
index 2138df97392..fe38a224a66 100644
--- a/innobase/include/data0type.h
+++ b/innobase/include/data0type.h
@@ -305,7 +305,7 @@ dtype_new_read_for_order_and_null_size(
/*===================================*/
dtype_t* type, /* in: type struct */
byte* buf); /* in: buffer for stored type order info */
-#ifdef UNIV_DEBUG
+
/*************************************************************************
Validates a data type structure. */
@@ -314,7 +314,6 @@ dtype_validate(
/*===========*/
/* out: TRUE if ok */
dtype_t* type); /* in: type struct to validate */
-#endif /* UNIV_DEBUG */
/*************************************************************************
Prints a data type structure. */
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index fe04359d6f1..ebb34f7dda0 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -325,19 +325,18 @@ dict_table_get_index_noninline(
dict_table_t* table, /* in: table */
const char* name); /* in: index name */
/**************************************************************************
-Prints a table data. */
+Prints a table definition. */
void
-dict_table_print_low(
-/*=================*/
+dict_table_print(
+/*=============*/
dict_table_t* table); /* in: table */
-#ifdef UNIV_DEBUG
/**************************************************************************
-Prints a table definition. */
+Prints a table data. */
void
-dict_table_print(
-/*=============*/
+dict_table_print_low(
+/*=================*/
dict_table_t* table); /* in: table */
/**************************************************************************
Prints a table data when we know the table name. */
@@ -346,7 +345,6 @@ void
dict_table_print_by_name(
/*=====================*/
const char* name);
-#endif /* UNIV_DEBUG */
/**************************************************************************
Outputs info on foreign keys of a table. */
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index f141ea9da09..3fc3e850987 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -188,12 +188,11 @@ struct dict_tree_struct{
the list; if the tree is of the mixed
type, the first index in the list is the
index of the cluster which owns the tree */
-#ifdef UNIV_DEBUG
ulint magic_n;/* magic number */
-#define DICT_TREE_MAGIC_N 7545676
-#endif /* UNIV_DEBUG */
};
+#define DICT_TREE_MAGIC_N 7545676
+
/* Data structure for an index */
struct dict_index_struct{
dulint id; /* id of the index */
@@ -238,10 +237,7 @@ struct dict_index_struct{
ulint stat_n_leaf_pages;
/* approximate number of leaf pages in the
index tree */
-#ifdef UNIV_DEBUG
ulint magic_n;/* magic number */
-#define DICT_INDEX_MAGIC_N 76789786
-#endif /* UNIV_DEBUG */
};
/* Data structure for a foreign key constraint; an example:
@@ -292,6 +288,9 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
+
+#define DICT_INDEX_MAGIC_N 76789786
+
/* Data structure for a database table */
struct dict_table_struct{
dulint id; /* id of the table or cluster */
@@ -410,12 +409,10 @@ struct dict_table_struct{
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
ib_longlong autoinc;/* autoinc counter value to give to the
- next inserted row */
-#ifdef UNIV_DEBUG
+ next inserted row */
ulint magic_n;/* magic number */
-#define DICT_TABLE_MAGIC_N 76333786
-#endif /* UNIV_DEBUG */
};
+#define DICT_TABLE_MAGIC_N 76333786
#ifndef UNIV_NONINL
#include "dict0mem.ic"
diff --git a/innobase/include/fsp0fsp.h b/innobase/include/fsp0fsp.h
index 20f4f4c2abd..2fcde882df7 100644
--- a/innobase/include/fsp0fsp.h
+++ b/innobase/include/fsp0fsp.h
@@ -332,7 +332,6 @@ void
fsp_print(
/*======*/
ulint space); /* in: space id */
-#ifdef UNIV_DEBUG
/***********************************************************************
Validates a segment. */
@@ -350,7 +349,6 @@ fseg_print(
/*=======*/
fseg_header_t* header, /* in: segment header */
mtr_t* mtr); /* in: mtr */
-#endif /* UNIV_DEBUG */
/* Flags for fsp_reserve_free_extents */
#define FSP_NORMAL 1000000
diff --git a/innobase/include/fut0lst.h b/innobase/include/fut0lst.h
index 3f679d61ab5..5427e2248da 100644
--- a/innobase/include/fut0lst.h
+++ b/innobase/include/fut0lst.h
@@ -181,7 +181,6 @@ flst_validate(
/* out: TRUE if ok */
flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr1); /* in: mtr */
-#ifdef UNIV_DEBUG
/************************************************************************
Prints info of a file-based list. */
@@ -190,7 +189,7 @@ flst_print(
/*=======*/
flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr); /* in: mtr */
-#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "fut0lst.ic"
diff --git a/innobase/include/hash0hash.h b/innobase/include/hash0hash.h
index 79efe016324..51315e40875 100644
--- a/innobase/include/hash0hash.h
+++ b/innobase/include/hash0hash.h
@@ -283,6 +283,21 @@ hash_mutex_exit(
/*============*/
hash_table_t* table, /* in: hash table */
ulint fold); /* in: fold */
+/****************************************************************
+Reserves all the mutexes of a hash table, in an ascending order. */
+
+void
+hash_mutex_enter_all(
+/*=================*/
+ hash_table_t* table); /* in: hash table */
+/****************************************************************
+Releases all the mutexes of a hash table. */
+
+void
+hash_mutex_exit_all(
+/*================*/
+ hash_table_t* table); /* in: hash table */
+
struct hash_cell_struct{
void* node; /* hash chain node, NULL if none */
@@ -303,12 +318,11 @@ struct hash_table_struct {
memory heaps; there are then n_mutexes many of
these heaps */
mem_heap_t* heap;
-#ifdef UNIV_DEBUG
ulint magic_n;
-#define HASH_TABLE_MAGIC_N 76561114
-#endif /* UNIV_DEBUG */
};
+#define HASH_TABLE_MAGIC_N 76561114
+
#ifndef UNIV_NONINL
#include "hash0hash.ic"
#endif
diff --git a/innobase/include/hash0hash.ic b/innobase/include/hash0hash.ic
index 1b9acfa2f34..0d713140c13 100644
--- a/innobase/include/hash0hash.ic
+++ b/innobase/include/hash0hash.ic
@@ -18,7 +18,6 @@ hash_get_nth_cell(
hash_table_t* table, /* in: hash table */
ulint n) /* in: cell index */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(n < table->n_cells);
return(table->array + n);
@@ -33,7 +32,6 @@ hash_get_n_cells(
/* out: number of cells */
hash_table_t* table) /* in: table */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
return(table->n_cells);
}
@@ -47,7 +45,6 @@ hash_calc_hash(
ulint fold, /* in: folded value */
hash_table_t* table) /* in: hash table */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
return(ut_hash_ulint(fold, table->n_cells));
}
@@ -61,7 +58,6 @@ hash_get_mutex_no(
hash_table_t* table, /* in: hash table */
ulint fold) /* in: fold */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
return(ut_2pow_remainder(fold, table->n_mutexes));
}
@@ -75,7 +71,6 @@ hash_get_nth_heap(
hash_table_t* table, /* in: hash table */
ulint i) /* in: index of the heap */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(i < table->n_mutexes);
return(table->heaps[i]);
@@ -93,8 +88,6 @@ hash_get_heap(
{
ulint i;
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
-
if (table->heap) {
return(table->heap);
}
@@ -114,7 +107,6 @@ hash_get_nth_mutex(
hash_table_t* table, /* in: hash table */
ulint i) /* in: index of the mutex */
{
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
ut_ad(i < table->n_mutexes);
return(table->mutexes + i);
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index b1f9a10ee05..9c5f35c6674 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -19,9 +19,7 @@ Created 5/7/1996 Heikki Tuuri
#include "read0types.h"
#include "hash0hash.h"
-#ifdef UNIV_DEBUG
extern ibool lock_print_waits;
-#endif /* UNIV_DEBUG */
/* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file;
@@ -475,7 +473,6 @@ lock_check_trx_id_sanity(
dict_index_t* index, /* in: clustered index */
ibool has_kernel_mutex);/* in: TRUE if the caller owns the
kernel mutex */
-#ifdef UNIV_DEBUG
/*************************************************************************
Validates the lock queue on a single record. */
@@ -485,7 +482,6 @@ lock_rec_queue_validate(
/* out: TRUE if ok */
rec_t* rec, /* in: record to look at */
dict_index_t* index); /* in: index, or NULL if not known */
-#endif /* UNIV_DEBUG */
/*************************************************************************
Prints info of a table lock. */
@@ -509,7 +505,6 @@ void
lock_print_info(
/*============*/
FILE* file); /* in: file where to print */
-#ifdef UNIV_DEBUG
/*************************************************************************
Validates the lock queue on a table. */
@@ -534,7 +529,6 @@ ibool
lock_validate(void);
/*===============*/
/* out: TRUE if ok */
-#endif /* UNIV_DEBUG */
/* The lock system */
extern lock_sys_t* lock_sys;
diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h
index 25adc3b24b7..d14a116072d 100644
--- a/innobase/include/log0log.h
+++ b/innobase/include/log0log.h
@@ -18,9 +18,7 @@ typedef struct log_struct log_t;
typedef struct log_group_struct log_group_t;
extern ibool log_do_write;
-#ifdef UNIV_LOG_DEBUG
extern ibool log_debug_writes;
-#endif /* UNIV_LOG_DEBUG */
/* Wait modes for log_write_up_to */
#define LOG_NO_WAIT 91
@@ -691,13 +689,11 @@ struct log_struct{
ulint max_buf_free; /* recommended maximum value of
buf_free, after which the buffer is
flushed */
-#ifdef UNIV_LOG_DEBUG
ulint old_buf_free; /* value of buf free when log was
last time opened; only in the debug
version */
dulint old_lsn; /* value of lsn when log was last time
opened; only in the debug version */
-#endif /* UNIV_LOG_DEBUG */
ibool check_flush_or_checkpoint;
/* this is set to TRUE when there may
be need to flush the log buffer, or
diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic
index 3a4a3c6a5e6..ca7531783a2 100644
--- a/innobase/include/log0log.ic
+++ b/innobase/include/log0log.ic
@@ -10,7 +10,6 @@ Created 12/9/1995 Heikki Tuuri
#include "mach0data.h"
#include "mtr0mtr.h"
-#ifdef UNIV_LOG_DEBUG
/**********************************************************
Checks by parsing that the catenated log segment for a single mtr is
consistent. */
@@ -22,7 +21,6 @@ log_check_log_recs(
in the log_sys->buf log buffer */
ulint len, /* in: segment length in bytes */
dulint buf_start_lsn); /* in: buffer start lsn */
-#endif /* UNIV_LOG_DEBUG */
/****************************************************************
Gets a log block flush bit. */
diff --git a/innobase/include/mem0dbg.h b/innobase/include/mem0dbg.h
index 61c66cc218c..96f30842df6 100644
--- a/innobase/include/mem0dbg.h
+++ b/innobase/include/mem0dbg.h
@@ -31,7 +31,6 @@ check fields at the both ends of the field. */
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
#endif
-#ifdef UNIV_DEBUG
/*******************************************************************
Checks a memory heap for consistency and prints the contents if requested.
Outputs the sum of sizes of buffers given to the user (only in
@@ -61,7 +60,6 @@ mem_heap_validate_or_print(
ulint* n_blocks); /* out: number of blocks in the heap,
if a NULL pointer is passed as this
argument, it is ignored */
-#endif /* UNIV_DEBUG */
#ifdef UNIV_MEM_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
@@ -71,7 +69,6 @@ mem_heap_print(
/*===========*/
mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_MEM_DEBUG */
-#ifdef UNIV_DEBUG
/******************************************************************
Checks that an object is a memory heap (or a block of it) */
@@ -88,7 +85,6 @@ mem_heap_validate(
/*==============*/
/* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */
-#endif /* UNIV_DEBUG */
#ifdef UNIV_MEM_DEBUG
/*********************************************************************
TRUE if no memory is currently allocated. */
@@ -120,4 +116,17 @@ void
mem_analyze_corruption(
/*===================*/
byte* ptr); /* in: pointer to place of possible corruption */
+/*********************************************************************
+Prints information of dynamic memory usage and currently allocated memory
+heaps or buffers. Can only be used in the debug version. */
+void
+mem_print_info(void);
+/*================*/
+/*********************************************************************
+Prints information of dynamic memory usage and currently allocated memory
+heaps or buffers since the last ..._print_info or..._print_new_info. */
+
+void
+mem_print_new_info(void);
+/*====================*/
diff --git a/innobase/include/mem0dbg.ic b/innobase/include/mem0dbg.ic
index 00db22eb518..7ce5f6f1ba5 100644
--- a/innobase/include/mem0dbg.ic
+++ b/innobase/include/mem0dbg.ic
@@ -56,7 +56,6 @@ mem_hash_insert(
mem_heap_t* heap, /* in: the created heap */
const char* file_name, /* in: file name of creation */
ulint line); /* in: line where created */
-#ifdef UNIV_MEM_DEBUG
/*******************************************************************
Removes a memory heap (which is going to be freed by the caller)
from the list of live memory heaps. Returns the size of the heap
@@ -72,7 +71,7 @@ mem_hash_remove(
mem_heap_t* heap, /* in: the heap to be freed */
const char* file_name, /* in: file name of freeing */
ulint line); /* in: line where freed */
-#endif /* UNIV_MEM_DEBUG */
+
void
mem_field_header_set_len(byte* field, ulint len);
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index 18bffe5732e..cd01ac77bf3 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -261,18 +261,6 @@ mem_free_func(
const char* file_name, /* in: file name where created */
ulint line /* in: line where created */
);
-/*******************************************************************
-Implements realloc. */
-UNIV_INLINE
-void*
-mem_realloc(
-/*========*/
- /* out, own: free storage,
- NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- const char* file_name, /* in: file name where called */
- ulint line); /* in: line where called */
/**************************************************************************
Duplicates a NUL-terminated string. */
diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic
index df3dbf9b576..d97b7d6c4dd 100644
--- a/innobase/include/mem0mem.ic
+++ b/innobase/include/mem0mem.ic
@@ -562,24 +562,6 @@ mem_heap_get_size(
return(size);
}
-/*******************************************************************
-Implements realloc. */
-UNIV_INLINE
-void*
-mem_realloc(
-/*========*/
- /* out, own: free storage,
- NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- const char* file_name, /* in: file name where called */
- ulint line) /* in: line where called */
-{
- mem_free(buf);
-
- return(mem_alloc_func(n, file_name, line));
-}
-
/**************************************************************************
Duplicates a NUL-terminated string. */
UNIV_INLINE
diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h
index 95cf19676fb..43707bd5f61 100644
--- a/innobase/include/mem0pool.h
+++ b/innobase/include/mem0pool.h
@@ -83,7 +83,6 @@ Releases the mem pool mutex. */
void
mem_pool_mutex_exit(void);
/*=====================*/
-#ifdef UNIV_DEBUG
/************************************************************************
Validates a memory pool. */
@@ -100,7 +99,7 @@ mem_pool_print_info(
/*================*/
FILE* outfile,/* in: output file to write to */
mem_pool_t* pool); /* in: memory pool */
-#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "mem0pool.ic"
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 55fa3d80a42..e8c68a91dad 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -246,7 +246,6 @@ mtr_memo_contains(
mtr_t* mtr, /* in: mtr */
void* object, /* in: object to search */
ulint type); /* in: type of object */
-#ifdef UNIV_DEBUG
/*************************************************************
Prints info of an mtr handle. */
@@ -254,7 +253,6 @@ void
mtr_print(
/*======*/
mtr_t* mtr); /* in: mtr */
-#endif /* UNIV_DEBUG */
/*######################################################################*/
#define MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */
@@ -287,12 +285,7 @@ struct mtr_memo_slot_struct{
/* Mini-transaction handle and buffer */
struct mtr_struct{
-#ifdef UNIV_DEBUG
ulint state; /* MTR_ACTIVE, MTR_COMMITTING, MTR_COMMITTED */
-#define MTR_ACTIVE 12231
-#define MTR_COMMITTING 56456
-#define MTR_COMMITTED 34676
-#endif /* UNIV_DEBUG */
dyn_array_t memo; /* memo stack for locks etc. */
dyn_array_t log; /* mini-transaction log */
ibool modifications;
@@ -307,12 +300,15 @@ struct mtr_struct{
this mtr */
dulint end_lsn;/* end lsn of the possible log entry for
this mtr */
-#ifdef UNIV_DEBUG
ulint magic_n;
-#define MTR_MAGIC_N 54551
-#endif /* UNIV_DEBUG */
};
+#define MTR_MAGIC_N 54551
+
+#define MTR_ACTIVE 12231
+#define MTR_COMMITTING 56456
+#define MTR_COMMITTED 34676
+
#ifndef UNIV_NONINL
#include "mtr0mtr.ic"
#endif
diff --git a/innobase/include/pars0opt.h b/innobase/include/pars0opt.h
index ac0e885d05a..d091c3ee2d0 100644
--- a/innobase/include/pars0opt.h
+++ b/innobase/include/pars0opt.h
@@ -43,7 +43,6 @@ opt_find_all_cols(
to add new found columns */
plan_t* plan, /* in: plan or NULL */
que_node_t* exp); /* in: expression or condition */
-#ifdef UNIV_SQL_DEBUG
/************************************************************************
Prints info of a query plan. */
@@ -51,7 +50,6 @@ void
opt_print_query_plan(
/*=================*/
sel_node_t* sel_node); /* in: select node */
-#endif /* UNIV_SQL_DEBUG */
#ifndef UNIV_NONINL
#include "pars0opt.ic"
diff --git a/innobase/include/que0que.h b/innobase/include/que0que.h
index a438116781f..e1874edcaf2 100644
--- a/innobase/include/que0que.h
+++ b/innobase/include/que0que.h
@@ -152,6 +152,17 @@ que_run_threads(
/*============*/
que_thr_t* thr); /* in: query thread which is run initially */
/**************************************************************************
+After signal handling is finished, returns control to a query graph error
+handling routine. (Currently, just returns the control to the root of the
+graph so that the graph can communicate an error message to the client.) */
+
+void
+que_fork_error_handle(
+/*==================*/
+ trx_t* trx, /* in: trx */
+ que_t* fork); /* in: query graph which was run before signal
+ handling started, NULL not allowed */
+/**************************************************************************
Handles an SQL error noticed during query thread execution. At the moment,
does nothing! */
@@ -170,15 +181,18 @@ a single worker thread to execute it. This function should be used to end
the wait state of a query thread waiting for a lock or a stored procedure
completion. */
-que_thr_t*
+void
que_thr_end_wait(
/*=============*/
- /* out: next query thread to run;
- NULL if none */
- que_thr_t* thr); /* in: query thread in the
+ que_thr_t* thr, /* in: query thread in the
QUE_THR_LOCK_WAIT,
or QUE_THR_PROCEDURE_WAIT, or
QUE_THR_SIG_REPLY_WAIT state */
+ que_thr_t** next_thr); /* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread */
/**************************************************************************
Same as que_thr_end_wait, but no parameter next_thr available. */
@@ -293,6 +307,22 @@ que_thr_peek_stop(
mutex reserved is necessary before deciding
the actual stopping */
que_thr_t* thr); /* in: query thread */
+/***************************************************************************
+Returns TRUE if the query graph is for a SELECT statement. */
+UNIV_INLINE
+ibool
+que_graph_is_select(
+/*================*/
+ /* out: TRUE if a select */
+ que_t* graph); /* in: graph */
+/**************************************************************************
+Prints info of an SQL query graph node. */
+
+void
+que_node_print_info(
+/*================*/
+ que_node_t* node); /* in: query graph node */
+
/* Query graph query thread node: the fields are protected by the kernel
mutex with the exceptions named below */
diff --git a/innobase/include/que0que.ic b/innobase/include/que0que.ic
index a63922f8c80..ae4ed10560f 100644
--- a/innobase/include/que0que.ic
+++ b/innobase/include/que0que.ic
@@ -238,3 +238,21 @@ que_thr_peek_stop(
return(FALSE);
}
+
+/***************************************************************************
+Returns TRUE if the query graph is for a SELECT statement. */
+UNIV_INLINE
+ibool
+que_graph_is_select(
+/*================*/
+ /* out: TRUE if a select */
+ que_t* graph) /* in: graph */
+{
+ if (graph->fork_type == QUE_FORK_SELECT_SCROLL
+ || graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
+
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
diff --git a/innobase/include/row0ins.h b/innobase/include/row0ins.h
index f3f0b7e8eca..a5b4b74e7fc 100644
--- a/innobase/include/row0ins.h
+++ b/innobase/include/row0ins.h
@@ -145,12 +145,11 @@ struct ins_node_struct{
entry_list and sys fields are stored here;
if this is NULL, entry list should be created
and buffers for sys fields in row allocated */
-#ifdef UNIV_DEBUG
ulint magic_n;
-#define INS_NODE_MAGIC_N 15849075
-#endif /* UNIV_DEBUG */
};
+#define INS_NODE_MAGIC_N 15849075
+
/* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */
diff --git a/innobase/include/row0upd.h b/innobase/include/row0upd.h
index 687e90deee5..f5e0a88231f 100644
--- a/innobase/include/row0upd.h
+++ b/innobase/include/row0upd.h
@@ -384,12 +384,11 @@ struct upd_node_struct{
sym_node_t* table_sym;/* table node in symbol table */
que_node_t* col_assign_list;
/* column assignment list */
-#ifdef UNIV_DEBUG
ulint magic_n;
-#define UPD_NODE_MAGIC_N 1579975
-#endif /* UNIV_DEBUG */
};
+#define UPD_NODE_MAGIC_N 1579975
+
/* Node execution states */
#define UPD_NODE_SET_IX_LOCK 1 /* execution came to the node from
a node above and if the field
diff --git a/innobase/include/srv0que.h b/innobase/include/srv0que.h
new file mode 100644
index 00000000000..05c339cdd32
--- /dev/null
+++ b/innobase/include/srv0que.h
@@ -0,0 +1,53 @@
+/******************************************************
+Server query execution
+
+(c) 1996 Innobase Oy
+
+Created 6/5/1996 Heikki Tuuri
+*******************************************************/
+
+
+#ifndef srv0que_h
+#define srv0que_h
+
+#include "univ.i"
+#include "que0types.h"
+
+/**************************************************************************
+Checks if there is work to do in the server task queue. If there is, the
+thread starts processing a task. Before leaving, it again checks the task
+queue and picks a new task if any exists. This is called by a SRV_WORKER
+thread. */
+
+void
+srv_que_task_queue_check(void);
+/*==========================*/
+/**************************************************************************
+Performs round-robin on the server tasks. This is called by a SRV_WORKER
+thread every second or so. */
+
+que_thr_t*
+srv_que_round_robin(
+/*================*/
+ /* out: the new (may be == thr) query thread
+ to run */
+ que_thr_t* thr); /* in: query thread */
+/**************************************************************************
+Enqueues a task to server task queue and releases a worker thread, if
+there exists one suspended. */
+
+void
+srv_que_task_enqueue(
+/*=================*/
+ que_thr_t* thr); /* in: query thread */
+/**************************************************************************
+Enqueues a task to server task queue and releases a worker thread, if
+there exists one suspended. */
+
+void
+srv_que_task_enqueue_low(
+/*=====================*/
+ que_thr_t* thr); /* in: query thread */
+
+#endif
+
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 63b01ffac80..9a988a03e92 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -85,7 +85,6 @@ void
rw_lock_free(
/*=========*/
rw_lock_t* lock); /* in: rw-lock */
-#ifdef UNIV_DEBUG
/**********************************************************************
Checks that the rw-lock has been initialized and that there are no
simultaneous shared and exclusive locks. */
@@ -94,7 +93,6 @@ ibool
rw_lock_validate(
/*=============*/
rw_lock_t* lock);
-#endif /* UNIV_DEBUG */
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 4307ca5ba0c..8e0ec715b12 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -143,7 +143,6 @@ void
sync_print(
/*=======*/
FILE* file); /* in: file where to print */
-#ifdef UNIV_DEBUG
/**********************************************************************
Checks that the mutex has been initialized. */
@@ -151,7 +150,6 @@ ibool
mutex_validate(
/*===========*/
mutex_t* mutex);
-#endif /* UNIV_DEBUG */
/**********************************************************************
Sets the mutex latching level field. */
diff --git a/innobase/include/trx0roll.h b/innobase/include/trx0roll.h
index aa88fc249fc..6004551f456 100644
--- a/innobase/include/trx0roll.h
+++ b/innobase/include/trx0roll.h
@@ -91,12 +91,16 @@ trx_undo_rec_release(
/*************************************************************************
Starts a rollback operation. */
-que_thr_t*
+void
trx_rollback(
/*=========*/
- /* out: next query thread to run */
trx_t* trx, /* in: transaction */
- trx_sig_t* sig); /* in: signal starting the rollback */
+ trx_sig_t* sig, /* in: signal starting the rollback */
+ que_thr_t** next_thr);/* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread */
/***********************************************************************
Rollback or clean up transactions which have no user session. If the
transaction already was committed, then we clean up a possible insert
@@ -108,12 +112,17 @@ trx_rollback_or_clean_all_without_sess(void);
/********************************************************************
Finishes a transaction rollback. */
-que_thr_t*
+void
trx_finish_rollback_off_kernel(
/*===========================*/
- /* out: next query thread to run */
que_t* graph, /* in: undo graph which can now be freed */
- trx_t* trx); /* in: transaction */
+ trx_t* trx, /* in: transaction */
+ que_thr_t** next_thr);/* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread; if this parameter is
+ NULL, it is ignored */
/********************************************************************
Builds an undo 'query' graph for a transaction. The actual rollback is
performed by executing this query graph like a query subprocedure call.
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 9b7ac22e617..a8c1df534da 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -194,10 +194,9 @@ trx_end_lock_wait(
/********************************************************************
Sends a signal to a trx object. */
-que_thr_t*
+ibool
trx_sig_send(
/*=========*/
- /* out: next query thread to run */
/* out: TRUE if the signal was
successfully delivered */
trx_t* trx, /* in: trx handle */
@@ -207,17 +206,27 @@ trx_sig_send(
que_thr_t* receiver_thr, /* in: query thread which wants the
reply, or NULL; if type is
TRX_SIG_END_WAIT, this must be NULL */
- trx_savept_t* savept); /* in: possible rollback savepoint, or
+ trx_savept_t* savept, /* in: possible rollback savepoint, or
NULL */
+ que_thr_t** next_thr); /* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread; if the parameter
+ is NULL, it is ignored */
/********************************************************************
Send the reply message when a signal in the queue of the trx has
been handled. */
-que_thr_t*
+void
trx_sig_reply(
/*==========*/
- /* out: next query thread to run */
- trx_sig_t* sig); /* in: signal */
+ trx_sig_t* sig, /* in: signal */
+ que_thr_t** next_thr); /* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread */
/********************************************************************
Removes the signal object from a trx signal queue. */
@@ -229,11 +238,15 @@ trx_sig_remove(
/********************************************************************
Starts handling of a trx signal. */
-que_thr_t*
+void
trx_sig_start_handle(
/*=================*/
- /* out: next query thread to run, or NULL */
- trx_t* trx); /* in: trx handle */
+ trx_t* trx, /* in: trx handle */
+ que_thr_t** next_thr); /* in/out: next query thread to run;
+ if the value which is passed in is
+ a pointer to a NULL pointer, then the
+ calling function can start running
+ a new query thread */
/********************************************************************
Ends signal handling. If the session is in the error state, and
trx->graph_before_signal_handling != NULL, returns control to the error
diff --git a/innobase/include/usr0sess.h b/innobase/include/usr0sess.h
index aeff7191e68..c7bcfb20fed 100644
--- a/innobase/include/usr0sess.h
+++ b/innobase/include/usr0sess.h
@@ -38,6 +38,7 @@ sess_try_close(
/* The session handle. All fields are protected by the kernel mutex */
struct sess_struct{
+ ulint state; /* state of the session */
trx_t* trx; /* transaction object permanently
assigned for the session: the
transaction instance designated by the
@@ -48,6 +49,11 @@ struct sess_struct{
session */
};
+/* Session states */
+#define SESS_ACTIVE 1
+#define SESS_ERROR 2 /* session contains an error message
+ which has not yet been communicated
+ to the client */
#ifndef UNIV_NONINL
#include "usr0sess.ic"
#endif
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index 85b99efff68..2e02b3f0b6b 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -67,6 +67,37 @@ ut_free(
/*====*/
void* ptr); /* in, own: memory block */
/**************************************************************************
+Implements realloc. This is needed by /pars/lexyy.c. Otherwise, you should not
+use this function because the allocation functions in mem0mem.h are the
+recommended ones in InnoDB.
+
+man realloc in Linux, 2004:
+
+ realloc() changes the size of the memory block pointed to
+ by ptr to size bytes. The contents will be unchanged to
+ the minimum of the old and new sizes; newly allocated mem­
+ ory will be uninitialized. If ptr is NULL, the call is
+ equivalent to malloc(size); if size is equal to zero, the
+ call is equivalent to free(ptr). Unless ptr is NULL, it
+ must have been returned by an earlier call to malloc(),
+ calloc() or realloc().
+
+RETURN VALUE
+ realloc() returns a pointer to the newly allocated memory,
+ which is suitably aligned for any kind of variable and may
+ be different from ptr, or NULL if the request fails. If
+ size was equal to 0, either NULL or a pointer suitable to
+ be passed to free() is returned. If realloc() fails the
+ original block is left untouched - it is not freed or
+ moved. */
+
+void*
+ut_realloc(
+/*=======*/
+ /* out, own: pointer to new mem block or NULL */
+ void* ptr, /* in: pointer to old block or NULL */
+ ulint size); /* in: desired size */
+/**************************************************************************
Frees in shutdown all allocated memory not freed yet. */
void