summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
committerunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
commita8aacf87648f64e7489220dab7d8729c5c01e13d (patch)
treeaf285d8080c003d1ecb1479ec43c9b6996fd567f /innobase/include
parent17f8d3d725f4b465a8a0dc8e96b04cd973c47fd5 (diff)
parent277cf702da7e6f0642742eb10582cfc382e537ec (diff)
downloadmariadb-git-a8aacf87648f64e7489220dab7d8729c5c01e13d.tar.gz
merge with 4.0
BitKeeper/etc/logging_ok: auto-union VC++Files/innobase/innobase.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged acinclude.m4: Auto merged configure.in: Auto merged BitKeeper/deleted/.del-com0shm.c~6a16f0c3d81de1f: Auto merged BitKeeper/deleted/.del-mysql_fix_privilege_tables.sql: Auto merged extra/replace.c: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/configure.in: Auto merged innobase/data/data0data.c: Auto merged innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/ha/ha0ha.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/btr0btr.ic: Auto merged innobase/include/data0type.ic: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mach0data.ic: Auto merged innobase/include/mtr0log.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/row0upd.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0rseg.ic: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mtr/mtr0log.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0file.c: Auto merged innobase/page/page0cur.c: Auto merged innobase/page/page0page.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/read/read0read.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/rem/rem0rec.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0undo.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/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0rec.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/rpl_error_ignored_table.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysys/mf_iocache.c: Auto merged mysys/mf_pack.c: Auto merged mysys/my_getopt.c: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged tests/thread_test.c: Auto merged client/mysqldump.c: Keep original indentation mysql-test/r/merge.result: keep old file scripts/mysql_fix_privilege_tables.sh: Keep old structure in merge with 4.0 sql/table.cc: merge with 4.0 + simple optimizations
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/Makefile.am7
-rw-r--r--innobase/include/btr0btr.ic3
-rw-r--r--innobase/include/btr0sea.ic6
-rw-r--r--innobase/include/buf0buf.h5
-rw-r--r--innobase/include/buf0buf.ic18
-rw-r--r--innobase/include/buf0flu.ic4
-rw-r--r--innobase/include/com0com.h125
-rw-r--r--innobase/include/com0com.ic7
-rw-r--r--innobase/include/com0shm.h103
-rw-r--r--innobase/include/com0shm.ic7
-rw-r--r--innobase/include/data0data.h6
-rw-r--r--innobase/include/data0type.ic2
-rw-r--r--innobase/include/dict0dict.ic10
-rw-r--r--innobase/include/dict0mem.h17
-rw-r--r--innobase/include/fut0fut.ic2
-rw-r--r--innobase/include/ha0ha.ic8
-rw-r--r--innobase/include/hash0hash.h75
-rw-r--r--innobase/include/hash0hash.ic8
-rw-r--r--innobase/include/ib_odbc.h149
-rw-r--r--innobase/include/lock0lock.ic2
-rw-r--r--innobase/include/log0log.ic8
-rw-r--r--innobase/include/mach0data.h19
-rw-r--r--innobase/include/mach0data.ic38
-rw-r--r--innobase/include/mem0dbg.ic2
-rw-r--r--innobase/include/mtr0log.h1
-rw-r--r--innobase/include/mtr0mtr.h15
-rw-r--r--innobase/include/odbc0odbc.h20
-rw-r--r--innobase/include/os0file.h3
-rw-r--r--innobase/include/pars0pars.h31
-rw-r--r--innobase/include/que0que.h9
-rw-r--r--innobase/include/row0ins.h5
-rw-r--r--innobase/include/row0upd.h5
-rw-r--r--innobase/include/row0upd.ic2
-rw-r--r--innobase/include/srv0srv.h4
-rw-r--r--innobase/include/sync0rw.h14
-rw-r--r--innobase/include/sync0rw.ic9
-rw-r--r--innobase/include/sync0sync.h14
-rw-r--r--innobase/include/sync0sync.ic9
-rw-r--r--innobase/include/trx0rseg.ic8
-rw-r--r--innobase/include/trx0sys.ic22
-rw-r--r--innobase/include/trx0trx.h19
-rw-r--r--innobase/include/trx0undo.ic4
-rw-r--r--innobase/include/usr0sess.h218
-rw-r--r--innobase/include/usr0sess.ic24
-rw-r--r--innobase/include/usr0types.h2
-rw-r--r--innobase/include/ut0dbg.h23
46 files changed, 206 insertions, 886 deletions
diff --git a/innobase/include/Makefile.am b/innobase/include/Makefile.am
index ab1f14d0770..2584357e24a 100644
--- a/innobase/include/Makefile.am
+++ b/innobase/include/Makefile.am
@@ -18,21 +18,20 @@
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 com0com.h com0com.ic \
- com0shm.h com0shm.ic data0data.h data0data.ic data0type.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 ib_odbc.h \
+ 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 makefilewin.i \
mem0dbg.h mem0dbg.ic mem0mem.h mem0mem.ic mem0pool.h \
mem0pool.ic mtr0log.h mtr0log.ic mtr0mtr.h mtr0mtr.ic \
- mtr0types.h odbc0odbc.h os0file.h os0proc.h os0proc.ic \
+ mtr0types.h os0file.h os0proc.h os0proc.ic \
os0shm.h os0shm.ic os0sync.h os0sync.ic os0thread.h \
os0thread.ic page0cur.h page0cur.ic page0page.h \
page0page.ic page0types.h pars0grm.h pars0opt.h \
diff --git a/innobase/include/btr0btr.ic b/innobase/include/btr0btr.ic
index 301a73b3444..b0aa0756307 100644
--- a/innobase/include/btr0btr.ic
+++ b/innobase/include/btr0btr.ic
@@ -45,8 +45,7 @@ btr_page_set_index_id(
dulint id, /* in: index id */
mtr_t* mtr) /* in: mtr */
{
- mlog_write_dulint(page + PAGE_HEADER + PAGE_INDEX_ID, id,
- MLOG_8BYTES, mtr);
+ mlog_write_dulint(page + PAGE_HEADER + PAGE_INDEX_ID, id, mtr);
}
/******************************************************************
diff --git a/innobase/include/btr0sea.ic b/innobase/include/btr0sea.ic
index 63a3a658cf4..8a41042f713 100644
--- a/innobase/include/btr0sea.ic
+++ b/innobase/include/btr0sea.ic
@@ -44,8 +44,10 @@ btr_search_info_update(
{
btr_search_t* info;
- ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
- && !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#ifdef UNIV_SYNC_DEBUG
+ ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
info = btr_search_get_info(index);
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 3f2fd5bbbe0..3cab717546a 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -562,11 +562,11 @@ buf_awe_map_page_to_frame(
we need to map the page should also
add the block to the
awe_LRU_free_mapped list */
+#ifdef UNIV_SYNC_DEBUG
/*************************************************************************
Adds latch level info for the rw-lock protecting the buffer frame. This
should be called in the debug version after a successful latching of a
-page if we know the latching order level of the acquired latch. If
-UNIV_SYNC_DEBUG is not defined, compiles to an empty function. */
+page if we know the latching order level of the acquired latch. */
UNIV_INLINE
void
buf_page_dbg_add_level(
@@ -574,6 +574,7 @@ buf_page_dbg_add_level(
buf_frame_t* frame, /* in: buffer page where we have acquired
a latch */
ulint level); /* in: latching order level */
+#endif /* UNIV_SYNC_DEBUG */
/*************************************************************************
Gets a pointer to the memory frame of a block. */
UNIV_INLINE
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index 0df8570e4e2..cb54785128f 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -130,7 +130,9 @@ buf_pool_clock_tic(void)
/*====================*/
/* out: new clock value */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
buf_pool->ulint_clock++;
@@ -221,7 +223,7 @@ buf_block_align(
"InnoDB: how to force recovery.\n",
(long)ptr, (long)frame_zero,
(long)(buf_pool->high_end));
- ut_a(0);
+ ut_error;
}
block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero))
@@ -257,7 +259,7 @@ buf_frame_align(
"InnoDB: how to force recovery.\n",
(long)ptr, (long)(buf_pool->frame_zero),
(long)(buf_pool->high_end));
- ut_a(0);
+ ut_error;
}
return(frame);
@@ -447,8 +449,10 @@ buf_frame_modify_clock_inc(
block = buf_block_align(frame);
+#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+#endif /*UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@@ -466,8 +470,10 @@ buf_block_modify_clock_inc(
/* out: new value */
buf_block_t* block) /* in: block */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+#endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@@ -490,8 +496,10 @@ buf_frame_get_modify_clock(
block = buf_block_align(frame);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+#endif /* UNIV_SYNC_DEBUG */
return(block->modify_clock);
}
@@ -542,7 +550,9 @@ buf_page_hash_get(
ulint fold;
ut_ad(buf_pool);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
/* Look for the page in the hash table */
@@ -642,6 +652,7 @@ buf_page_release(
}
}
+#ifdef UNIV_SYNC_DEBUG
/*************************************************************************
Adds latch level info for the rw-lock protecting the buffer frame. This
should be called in the debug version after a successful latching of a
@@ -656,7 +667,6 @@ buf_page_dbg_add_level(
ulint level __attribute__((unused))) /* in: latching order
level */
{
-#ifdef UNIV_SYNC_DEBUG
sync_thread_add_level(&(buf_block_align(frame)->lock), level);
-#endif
}
+#endif /* UNIV_SYNC_DEBUG */
diff --git a/innobase/include/buf0flu.ic b/innobase/include/buf0flu.ic
index e2faf773cab..d6dbdcc0865 100644
--- a/innobase/include/buf0flu.ic
+++ b/innobase/include/buf0flu.ic
@@ -40,8 +40,10 @@ buf_flush_note_modification(
ut_ad(block);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(block->buf_fix_count > 0);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
ut_ad(mutex_own(&(buf_pool->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
ut_ad(mtr->modifications);
@@ -76,7 +78,9 @@ buf_flush_recv_note_modification(
ut_ad(block);
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(block->buf_fix_count > 0);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(buf_pool->mutex));
diff --git a/innobase/include/com0com.h b/innobase/include/com0com.h
deleted file mode 100644
index 6f04b6a3f11..00000000000
--- a/innobase/include/com0com.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/******************************************************
-The communication primitives
-
-(c) 1995 Innobase Oy
-
-Created 9/23/1995 Heikki Tuuri
-*******************************************************/
-
-/* This module defines a standard datagram communication
-function interface for use in the database. We assume that
-the communication medium is reliable. */
-
-#ifndef com0com_h
-#define com0com_h
-
-#include "univ.i"
-
-/* The communications endpoint type definition */
-typedef struct com_endpoint_struct com_endpoint_t;
-
-/* Possible endpoint communication types */
-#define COM_SHM 1 /* communication through shared memory */
-
-/* Option numbers for endpoint */
-#define COM_OPT_MAX_DGRAM_SIZE 1
-
-/* Error numbers */
-#define COM_ERR_NOT_SPECIFIED 1
-#define COM_ERR_NOT_BOUND 2
-#define COM_ERR_ALREADY_BOUND 3
-#define COM_ERR_MAX_DATAGRAM_SIZE_NOT_SET 4
-#define COM_ERR_DATA_BUFFER_TOO_SMALL 5
-#define COM_ERR_ADDR_BUFFER_TOO_SMALL 6
-#define COM_ERR_DATA_TOO_LONG 7
-#define COM_ERR_ADDR_TOO_LONG 8
-#define COM_ERR_DGRAM_NOT_DELIVERED 9
-
-/* Maximum allowed address length in bytes */
-#define COM_MAX_ADDR_LEN 100
-
-/*************************************************************************
-Creates a communications endpoint. */
-
-com_endpoint_t*
-com_endpoint_create(
-/*================*/
- /* out, own: communications endpoint, NULL if
- did not succeed */
- ulint type); /* in: communication type of endpoint:
- only COM_SHM supported */
-/*************************************************************************
-Frees a communications endpoint. */
-
-ulint
-com_endpoint_free(
-/*==============*/
- /* out: O if succeed, else error number */
- com_endpoint_t* ep); /* in, own: communications endpoint */
-/*************************************************************************
-Sets an option, like the maximum datagram size for an endpoint.
-The options may vary depending on the endpoint type. */
-
-ulint
-com_endpoint_set_option(
-/*====================*/
- /* out: 0 if succeed, else error number */
- com_endpoint_t* ep, /* in: endpoint */
- ulint optno, /* in: option number, only
- COM_OPT_MAX_DGRAM_SIZE currently supported */
- byte* optval, /* in: pointer to a buffer containing the
- option value to set */
- ulint optlen);/* in: option value buffer length */
-/*************************************************************************
-Binds a communications endpoint to a specified address. */
-
-ulint
-com_bind(
-/*=====*/
- /* out: 0 if succeed, else error number */
- com_endpoint_t* ep, /* in: communications endpoint */
- char* name, /* in: address name */
- ulint len); /* in: name length */
-/*************************************************************************
-Waits for a datagram to arrive at an endpoint. */
-
-ulint
-com_recvfrom(
-/*=========*/
- /* out: 0 if succeed, else error number */
- com_endpoint_t* ep, /* in: communications endpoint */
- byte* buf, /* out: datagram buffer; the buffer must be
- supplied by the caller */
- ulint buf_len,/* in: datagram buffer length */
- ulint* len, /* out: datagram length */
- char* from, /* out: address name buffer; the buffer must be
- supplied by the caller */
- ulint from_len,/* in: address name buffer length */
- ulint* addr_len);/* out: address name length */
-/*************************************************************************
-Sends a datagram to a specified destination. */
-
-ulint
-com_sendto(
-/*=======*/
- /* out: 0 if succeed, else error number */
- com_endpoint_t* ep, /* in: communications endpoint */
- byte* buf, /* in: datagram buffer */
- ulint len, /* in: datagram length */
- char* to, /* in: address name buffer */
- ulint tolen); /* in: address name length */
-/*************************************************************************
-Gets the maximum datagram size for an endpoint. */
-
-ulint
-com_endpoint_get_max_size(
-/*======================*/
- /* out: maximum size */
- com_endpoint_t* ep); /* in: endpoint */
-
-
-#ifndef UNIV_NONINL
-#include "com0com.ic"
-#endif
-
-#endif
diff --git a/innobase/include/com0com.ic b/innobase/include/com0com.ic
deleted file mode 100644
index cec1cb190cc..00000000000
--- a/innobase/include/com0com.ic
+++ /dev/null
@@ -1,7 +0,0 @@
-/******************************************************
-The communication primitives
-
-(c) 1995 Innobase Oy
-
-Created 9/23/1995 Heikki Tuuri
-*******************************************************/
diff --git a/innobase/include/com0shm.h b/innobase/include/com0shm.h
deleted file mode 100644
index 7de9c4ac2de..00000000000
--- a/innobase/include/com0shm.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/******************************************************
-The communication through shared memory
-
-(c) 1995 Innobase Oy
-
-Created 9/23/1995 Heikki Tuuri
-*******************************************************/
-
-#ifndef com0shm_h
-#define com0shm_h
-
-#include "univ.i"
-
-typedef struct com_shm_endpoint_struct com_shm_endpoint_t;
-
-/* The performance of communication in NT depends on how
-many times a system call is made (excluding os_thread_yield,
-as that is the fastest way to switch thread).
-The following variable counts such events. */
-
-extern ulint com_shm_system_call_count;
-
-
-/*************************************************************************
-Creates a communications endpoint. */
-
-com_shm_endpoint_t*
-com_shm_endpoint_create(void);
-/*=========================*/
- /* out, own: communications endpoint, NULL if
- did not succeed */
-/*************************************************************************
-Frees a communications endpoint. */
-
-ulint
-com_shm_endpoint_free(
-/*==================*/
- /* out: O if succeed, else error number */
- com_shm_endpoint_t* ep);/* in, own: communications endpoint */
-/*************************************************************************
-Sets an option, like the maximum datagram size for an endpoint.
-The options may vary depending on the endpoint type. */
-
-ulint
-com_shm_endpoint_set_option(
-/*========================*/
- /* out: 0 if succeed, else error number */
- com_shm_endpoint_t* ep, /* in: endpoint */
- ulint optno, /* in: option number, only
- COM_OPT_MAX_DGRAM_SIZE currently supported */
- byte* optval, /* in: pointer to a buffer containing the
- option value to set */
- ulint optlen);/* in: option value buffer length */
-/*************************************************************************
-Bind a communications endpoint to a specified address. */
-
-ulint
-com_shm_bind(
-/*=========*/
- /* out: 0 if succeed, else error number */
- com_shm_endpoint_t* ep, /* in: communications endpoint */
- char* name, /* in: address name */
- ulint len); /* in: address name length */
-/*************************************************************************
-Waits for a datagram to arrive at an endpoint. */
-
-ulint
-com_shm_recvfrom(
-/*=============*/
- /* out: 0 if succeed, else error number */
- com_shm_endpoint_t* ep, /* in: communications endpoint */
- byte* buf, /* out: datagram buffer; the buffer is
- supplied by the caller */
- ulint buf_len,/* in: datagram buffer length */
- ulint* len, /* out: datagram length */
- char* from, /* out: address name buffer; the buffer is
- supplied by the caller */
- ulint from_len,/* in: address name buffer length */
- ulint* addr_len);/* out: address name length */
-/*************************************************************************
-Sends a datagram to the specified destination. */
-
-ulint
-com_shm_sendto(
-/*===========*/
- /* out: 0 if succeed, else error number */
- com_shm_endpoint_t* ep, /* in: communications endpoint */
- byte* buf, /* in: datagram buffer */
- ulint len, /* in: datagram length */
- char* to, /* in: address name buffer */
- ulint tolen); /* in: address name length */
-
-ulint
-com_shm_endpoint_get_size(
-/*======================*/
- com_shm_endpoint_t* ep);
-
-
-#ifndef UNIV_NONINL
-#include "com0shm.ic"
-#endif
-
-#endif
diff --git a/innobase/include/com0shm.ic b/innobase/include/com0shm.ic
deleted file mode 100644
index e0d3cb26f69..00000000000
--- a/innobase/include/com0shm.ic
+++ /dev/null
@@ -1,7 +0,0 @@
-/******************************************************
-Communication through shared memory
-
-(c) 1995 Innobase Oy
-
-Created 9/23/1995 Heikki Tuuri
-*******************************************************/
diff --git a/innobase/include/data0data.h b/innobase/include/data0data.h
index 2501d2b809f..c4e93bec738 100644
--- a/innobase/include/data0data.h
+++ b/innobase/include/data0data.h
@@ -402,9 +402,11 @@ struct dtuple_struct {
UT_LIST_NODE_T(dtuple_t) tuple_list;
/* data tuples can be linked into a
list using this field */
- ulint magic_n;
-};
+#ifdef UNIV_DEBUG
+ ulint magic_n;
#define DATA_TUPLE_MAGIC_N 65478679
+#endif /* UNIV_DEBUG */
+};
/* A slot for a field in a big rec vector */
diff --git a/innobase/include/data0type.ic b/innobase/include/data0type.ic
index 21f617c7590..946b646ffbf 100644
--- a/innobase/include/data0type.ic
+++ b/innobase/include/data0type.ic
@@ -280,7 +280,7 @@ dtype_get_fixed_size(
case DATA_VARMYSQL:
case DATA_BLOB:
return(0);
- default: ut_a(0);
+ default: ut_error;
}
return(0);
diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic
index c5982c162a7..b70822e331f 100644
--- a/innobase/include/dict0dict.ic
+++ b/innobase/include/dict0dict.ic
@@ -543,8 +543,10 @@ dict_table_check_if_in_cache_low(
ulint table_fold;
ut_ad(table_name);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-
+#endif /* UNIV_SYNC_DEBUG */
+
/* Look for the table name in the hash table */
table_fold = ut_fold_string(table_name);
@@ -566,8 +568,10 @@ dict_table_get_low(
dict_table_t* table;
ut_ad(table_name);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-
+#endif /* UNIV_SYNC_DEBUG */
+
table = dict_table_check_if_in_cache_low(table_name);
if (table == NULL) {
@@ -621,7 +625,9 @@ dict_table_get_on_id_low(
dict_table_t* table;
ulint fold;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
UT_NOT_USED(trx);
/* Look for the table name in the hash table */
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index b18e20a644a..23753df4079 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -198,10 +198,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 */
+};
/* Data structure for an index */
struct dict_index_struct{
@@ -247,7 +248,10 @@ 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:
@@ -298,9 +302,6 @@ 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 */
@@ -419,10 +420,12 @@ 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 */
+ next inserted row */
+#ifdef UNIV_DEBUG
ulint magic_n;/* magic number */
-};
#define DICT_TABLE_MAGIC_N 76333786
+#endif /* UNIV_DEBUG */
+};
/* Data structure for a stored procedure */
struct dict_proc_struct{
diff --git a/innobase/include/fut0fut.ic b/innobase/include/fut0fut.ic
index 0f1aa9dd9ae..6a107786376 100644
--- a/innobase/include/fut0fut.ic
+++ b/innobase/include/fut0fut.ic
@@ -30,7 +30,9 @@ fut_get_ptr(
ptr = buf_page_get(space, addr.page, rw_latch, mtr) + addr.boffset;
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(ptr, SYNC_NO_ORDER_CHECK);
+#endif /* UNIV_SYNC_DEBUG */
return(ptr);
}
diff --git a/innobase/include/ha0ha.ic b/innobase/include/ha0ha.ic
index 77064cdf9da..5369ca7f273 100644
--- a/innobase/include/ha0ha.ic
+++ b/innobase/include/ha0ha.ic
@@ -81,7 +81,9 @@ ha_search(
{
ha_node_t* node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
+#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -111,7 +113,9 @@ ha_search_and_get_data(
{
ha_node_t* node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
+#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -170,7 +174,9 @@ ha_search_with_data(
{
ha_node_t* node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
+#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -200,7 +206,9 @@ ha_search_and_delete_if_found(
{
ha_node_t* node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
+#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);
diff --git a/innobase/include/hash0hash.h b/innobase/include/hash0hash.h
index 2e9ab498116..79efe016324 100644
--- a/innobase/include/hash0hash.h
+++ b/innobase/include/hash0hash.h
@@ -53,15 +53,24 @@ hash_calc_hash(
/* out: hashed value */
ulint fold, /* in: folded value */
hash_table_t* table); /* in: hash table */
+/************************************************************************
+Assert that the mutex for the table in a hash operation is owned. */
+#ifdef UNIV_SYNC_DEBUG
+# define HASH_ASSERT_OWNED(TABLE, FOLD) \
+ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));
+#else
+# define HASH_ASSERT_OWNED(TABLE, FOLD)
+#endif
+
/***********************************************************************
Inserts a struct to a hash table. */
#define HASH_INSERT(TYPE, NAME, TABLE, FOLD, DATA)\
-{\
+do {\
hash_cell_t* cell3333;\
TYPE* struct3333;\
\
- ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
+ HASH_ASSERT_OWNED(TABLE, FOLD)\
\
(DATA)->NAME = NULL;\
\
@@ -79,17 +88,17 @@ Inserts a struct to a hash table. */
\
struct3333->NAME = DATA;\
}\
-}
+} while (0)
/***********************************************************************
Deletes a struct from a hash table. */
#define HASH_DELETE(TYPE, NAME, TABLE, FOLD, DATA)\
-{\
+do {\
hash_cell_t* cell3333;\
TYPE* struct3333;\
\
- ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
+ HASH_ASSERT_OWNED(TABLE, FOLD)\
\
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
\
@@ -100,13 +109,13 @@ Deletes a struct from a hash table. */
\
while (struct3333->NAME != DATA) {\
\
- ut_a(struct3333)\
+ ut_a(struct3333);\
struct3333 = struct3333->NAME;\
}\
\
struct3333->NAME = DATA->NAME;\
}\
-}
+} while (0)
/***********************************************************************
Gets the first struct in a hash chain, NULL if none. */
@@ -124,7 +133,7 @@ Looks for a struct in a hash table. */
#define HASH_SEARCH(NAME, TABLE, FOLD, DATA, TEST)\
{\
\
- ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
+ HASH_ASSERT_OWNED(TABLE, FOLD)\
\
(DATA) = HASH_GET_FIRST(TABLE, hash_calc_hash(FOLD, TABLE));\
\
@@ -160,7 +169,7 @@ the heap. The fold value must be stored in the struct NODE in a field named
'fold'. */
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
-{\
+do {\
TYPE* node111;\
TYPE* top_node111;\
hash_cell_t* cell111;\
@@ -211,33 +220,7 @@ the heap. The fold value must be stored in the struct NODE in a field named
/* Free the space occupied by the top node */\
\
mem_heap_free_top(hash_get_heap(TABLE, fold111), sizeof(TYPE));\
-}
-
-/***********************************************************************
-Calculates the number of stored structs in a hash table. */
-
-#define HASH_GET_N_NODES(TYPE, NAME, TABLE, N)\
-{\
- hash_cell_t* cell3333;\
- TYPE* struct3333;\
- ulint i3333;\
-\
- (N) = 0;\
-\
- for (i3333 = 0; i3333 < hash_get_n_cells(TABLE); i3333++) {\
-\
- cell3333 = hash_get_nth_cell(TABLE, i3333);\
-\
- struct3333 = cell3333->node;\
-\
- while (struct3333) {\
-\
- (N) = (N) + 1;\
-\
- struct = HASH_GET_NEXT(NAME, struct3333);\
- }\
- }\
-}
+} while (0)
/****************************************************************
Gets the mutex index for a fold value in a hash table. */
@@ -300,21 +283,6 @@ 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 */
@@ -335,10 +303,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 */
+};
#ifndef UNIV_NONINL
#include "hash0hash.ic"
diff --git a/innobase/include/hash0hash.ic b/innobase/include/hash0hash.ic
index 0d713140c13..1b9acfa2f34 100644
--- a/innobase/include/hash0hash.ic
+++ b/innobase/include/hash0hash.ic
@@ -18,6 +18,7 @@ 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);
@@ -32,6 +33,7 @@ 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);
}
@@ -45,6 +47,7 @@ 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));
}
@@ -58,6 +61,7 @@ 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));
}
@@ -71,6 +75,7 @@ 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]);
@@ -88,6 +93,8 @@ hash_get_heap(
{
ulint i;
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
+
if (table->heap) {
return(table->heap);
}
@@ -107,6 +114,7 @@ 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/ib_odbc.h b/innobase/include/ib_odbc.h
deleted file mode 100644
index 86884b41d39..00000000000
--- a/innobase/include/ib_odbc.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/******************************************************
-Innobase ODBC client library header; this is equivalent to
-the standard sql.h ODBC header file
-
-(c) 1998 Innobase Oy
-
-Created 2/22/1998 Heikki Tuuri
-*******************************************************/
-
-#ifndef ib_odbc_h
-#define ib_odbc_h
-
-typedef unsigned char UCHAR;
-typedef signed char SCHAR;
-typedef long int SDWORD;
-typedef short int SWORD;
-typedef unsigned long int UDWORD;
-typedef unsigned short int UWORD;
-
-typedef void* PTR;
-
-typedef void* HENV;
-typedef void* HDBC;
-typedef void* HSTMT;
-
-typedef signed short RETCODE;
-
-/* RETCODEs */
-#define SQL_NO_DATA_FOUND (-3)
-#define SQL_INVALID_HANDLE (-2)
-#define SQL_ERROR (-1)
-#define SQL_SUCCESS 0
-
-/* Standard SQL datatypes, using ANSI type numbering */
-#define SQL_CHAR 1
-#define SQL_INTEGER 4
-#define SQL_VARCHAR 12
-
-/* C datatype to SQL datatype mapping */
-#define SQL_C_CHAR SQL_CHAR
-#define SQL_C_LONG SQL_INTEGER
-
-/* Special length value */
-#define SQL_NULL_DATA (-1)
-
-#define SQL_PARAM_INPUT 1
-#define SQL_PARAM_OUTPUT 4
-
-/* Null handles */
-#define SQL_NULL_HENV NULL
-#define SQL_NULL_HDBC NULL
-#define SQL_NULL_HSTM NULL
-
-
-/**************************************************************************
-Allocates an SQL environment. */
-
-RETCODE
-SQLAllocEnv(
-/*========*/
- /* out: SQL_SUCCESS */
- HENV* phenv); /* out: pointer to an environment handle */
-/**************************************************************************
-Allocates an SQL connection. */
-
-RETCODE
-SQLAllocConnect(
-/*============*/
- /* out: SQL_SUCCESS */
- HENV henv, /* in: pointer to an environment handle */
- HDBC* phdbc); /* out: pointer to a connection handle */
-/**************************************************************************
-Allocates an SQL statement. */
-
-RETCODE
-SQLAllocStmt(
-/*=========*/
- HDBC hdbc, /* in: SQL connection */
- HSTMT* phstmt); /* out: pointer to a statement handle */
-/**************************************************************************
-Connects to a database server process (establishes a connection and a
-session). */
-
-RETCODE
-SQLConnect(
-/*=======*/
- /* out: SQL_SUCCESS */
- HDBC hdbc, /* in: SQL connection handle */
- UCHAR* szDSN, /* in: data source name (server name) */
- SWORD cbDSN, /* in: data source name length */
- UCHAR* szUID, /* in: user name */
- SWORD cbUID, /* in: user name length */
- UCHAR* szAuthStr, /* in: password */
- SWORD cbAuthStr); /* in: password length */
-/**************************************************************************
-Makes the server to parse and optimize an SQL string. */
-
-RETCODE
-SQLPrepare(
-/*=======*/
- /* out: SQL_SUCCESS */
- HSTMT hstmt, /* in: statement handle */
- UCHAR* szSqlStr, /* in: SQL string */
- SDWORD cbSqlStr); /* in: SQL string length */
-/**************************************************************************
-Binds a parameter in a prepared statement. */
-
-RETCODE
-SQLBindParameter(
-/*=============*/
- /* out: SQL_SUCCESS */
- HSTMT hstmt, /* in: statement handle */
- UWORD ipar, /* in: parameter index, starting from 1 */
- SWORD fParamType, /* in: SQL_PARAM_INPUT or SQL_PARAM_OUTPUT */
- SWORD fCType, /* in: SQL_C_CHAR, ... */
- SWORD fSqlType, /* in: SQL_CHAR, ... */
- UDWORD cbColDef, /* in: precision: ignored */
- SWORD ibScale, /* in: scale: ignored */
- PTR rgbValue, /* in: pointer to a buffer for the data */
- SDWORD cbValueMax, /* in: buffer size */
- SDWORD* pcbValue); /* in: pointer to a buffer for the data
- length or SQL_NULL_DATA */
-/**************************************************************************
-Executes a prepared statement where all parameters have been bound. */
-
-RETCODE
-SQLExecute(
-/*=======*/
- /* out: SQL_SUCCESS or SQL_ERROR */
- HSTMT hstmt); /* in: statement handle */
-/**************************************************************************
-Queries an error message. */
-
-RETCODE
-SQLError(
-/*=====*/
- /* out: SQL_SUCCESS or SQL_NO_DATA_FOUND */
- HENV henv, /* in: SQL_NULL_HENV */
- HDBC hdbc, /* in: SQL_NULL_HDBC */
- HSTMT hstmt, /* in: statement handle */
- UCHAR* szSqlState, /* in/out: SQLSTATE as a null-terminated string,
- (currently, always == "S1000") */
- SDWORD* pfNativeError, /* out: native error code */
- UCHAR* szErrorMsg, /* in/out: buffer for an error message as a
- null-terminated string */
- SWORD cbErrorMsgMax, /* in: buffer size for szErrorMsg */
- SWORD* pcbErrorMsg); /* out: error message length */
-
-#endif
diff --git a/innobase/include/lock0lock.ic b/innobase/include/lock0lock.ic
index 64c43c88d2e..fabc9256401 100644
--- a/innobase/include/lock0lock.ic
+++ b/innobase/include/lock0lock.ic
@@ -64,7 +64,9 @@ lock_clust_rec_some_has_impl(
{
dulint trx_id;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(page_rec_is_user_rec(rec));
diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic
index 7ae7e859032..16423286f6d 100644
--- a/innobase/include/log0log.ic
+++ b/innobase/include/log0log.ic
@@ -255,7 +255,9 @@ log_block_init(
{
ulint no;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
@@ -277,7 +279,9 @@ log_block_init_in_old_format(
{
ulint no;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
@@ -407,7 +411,9 @@ log_get_online_backup_lsn_low(void)
/* out: online_backup_lsn, the caller must
own the log_sys mutex */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(log_sys->online_backup_state);
return(log_sys->online_backup_lsn);
@@ -422,7 +428,9 @@ log_get_online_backup_state_low(void)
/* out: online backup state, the caller must
own the log_sys mutex */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
return(log_sys->online_backup_state);
}
diff --git a/innobase/include/mach0data.h b/innobase/include/mach0data.h
index 006f55d5f1f..f28c9422670 100644
--- a/innobase/include/mach0data.h
+++ b/innobase/include/mach0data.h
@@ -88,25 +88,6 @@ mach_read_from_4(
/*=============*/
/* out: ulint integer */
byte* b); /* in: pointer to four bytes */
-/***********************************************************
-The following function is used to store data from a ulint to memory
-in standard order:
-we store the most significant byte to the lowest address. */
-UNIV_INLINE
-void
-mach_write(
-/*=======*/
- byte* b, /* in: pointer to sizeof(ulint) bytes where to store */
- ulint n); /* in: ulint integer to be stored */
-/************************************************************
-The following function is used to fetch data from memory to a ulint.
-The most significant byte is at the lowest address. */
-UNIV_INLINE
-ulint
-mach_read(
-/*======*/
- /* out: ulint integer */
- byte* b); /* in: pointer to sizeof(ulint) bytes */
/*************************************************************
Writes a ulint in a compressed form. */
UNIV_INLINE
diff --git a/innobase/include/mach0data.ic b/innobase/include/mach0data.ic
index 0934c27d9f4..3ccdcf1dc0a 100644
--- a/innobase/include/mach0data.ic
+++ b/innobase/include/mach0data.ic
@@ -167,44 +167,6 @@ mach_read_from_4(
#endif
}
-/***********************************************************
-The following function is used to store data from a ulint to memory
-in standard order: we store the most significant byte to the lowest
-address. */
-UNIV_INLINE
-void
-mach_write(
-/*=======*/
- byte* b, /* in: pointer to 4 bytes where to store */
- ulint n) /* in: ulint integer to be stored */
-{
- ut_ad(b);
-
- b[0] = (byte)(n >> 24);
- b[1] = (byte)(n >> 16);
- b[2] = (byte)(n >> 8);
- b[3] = (byte)n;
-}
-
-/************************************************************
-The following function is used to fetch data from memory to a ulint.
-The most significant byte is at the lowest address. */
-UNIV_INLINE
-ulint
-mach_read(
-/*======*/
- /* out: ulint integer */
- byte* b) /* in: pointer to 4 bytes */
-{
- ut_ad(b);
-
- return( ((ulint)(b[0]) << 24)
- + ((ulint)(b[1]) << 16)
- + ((ulint)(b[2]) << 8)
- + (ulint)(b[3])
- );
-}
-
/*************************************************************
Writes a ulint in a compressed form where the first byte codes the
length of the stored ulint. We look at the most significant bits of
diff --git a/innobase/include/mem0dbg.ic b/innobase/include/mem0dbg.ic
index 765e23e747e..6efac719760 100644
--- a/innobase/include/mem0dbg.ic
+++ b/innobase/include/mem0dbg.ic
@@ -7,6 +7,7 @@ compilation module but is included in mem0mem.*.
Created 6/8/1994 Heikki Tuuri
*************************************************************************/
+#ifdef UNIV_MEM_DEBUG
extern mutex_t mem_hash_mutex;
extern ulint mem_current_allocated_memory;
@@ -89,3 +90,4 @@ mem_field_trailer_set_check(byte* field, ulint check);
ulint
mem_field_trailer_get_check(byte* field);
+#endif /* UNIV_MEM_DEBUG */
diff --git a/innobase/include/mtr0log.h b/innobase/include/mtr0log.h
index cc42924fe4d..f50c1dfcb6a 100644
--- a/innobase/include/mtr0log.h
+++ b/innobase/include/mtr0log.h
@@ -32,7 +32,6 @@ mlog_write_dulint(
/*==============*/
byte* ptr, /* in: pointer where to write */
dulint val, /* in: value to write */
- byte type, /* in: MLOG_8BYTES */
mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************
Writes a string to a file page buffered in the buffer pool. Writes the
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 8408abf43e4..9cf592f71e1 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -195,7 +195,6 @@ mtr_read_dulint(
/*===========*/
/* out: value read */
byte* ptr, /* in: pointer from where to read */
- ulint type, /* in: MLOG_8BYTES */
mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************************
This macro locks an rw-lock in s-mode. */
@@ -296,7 +295,12 @@ 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;
@@ -311,15 +315,12 @@ 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_ACTIVE 12231
-#define MTR_COMMITTING 56456
-#define MTR_COMMITTED 34676
-
#ifndef UNIV_NONINL
#include "mtr0mtr.ic"
#endif
diff --git a/innobase/include/odbc0odbc.h b/innobase/include/odbc0odbc.h
deleted file mode 100644
index 7f842b54b27..00000000000
--- a/innobase/include/odbc0odbc.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/******************************************************
-Innobase ODBC client library additional header
-
-(c) 1998 Innobase Oy
-
-Created 2/22/1998 Heikki Tuuri
-*******************************************************/
-
-#ifndef odbc0odbc_h
-#define odbc0odbc_h
-
-#include "ib_odbc.h"
-
-/* Datagram size in communications */
-#define ODBC_DATAGRAM_SIZE 8192
-
-/* Communication address maximum length in bytes */
-#define ODBC_ADDRESS_SIZE COM_MAX_ADDR_LEN
-
-#endif
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 5f2d6e3ed21..cf2dbd68fb1 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -20,6 +20,9 @@ extern ibool os_do_not_call_flush_at_each_write;
extern ibool os_has_said_disk_full;
extern ibool os_aio_print_debug;
+extern ulint os_file_n_pending_preads;
+extern ulint os_file_n_pending_pwrites;
+
#ifdef __WIN__
/* We define always WIN_ASYNC_IO, and check at run-time whether
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index e08b071e246..8ff226ebbd0 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -21,7 +21,9 @@ extern int yydebug;
/* If the following is set TRUE, the lexer will print the SQL string
as it tokenizes it */
+#ifdef UNIV_SQL_DEBUG
extern ibool pars_print_lexed;
+#endif /* UNIV_SQL_DEBUG */
/* Global variable used while parsing a single procedure or query : the code is
NOT re-entrant */
@@ -390,41 +392,18 @@ pars_procedure_definition(
table */
sym_node_t* param_list, /* in: parameter declaration list */
que_node_t* stat_list); /* in: statement list */
-/*****************************************************************
-Reads stored procedure input parameter values from a buffer. */
-
-void
-pars_proc_read_input_params_from_buf(
-/*=================================*/
- que_t* graph, /* in: query graph which contains a stored procedure */
- byte* buf); /* in: buffer */
-/*****************************************************************
-Writes stored procedure output parameter values to a buffer. */
-ulint
-pars_proc_write_output_params_to_buf(
-/*=================================*/
- byte* buf, /* in: buffer which must be big enough */
- que_t* graph); /* in: query graph which contains a stored procedure */
/*****************************************************************
Parses a stored procedure call, when this is not within another stored
-procedure, that is, the client issues a procedure call directly. */
+procedure, that is, the client issues a procedure call directly.
+In MySQL/InnoDB, stored InnoDB procedures are invoked via the
+parsed procedure tree, not via InnoDB SQL, so this function is not used. */
que_fork_t*
pars_stored_procedure_call(
/*=======================*/
/* out: query graph */
sym_node_t* sym_node); /* in: stored procedure name */
-/*****************************************************************
-Writes info about query parameter markers (denoted with '?' in ODBC) into a
-buffer. */
-
-ulint
-pars_write_query_param_info(
-/*========================*/
- /* out: number of bytes used for info in buf */
- byte* buf, /* in: buffer which must be big enough */
- que_fork_t* graph); /* in: parsed query graph */
/**********************************************************************
Completes a query graph by adding query thread and fork nodes
above it and prepares the graph for running. The fork created is of
diff --git a/innobase/include/que0que.h b/innobase/include/que0que.h
index a3ed18e2b14..e1874edcaf2 100644
--- a/innobase/include/que0que.h
+++ b/innobase/include/que0que.h
@@ -216,9 +216,7 @@ que_fork_start_command(
QUE_THR_RUNNING state, or NULL; the query
thread should be executed by que_run_threads
by the caller */
- que_fork_t* fork, /* in: a query fork */
- ulint command,/* in: command SESS_COMM_FETCH_NEXT, ... */
- ulint param); /* in: possible parameter to the command */
+ que_fork_t* fork); /* in: a query fork */
/***************************************************************************
Gets the trx of a query thread. */
UNIV_INLINE
@@ -388,11 +386,6 @@ struct que_fork_struct{
sym_tab_t* sym_tab; /* symbol table of the query,
generated by the parser, or NULL
if the graph was created 'by hand' */
- ulint id; /* id of this query graph */
- ulint command; /* command currently executed in the
- graph */
- ulint param; /* possible command parameter */
-
/* The following cur_... fields are relevant only in a select graph */
ulint cur_end; /* QUE_CUR_NOT_DEFINED, QUE_CUR_START,
diff --git a/innobase/include/row0ins.h b/innobase/include/row0ins.h
index a5b4b74e7fc..f3f0b7e8eca 100644
--- a/innobase/include/row0ins.h
+++ b/innobase/include/row0ins.h
@@ -145,10 +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 */
+};
/* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
diff --git a/innobase/include/row0upd.h b/innobase/include/row0upd.h
index f5e0a88231f..687e90deee5 100644
--- a/innobase/include/row0upd.h
+++ b/innobase/include/row0upd.h
@@ -384,10 +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 */
+};
/* Node execution states */
#define UPD_NODE_SET_IX_LOCK 1 /* execution came to the node from
diff --git a/innobase/include/row0upd.ic b/innobase/include/row0upd.ic
index 1878431d1a4..6b9deeac5e3 100644
--- a/innobase/include/row0upd.ic
+++ b/innobase/include/row0upd.ic
@@ -107,8 +107,10 @@ row_upd_rec_sys_fields(
dulint roll_ptr)/* in: roll ptr of the undo log record */
{
ut_ad(index->type & DICT_CLUSTERED);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!buf_block_align(rec)->is_hashed
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
row_set_rec_trx_id(rec, index, trx->id);
row_set_rec_roll_ptr(rec, index, roll_ptr);
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index 23c30554f08..8aac71de2a9 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -13,7 +13,6 @@ Created 10/10/1995 Heikki Tuuri
#include "univ.i"
#include "sync0sync.h"
#include "os0sync.h"
-#include "com0com.h"
#include "que0types.h"
#include "trx0types.h"
@@ -405,9 +404,6 @@ struct srv_sys_struct{
os_event_t operational; /* created threads must wait for the
server to become operational by
waiting for this event */
- com_endpoint_t* endpoint; /* the communication endpoint of the
- server */
-
srv_table_t* threads; /* server thread table */
UT_LIST_BASE_NODE_T(que_thr_t)
tasks; /* task queue */
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 5aa3dcdffc3..d71691b4353 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -25,13 +25,16 @@ smaller than 30 and the order of the numerical values like below! */
#define RW_NO_LATCH 3
typedef struct rw_lock_struct rw_lock_t;
+#ifdef UNIV_SYNC_DEBUG
typedef struct rw_lock_debug_struct rw_lock_debug_t;
+#endif /* UNIV_SYNC_DEBUG */
typedef UT_LIST_BASE_NODE_T(rw_lock_t) rw_lock_list_t;
extern rw_lock_list_t rw_lock_list;
extern mutex_t rw_lock_list_mutex;
+#ifdef UNIV_SYNC_DEBUG
/* The global mutex which protects debug info lists of all rw-locks.
To modify the debug info list of an rw-lock, this mutex has to be
@@ -42,6 +45,7 @@ extern os_event_t rw_lock_debug_event; /* If deadlock detection does
may wait for this event */
extern ibool rw_lock_debug_waiters; /* This is set to TRUE, if
there may be waiters for the event */
+#endif /* UNIV_SYNC_DEBUG */
extern ulint rw_s_system_call_count;
extern ulint rw_s_spin_wait_count;
@@ -327,6 +331,7 @@ ulint
rw_lock_get_reader_count(
/*=====================*/
rw_lock_t* lock);
+#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Checks if the thread has locked the rw-lock in the specified mode, with
the pass value == 0. */
@@ -337,6 +342,7 @@ rw_lock_own(
rw_lock_t* lock, /* in: rw-lock */
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
RW_LOCK_EX */
+#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
Checks if somebody has locked the rw-lock in the specified mode. */
@@ -346,6 +352,7 @@ rw_lock_is_locked(
rw_lock_t* lock, /* in: rw-lock */
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
RW_LOCK_EX */
+#ifdef UNIV_SYNC_DEBUG
/*******************************************************************
Prints debug info of an rw-lock. */
@@ -392,6 +399,7 @@ void
rw_lock_debug_print(
/*================*/
rw_lock_debug_t* info); /* in: debug struct */
+#endif /* UNIV_SYNC_DEBUG */
/* NOTE! The structure appears here only for the compiler to know its size.
Do not use its fields directly! The structure used in the spin lock
@@ -434,10 +442,12 @@ struct rw_lock_struct {
UT_LIST_NODE_T(rw_lock_t) list;
/* All allocated rw locks are put into a
list */
+#ifdef UNIV_SYNC_DEBUG
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
/* In the debug version: pointer to the debug
info list of the lock */
- ulint level; /* Debug version: level in the global latching
+#endif /* UNIV_SYNC_DEBUG */
+ ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
char* cfile_name; /* File name where lock created */
ulint cline; /* Line where created */
@@ -450,6 +460,7 @@ struct rw_lock_struct {
#define RW_LOCK_MAGIC_N 22643
+#ifdef UNIV_SYNC_DEBUG
/* The structure for storing debug info of an rw-lock */
struct rw_lock_debug_struct {
@@ -464,6 +475,7 @@ struct rw_lock_debug_struct {
/* Debug structs are linked in a two-way
list */
};
+#endif /* UNIV_SYNC_DEBUG */
#ifndef UNIV_NONINL
#include "sync0rw.ic"
diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
index caf6f5f1de4..8fc93f4a9da 100644
--- a/innobase/include/sync0rw.ic
+++ b/innobase/include/sync0rw.ic
@@ -20,6 +20,7 @@ rw_lock_s_lock_spin(
be passed to another thread to unlock */
char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
+#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Inserts the debug information for an rw-lock. */
@@ -40,7 +41,7 @@ rw_lock_remove_debug_info(
rw_lock_t* lock, /* in: rw-lock */
ulint pass, /* in: pass value */
ulint lock_type); /* in: lock type */
-
+#endif /* UNIV_SYNC_DEBUG */
/************************************************************************
Accessor functions for rw lock. */
@@ -132,8 +133,9 @@ rw_lock_s_lock_low(
char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
-
+#endif /* UNIV_SYNC_DEBUG */
/* Check if the writer field is free */
if (lock->writer == RW_LOCK_NOT_LOCKED) {
@@ -144,7 +146,6 @@ rw_lock_s_lock_low(
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
line);
#endif
-
lock->last_s_file_name = file_name;
lock->last_s_line = line;
@@ -236,7 +237,9 @@ rw_lock_s_lock_func(
the threads which have s-locked a latch. This would use some CPU
time. */
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(rw_lock_get_mutex(lock));
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index f83f8cbe712..3a7203bbb56 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -185,6 +185,7 @@ sync_thread_levels_empty_gen(
allowed to be owned by the thread,
also purge_is_running mutex is
allowed */
+#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Checks that the current thread owns the mutex. Works only
in the debug version. */
@@ -217,6 +218,7 @@ Prints debug info of currently reserved mutexes. */
void
mutex_list_print_info(void);
/*========================*/
+#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
NOT to be used outside this module except in debugging! Gets the value
of the lock word. */
@@ -225,6 +227,7 @@ ulint
mutex_get_lock_word(
/*================*/
mutex_t* mutex); /* in: mutex */
+#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
NOT to be used outside this module except in debugging! Gets the waiters
field in a mutex. */
@@ -234,6 +237,7 @@ mutex_get_waiters(
/*==============*/
/* out: value to set */
mutex_t* mutex); /* in: mutex */
+#endif /* UNIV_SYNC_DEBUG */
/*
LATCHING ORDER WITHIN THE DATABASE
@@ -442,13 +446,13 @@ struct mutex_struct {
Otherwise, this is 0. */
UT_LIST_NODE_T(mutex_t) list; /* All allocated mutexes are put into
a list. Pointers to the next and prev. */
+#ifdef UNIV_SYNC_DEBUG
+ const char* file_name; /* File where the mutex was locked */
+ ulint line; /* Line where the mutex was locked */
os_thread_id_t thread_id; /* Debug version: The thread id of the
thread which locked the mutex. */
- char* file_name; /* Debug version: File name where the mutex
- was locked */
- ulint line; /* Debug version: Line where the mutex was
- locked */
- ulint level; /* Debug version: level in the global latching
+#endif /* UNIV_SYNC_DEBUG */
+ ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
char* cfile_name; /* File name where mutex created */
ulint cline; /* Line where created */
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 816b44a5bd3..758c8524f66 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -25,6 +25,7 @@ mutex_spin_wait(
mutex_t* mutex, /* in: pointer to mutex */
char* file_name,/* in: file name where mutex requested */
ulint line); /* in: line where requested */
+#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Sets the debug information for a reserved mutex. */
@@ -34,6 +35,7 @@ mutex_set_debug_info(
mutex_t* mutex, /* in: mutex */
char* file_name, /* in: file where requested */
ulint line); /* in: line where requested */
+#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
Releases the threads waiting in the primary wait array for this mutex. */
@@ -200,9 +202,9 @@ mutex_exit(
/*=======*/
mutex_t* mutex) /* in: pointer to mutex */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(mutex));
-#ifdef UNIV_SYNC_DEBUG
mutex->thread_id = ULINT_UNDEFINED;
sync_thread_reset_level(mutex);
@@ -249,14 +251,9 @@ mutex_enter_func(
the atomic test_and_set; we could peek, and possibly save time. */
if (!mutex_test_and_set(mutex)) {
-
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
-
- mutex->file_name = file_name;
- mutex->line = line;
-
return; /* Succeeded! */
}
diff --git a/innobase/include/trx0rseg.ic b/innobase/include/trx0rseg.ic
index 6b242b66c09..35e927f5e79 100644
--- a/innobase/include/trx0rseg.ic
+++ b/innobase/include/trx0rseg.ic
@@ -24,7 +24,9 @@ trx_rsegf_get(
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
+#endif /* UNIV_SYNC_DEBUG */
return(header);
}
@@ -45,7 +47,9 @@ trx_rsegf_get_new(
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
+#endif /* UNIV_SYNC_DEBUG */
return(header);
}
@@ -64,7 +68,7 @@ trx_rsegf_get_nth_undo(
if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
- ut_a(0);
+ ut_error;
}
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS +
@@ -85,7 +89,7 @@ trx_rsegf_set_nth_undo(
if (n >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
- ut_a(0);
+ ut_error;
}
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
diff --git a/innobase/include/trx0sys.ic b/innobase/include/trx0sys.ic
index 343e6d7c2fa..8f455e554ea 100644
--- a/innobase/include/trx0sys.ic
+++ b/innobase/include/trx0sys.ic
@@ -60,7 +60,9 @@ trx_sys_get_nth_rseg(
trx_sys_t* sys, /* in: trx system */
ulint n) /* in: index of slot */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(n < TRX_SYS_N_RSEGS);
return(sys->rseg_array[n]);
@@ -98,7 +100,9 @@ trx_sysf_get(
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
RW_X_LATCH, mtr);
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
+#endif /* UNIV_SYNC_DEBUG */
return(header);
}
@@ -115,7 +119,9 @@ trx_sysf_rseg_get_space(
ulint i, /* in: slot index == rseg id */
mtr_t* mtr) /* in: mtr */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -138,7 +144,9 @@ trx_sysf_rseg_get_page_no(
mtr_t* mtr) /* in: mtr */
{
ut_ad(sys_header);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
@@ -158,7 +166,9 @@ trx_sysf_rseg_set_space(
ulint space, /* in: space id */
mtr_t* mtr) /* in: mtr */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -182,7 +192,9 @@ trx_sysf_rseg_set_page_no(
slot is reset to unused */
mtr_t* mtr) /* in: mtr */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -236,7 +248,9 @@ trx_get_on_id(
{
trx_t* trx;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -266,7 +280,9 @@ trx_list_get_min_trx_id(void)
{
trx_t* trx;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_LAST(trx_sys->trx_list);
@@ -289,7 +305,9 @@ trx_is_active(
{
trx_t* trx;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
@@ -325,7 +343,9 @@ trx_sys_get_new_trx_id(void)
{
dulint id;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
@@ -355,7 +375,9 @@ trx_sys_get_new_trx_no(void)
/*========================*/
/* out: new, allocated trx number */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
return(trx_sys_get_new_trx_id());
}
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 6b08b674db8..d9b91ee62dc 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -203,13 +203,9 @@ trx_sig_send(
ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
- ibool reply, /* in: TRUE if the sender of the signal
- wants reply after the operation induced
- by the signal is completed; if type
- is TRX_SIG_END_WAIT, this must be
- FALSE */
que_thr_t* receiver_thr, /* in: query thread which wants the
- reply, or NULL */
+ reply, or NULL; if type is
+ TRX_SIG_END_WAIT, this must be NULL */
trx_savept_t* savept, /* in: possible rollback savepoint, or
NULL */
que_thr_t** next_thr); /* in/out: next query thread to run;
@@ -225,7 +221,6 @@ been handled. */
void
trx_sig_reply(
/*==========*/
- trx_t* trx, /* in: trx handle */
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
@@ -297,15 +292,9 @@ struct trx_sig_struct{
TRX_SIG_BEING_HANDLED */
ulint sender; /* TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
- ibool reply; /* TRUE if the sender of the signal
+ que_thr_t* receiver; /* non-NULL if the sender of the signal
wants reply after the operation induced
- by the signal is completed; if this
- field is TRUE and the receiver field
- below is NULL, then a SUCCESS message
- is sent to the client of the session
- to which this trx belongs */
- que_thr_t* receiver; /* query thread which wants the reply,
- or NULL */
+ by the signal is completed */
trx_savept_t savept; /* possible rollback savepoint */
UT_LIST_NODE_T(trx_sig_t)
signals; /* queue of pending signals to the
diff --git a/innobase/include/trx0undo.ic b/innobase/include/trx0undo.ic
index bedbc02b00b..a04b234b495 100644
--- a/innobase/include/trx0undo.ic
+++ b/innobase/include/trx0undo.ic
@@ -126,7 +126,9 @@ trx_undo_page_get(
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
+#endif /* UNIV_SYNC_DEBUG */
return(page);
}
@@ -146,7 +148,9 @@ trx_undo_page_get_s_latched(
page = buf_page_get(space, page_no, RW_S_LATCH, mtr);
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
+#endif /* UNIV_SYNC_DEBUG */
return(page);
}
diff --git a/innobase/include/usr0sess.h b/innobase/include/usr0sess.h
index e277d801672..c7bcfb20fed 100644
--- a/innobase/include/usr0sess.h
+++ b/innobase/include/usr0sess.h
@@ -11,7 +11,6 @@ Created 6/25/1996 Heikki Tuuri
#include "univ.i"
#include "ut0byte.h"
-#include "hash0hash.h"
#include "trx0types.h"
#include "srv0srv.h"
#include "trx0types.h"
@@ -19,52 +18,14 @@ Created 6/25/1996 Heikki Tuuri
#include "que0types.h"
#include "data0data.h"
#include "rem0rec.h"
-#include "com0com.h"
-/* The session system global data structure */
-extern sess_sys_t* sess_sys;
-
-/*************************************************************************
-Sets the session id in a client message. */
-
-void
-sess_cli_msg_set_sess(
-/*==================*/
- byte* str, /* in/out: message string */
- dulint sess_id);/* in: session id */
-/***************************************************************************
-Sets the message type of a message from the client. */
-UNIV_INLINE
-void
-sess_cli_msg_set_type(
-/*==================*/
- byte* str, /* in: message string */
- ulint type); /* in: message type */
-/***************************************************************************
-Gets the message type of a message from the server. */
-UNIV_INLINE
-ulint
-sess_srv_msg_get_type(
-/*==================*/
- /* out: message type */
- byte* str); /* in: message string */
-/***************************************************************************
-Creates a session sytem at database start. */
-
-void
-sess_sys_init_at_db_start(void);
-/*===========================*/
/*************************************************************************
Opens a session. */
sess_t*
-sess_open(
-/*======*/
+sess_open(void);
+/*============*/
/* out, own: session object */
- com_endpoint_t* endpoint, /* in: communication endpoint used
- for communicating with the client */
- byte* addr_buf, /* in: client address */
- ulint addr_len); /* in: client address length */
/*************************************************************************
Closes a session, freeing the memory occupied by it, if it is in a state
where it should be closed. */
@@ -74,200 +35,25 @@ sess_try_close(
/*===========*/
/* out: TRUE if closed */
sess_t* sess); /* in, own: session object */
-/*************************************************************************
-Initializes the first fields of a message to client. */
-
-void
-sess_srv_msg_init(
-/*==============*/
- sess_t* sess, /* in: session object */
- byte* buf, /* in: message buffer, must be at least of size
- SESS_SRV_MSG_DATA */
- ulint type); /* in: message type */
-/*************************************************************************
-Sends a simple message to client. */
-
-void
-sess_srv_msg_send_simple(
-/*=====================*/
- sess_t* sess, /* in: session object */
- ulint type, /* in: message type */
- ulint rel_kernel); /* in: SESS_RELEASE_KERNEL or
- SESS_NOT_RELEASE_KERNEL */
-/***************************************************************************
-When a command has been completed, this function sends the message about it
-to the client. */
-
-void
-sess_command_completed_message(
-/*===========================*/
- sess_t* sess, /* in: session */
- byte* msg, /* in: message buffer */
- ulint len); /* in: message data length */
-
/* The session handle. All fields are protected by the kernel mutex */
struct sess_struct{
- dulint id; /* session id */
- dulint usr_id; /* user id */
- hash_node_t hash; /* hash chain node */
- ulint refer_count; /* reference count to the session
- object: when this drops to zero
- and the session has no query graphs
- left, discarding the session object
- is allowed */
- dulint error_count; /* if this counter has increased while
- a thread is parsing an SQL command,
- its graph should be discarded */
- ibool disconnecting; /* TRUE if the session is to be
- disconnected when its reference
- count drops to 0 */
ulint state; /* state of the session */
- dulint msgs_sent; /* count of messages sent to the
- client */
- dulint msgs_recv; /* count of messages received from the
- client */
- ibool client_waits; /* when the session receives a message
- from the client, this set to TRUE, and
- when the session sends a message to
- the client this is set to FALSE */
trx_t* trx; /* transaction object permanently
assigned for the session: the
transaction instance designated by the
trx id changes, but the memory
structure is preserved */
- ulint next_graph_id; /* next query graph id to assign */
UT_LIST_BASE_NODE_T(que_t)
graphs; /* query graphs belonging to this
session */
- /*------------------------------*/
- ulint err_no; /* latest error number, 0 if none */
- char* err_str; /* latest error string */
- ulint err_len; /* error string length */
- /*------------------------------*/
- com_endpoint_t* endpoint; /* server communications endpoint used
- to communicate with the client */
- char* addr_buf; /* client address string */
- ulint addr_len; /* client address string length */
- /*------------------------------*/
- byte* big_msg; /* if the client sends a message which
- does not fit in a single packet,
- it is assembled in this buffer; if
- this field is not NULL, it is assumed
- that the message should be catenated
- here */
- ulint big_msg_size; /* size of the big message buffer */
- ulint big_msg_len; /* length of data in the big message
- buffer */
-};
-
-/* The session system; this is protected by the kernel mutex */
-struct sess_sys_struct{
- ulint state; /* state of the system:
- SESS_SYS_RUNNING or
- SESS_SYS_SHUTTING_DOWN */
- sess_t* shutdown_req; /* if shutdown was requested by some
- session, confirmation of shutdown
- completion should be sent to this
- session */
- dulint free_sess_id; /* first unused session id */
- hash_table_t* hash; /* hash table of the sessions */
};
-
-/*---------------------------------------------------*/
-/* The format of an incoming message from a client */
-#define SESS_CLI_MSG_CHECKSUM 0 /* the checksum should be the first
- field in the message */
-#define SESS_CLI_MSG_SESS_ID 4 /* this is set to 0 if the client
- wants to connect and establish
- a new session */
-#define SESS_CLI_MSG_SESS_ID_CHECK 12 /* checksum of the sess id field */
-#define SESS_CLI_MSG_TYPE 16
-#define SESS_CLI_MSG_NO 20
-#define SESS_CLI_MSG_CONTINUE 28 /* 0, or SESS_MSG_FIRST_PART
- SESS_MSG_MIDDLE_PART, or
- SESS_MSG_LAST_PART */
-#define SESS_CLI_MSG_CONT_SIZE 32 /* size of a multipart message in
- kilobytes (rounded upwards) */
-#define SESS_CLI_MSG_DATA 36
-/*---------------------------------------------------*/
-
-/* Client-to-session message types */
-#define SESS_CLI_CONNECT 1
-#define SESS_CLI_PREPARE 2
-#define SESS_CLI_EXECUTE 3
-#define SESS_CLI_BREAK_EXECUTION 4
-
-/* Client-to-session statement command types */
-#define SESS_COMM_FETCH_NEXT 1
-#define SESS_COMM_FETCH_PREV 2
-#define SESS_COMM_FETCH_FIRST 3
-#define SESS_COMM_FETCH_LAST 4
-#define SESS_COMM_FETCH_NTH 5
-#define SESS_COMM_FETCH_NTH_LAST 6
-#define SESS_COMM_EXECUTE 7
-#define SESS_COMM_NO_COMMAND 8
-
-/*---------------------------------------------------*/
-/* The format of an outgoing message from a session to the client */
-#define SESS_SRV_MSG_CHECKSUM 0 /* the checksum should be the first
- field in the message */
-#define SESS_SRV_MSG_SESS_ID 4
-#define SESS_SRV_MSG_TYPE 12
-#define SESS_SRV_MSG_NO 16
-#define SESS_SRV_MSG_CONTINUE 24 /* 0, or SESS_MSG_FIRST_PART
- SESS_MSG_MIDDLE_PART, or
- SESS_MSG_LAST_PART */
-#define SESS_SRV_MSG_CONT_SIZE 28 /* size of a multipart message
- in kilobytes (rounded upward) */
-#define SESS_SRV_MSG_DATA 32
-/*---------------------------------------------------*/
-
-/* Session-to-client message types */
-#define SESS_SRV_ACCEPT_CONNECT 1
-#define SESS_SRV_SUCCESS 2
-#define SESS_SRV_ERROR 3
-
-/* Multipart messages */
-#define SESS_MSG_SINGLE_PART 0
-#define SESS_MSG_FIRST_PART 1
-#define SESS_MSG_MIDDLE_PART 2
-#define SESS_MSG_LAST_PART 3
-
-/* Error numbers */
-#define SESS_ERR_NONE 0
-#define SESS_ERR_TRX_COMMITTED 1
-#define SESS_ERR_TRX_ROLLED_BACK 2
-#define SESS_ERR_SESSION_DISCONNECTED 3
-#define SESS_ERR_REPLY_FAILED 4
-#define SESS_ERR_CANNOT_BREAK_OP 5
-#define SESS_ERR_MSG_LOST 6
-#define SESS_ERR_MSG_CORRUPTED 7
-#define SESS_ERR_EXTRANEOUS_MSG 8
-#define SESS_ERR_OUT_OF_MEMORY 9
-#define SESS_ERR_SQL_ERROR 10
-#define SESS_ERR_STMT_NOT_FOUND 11
-#define SESS_ERR_STMT_NOT_READY 12
-#define SESS_ERR_EXTRANEOUS_SRV_MSG 13
-#define SESS_ERR_BREAK_BY_CLIENT 14
-
/* Session states */
#define SESS_ACTIVE 1
#define SESS_ERROR 2 /* session contains an error message
which has not yet been communicated
to the client */
-/* Session system states */
-#define SESS_SYS_RUNNING 1
-#define SESS_SYS_SHUTTING_DOWN 2
-
-/* Session hash table size */
-#define SESS_HASH_SIZE 1024
-
-/* Flags used in sess_srv_msg_send */
-#define SESS_RELEASE_KERNEL 1
-#define SESS_NOT_RELEASE_KERNEL 2
-
#ifndef UNIV_NONINL
#include "usr0sess.ic"
#endif
diff --git a/innobase/include/usr0sess.ic b/innobase/include/usr0sess.ic
index ee2592c7963..c851d5745b9 100644
--- a/innobase/include/usr0sess.ic
+++ b/innobase/include/usr0sess.ic
@@ -5,27 +5,3 @@ Sessions
Created 6/25/1996 Heikki Tuuri
*******************************************************/
-
-/***************************************************************************
-Sets the message type of a message from the client. */
-UNIV_INLINE
-void
-sess_cli_msg_set_type(
-/*==================*/
- byte* str, /* in: message string */
- ulint type) /* in: message type */
-{
- mach_write_to_4(str + SESS_CLI_MSG_TYPE, type);
-}
-
-/***************************************************************************
-Gets the message type of a message from the server. */
-UNIV_INLINE
-ulint
-sess_srv_msg_get_type(
-/*==================*/
- /* out: message type */
- byte* str) /* in: message string */
-{
- return(mach_read_from_4(str + SESS_SRV_MSG_TYPE));
-}
diff --git a/innobase/include/usr0types.h b/innobase/include/usr0types.h
index 67070ccce27..29359425169 100644
--- a/innobase/include/usr0types.h
+++ b/innobase/include/usr0types.h
@@ -10,7 +10,5 @@ Created 6/25/1996 Heikki Tuuri
#define usr0types_h
typedef struct sess_struct sess_t;
-typedef struct sess_sys_struct sess_sys_t;
-typedef struct sess_sig_struct sess_sig_t;
#endif
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index 9b07d5da488..085b4811a73 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -10,7 +10,6 @@ Created 1/30/1994 Heikki Tuuri
#define ut0dbg_h
#include "univ.i"
-#include <assert.h>
#include <stdlib.h>
#include "os0thread.h"
@@ -24,7 +23,7 @@ extern const char* ut_dbg_msg_assert_fail;
extern const char* ut_dbg_msg_trap;
extern const char* ut_dbg_msg_stop;
-#define ut_a(EXPR)\
+#define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
@@ -33,38 +32,32 @@ extern const char* ut_dbg_msg_stop;
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
ut_dbg_stop_threads = TRUE;\
- (*ut_dbg_null_ptr)++;\
+ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr, ut_dbg_msg_stop,\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
- }
+ }\
+} while (0)
-#define ut_error\
+#define ut_error do {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
- (*ut_dbg_null_ptr)++;
+ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
+} while (0)
#ifdef UNIV_DEBUG
#define ut_ad(EXPR) ut_a(EXPR)
-#define ut_d(EXPR) {EXPR;}
+#define ut_d(EXPR) do {EXPR;} while (0)
#else
#define ut_ad(EXPR)
#define ut_d(EXPR)
#endif
-
#define UT_NOT_USED(A) A = A
-
-
-
-
-
-
#endif
-