2001-02-17 14:19:19 +02:00
|
|
|
/******************************************************
|
|
|
|
Mutex, the basic synchronization primitive
|
|
|
|
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
|
|
|
|
Created 9/5/1995 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#ifndef sync0sync_h
|
|
|
|
#define sync0sync_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
#include "sync0types.h"
|
|
|
|
#include "ut0lst.h"
|
|
|
|
#include "ut0mem.h"
|
|
|
|
#include "os0thread.h"
|
|
|
|
#include "os0sync.h"
|
|
|
|
#include "sync0arr.h"
|
|
|
|
|
2005-02-04 16:25:13 +02:00
|
|
|
#ifndef UNIV_HOTBACKUP
|
2004-12-24 13:31:21 +01:00
|
|
|
extern my_bool timed_mutexes;
|
2005-02-04 16:25:13 +02:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
2004-12-24 12:13:32 +01:00
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Initializes the synchronization data structures. */
|
|
|
|
|
|
|
|
void
|
|
|
|
sync_init(void);
|
|
|
|
/*===========*/
|
|
|
|
/**********************************************************************
|
|
|
|
Frees the resources in synchronization data structures. */
|
|
|
|
|
|
|
|
void
|
|
|
|
sync_close(void);
|
|
|
|
/*===========*/
|
|
|
|
/**********************************************************************
|
|
|
|
Creates, or rather, initializes a mutex object to a specified memory
|
|
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
|
|
necessary only if the memory block containing it is freed. */
|
|
|
|
|
2005-01-03 21:27:17 +01:00
|
|
|
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, #M)
|
2001-02-17 14:19:19 +02:00
|
|
|
/*===================*/
|
|
|
|
/**********************************************************************
|
|
|
|
Creates, or rather, initializes a mutex object in a specified memory
|
|
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
|
|
necessary only if the memory block containing it is freed. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_create_func(
|
|
|
|
/*==============*/
|
|
|
|
mutex_t* mutex, /* in: pointer to memory */
|
2004-05-14 16:06:21 +03:00
|
|
|
const char* cfile_name, /* in: file name where created */
|
2004-12-24 13:31:21 +01:00
|
|
|
ulint cline, /* in: file line where created */
|
|
|
|
const char* cmutex_name); /* in: mutex name */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Calling this function is obligatory only if the memory buffer containing
|
|
|
|
the mutex is freed. Removes a mutex object from the mutex list. The mutex
|
|
|
|
is checked to be in the reset state. */
|
|
|
|
|
2001-04-19 14:43:32 +03:00
|
|
|
#undef mutex_free /* Fix for MacOS X */
|
2001-02-17 14:19:19 +02:00
|
|
|
void
|
|
|
|
mutex_free(
|
|
|
|
/*=======*/
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
|
|
|
/******************************************************************
|
|
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
|
|
corresponding function. */
|
|
|
|
|
2004-05-14 16:06:21 +03:00
|
|
|
#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
|
2004-04-09 22:18:18 +03:00
|
|
|
/**********************************************************************
|
|
|
|
A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
|
|
|
|
inlining of InnoDB functions, and no inlined functions should be called from
|
|
|
|
there. That is why we need to duplicate the inlined function here. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_enter_noninline(
|
|
|
|
/*==================*/
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
2001-02-17 14:19:19 +02:00
|
|
|
/******************************************************************
|
|
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
|
|
corresponding function. */
|
|
|
|
|
|
|
|
/* NOTE! currently same as mutex_enter! */
|
|
|
|
|
2004-05-14 16:06:21 +03:00
|
|
|
#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
|
2001-10-10 22:47:08 +03:00
|
|
|
#define mutex_enter_fast_func mutex_enter_func;
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
NOTE! Use the corresponding macro in the header file, not this function
|
|
|
|
directly. Locks a mutex for the current thread. If the mutex is reserved
|
|
|
|
the function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting
|
|
|
|
for the mutex before suspending the thread. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
mutex_enter_func(
|
|
|
|
/*=============*/
|
2001-10-10 22:47:08 +03:00
|
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
2004-05-14 16:06:21 +03:00
|
|
|
const char* file_name, /* in: file name where locked */
|
2001-10-10 22:47:08 +03:00
|
|
|
ulint line); /* in: line where locked */
|
2001-02-17 14:19:19 +02:00
|
|
|
/************************************************************************
|
|
|
|
Tries to lock the mutex for the current thread. If the lock is not acquired
|
|
|
|
immediately, returns with return value 1. */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
mutex_enter_nowait(
|
|
|
|
/*===============*/
|
2001-10-10 22:47:08 +03:00
|
|
|
/* out: 0 if succeed, 1 if not */
|
|
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
2004-05-14 16:06:21 +03:00
|
|
|
const char* file_name, /* in: file name where mutex
|
2001-10-10 22:47:08 +03:00
|
|
|
requested */
|
2004-05-14 16:06:21 +03:00
|
|
|
ulint line); /* in: line where requested */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Unlocks a mutex owned by the current thread. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
mutex_exit(
|
|
|
|
/*=======*/
|
|
|
|
mutex_t* mutex); /* in: pointer to mutex */
|
|
|
|
/**********************************************************************
|
2004-04-09 22:18:18 +03:00
|
|
|
Releases a mutex. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_exit_noninline(
|
|
|
|
/*=================*/
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
|
|
|
/**********************************************************************
|
2001-02-17 14:19:19 +02:00
|
|
|
Returns TRUE if no mutex or rw-lock is currently locked.
|
|
|
|
Works only in the debug version. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
sync_all_freed(void);
|
|
|
|
/*================*/
|
|
|
|
/*#####################################################################
|
|
|
|
FUNCTION PROTOTYPES FOR DEBUGGING */
|
|
|
|
/***********************************************************************
|
|
|
|
Prints wait info of the sync system. */
|
|
|
|
|
|
|
|
void
|
2002-07-08 19:34:49 +03:00
|
|
|
sync_print_wait_info(
|
|
|
|
/*=================*/
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
FILE* file); /* in: file where to print */
|
2001-02-17 14:19:19 +02:00
|
|
|
/***********************************************************************
|
|
|
|
Prints info of the sync system. */
|
|
|
|
|
|
|
|
void
|
2002-07-08 19:34:49 +03:00
|
|
|
sync_print(
|
|
|
|
/*=======*/
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
FILE* file); /* in: file where to print */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Checks that the mutex has been initialized. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
mutex_validate(
|
|
|
|
/*===========*/
|
|
|
|
mutex_t* mutex);
|
|
|
|
/**********************************************************************
|
|
|
|
Sets the mutex latching level field. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_set_level(
|
|
|
|
/*============*/
|
|
|
|
mutex_t* mutex, /* in: mutex */
|
|
|
|
ulint level); /* in: level */
|
|
|
|
/**********************************************************************
|
|
|
|
Adds a latch and its level in the thread level array. Allocates the memory
|
|
|
|
for the array if called first time for this OS thread. Makes the checks
|
|
|
|
against other latch levels stored in the array for this thread. */
|
|
|
|
|
|
|
|
void
|
|
|
|
sync_thread_add_level(
|
|
|
|
/*==================*/
|
|
|
|
void* latch, /* in: pointer to a mutex or an rw-lock */
|
|
|
|
ulint level); /* in: level in the latching order; if SYNC_LEVEL_NONE,
|
|
|
|
nothing is done */
|
|
|
|
/**********************************************************************
|
|
|
|
Removes a latch from the thread level array if it is found there. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
sync_thread_reset_level(
|
|
|
|
/*====================*/
|
|
|
|
/* out: TRUE if found from the array; it is no error
|
|
|
|
if the latch is not found, as we presently are not
|
|
|
|
able to determine the level for every latch
|
|
|
|
reservation the program does */
|
|
|
|
void* latch); /* in: pointer to a mutex or an rw-lock */
|
|
|
|
/**********************************************************************
|
|
|
|
Checks that the level array for the current thread is empty. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
sync_thread_levels_empty(void);
|
|
|
|
/*==========================*/
|
|
|
|
/* out: TRUE if empty */
|
|
|
|
/**********************************************************************
|
|
|
|
Checks that the level array for the current thread is empty. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
sync_thread_levels_empty_gen(
|
|
|
|
/*=========================*/
|
|
|
|
/* out: TRUE if empty except the
|
|
|
|
exceptions specified below */
|
|
|
|
ibool dict_mutex_allowed); /* in: TRUE if dictionary mutex is
|
|
|
|
allowed to be owned by the thread,
|
|
|
|
also purge_is_running mutex is
|
|
|
|
allowed */
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Checks that the current thread owns the mutex. Works only
|
|
|
|
in the debug version. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
mutex_own(
|
|
|
|
/*======*/
|
|
|
|
/* out: TRUE if owns */
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
|
|
|
/**********************************************************************
|
|
|
|
Gets the debug information for a reserved mutex. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_get_debug_info(
|
|
|
|
/*=================*/
|
|
|
|
mutex_t* mutex, /* in: mutex */
|
2004-04-28 17:03:26 +03:00
|
|
|
const char** file_name, /* out: file where requested */
|
2001-02-17 14:19:19 +02:00
|
|
|
ulint* line, /* out: line where requested */
|
|
|
|
os_thread_id_t* thread_id); /* out: id of the thread which owns
|
|
|
|
the mutex */
|
|
|
|
/**********************************************************************
|
|
|
|
Counts currently reserved mutexes. Works only in the debug version. */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
mutex_n_reserved(void);
|
|
|
|
/*==================*/
|
|
|
|
/**********************************************************************
|
|
|
|
Prints debug info of currently reserved mutexes. */
|
|
|
|
|
|
|
|
void
|
|
|
|
mutex_list_print_info(void);
|
|
|
|
/*========================*/
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
NOT to be used outside this module except in debugging! Gets the value
|
|
|
|
of the lock word. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
mutex_get_lock_word(
|
|
|
|
/*================*/
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
NOT to be used outside this module except in debugging! Gets the waiters
|
|
|
|
field in a mutex. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
mutex_get_waiters(
|
|
|
|
/*==============*/
|
|
|
|
/* out: value to set */
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
LATCHING ORDER WITHIN THE DATABASE
|
|
|
|
==================================
|
|
|
|
|
|
|
|
The mutex or latch in the central memory object, for instance, a rollback
|
|
|
|
segment object, must be acquired before acquiring the latch or latches to
|
|
|
|
the corresponding file data structure. In the latching order below, these
|
|
|
|
file page object latches are placed immediately below the corresponding
|
|
|
|
central memory object latch or mutex.
|
|
|
|
|
|
|
|
Synchronization object Notes
|
|
|
|
---------------------- -----
|
|
|
|
|
|
|
|
Dictionary mutex If we have a pointer to a dictionary
|
|
|
|
| object, e.g., a table, it can be
|
|
|
|
| accessed without reserving the
|
|
|
|
| dictionary mutex. We must have a
|
|
|
|
| reservation, a memoryfix, to the
|
|
|
|
| appropriate table object in this case,
|
|
|
|
| and the table must be explicitly
|
|
|
|
| released later.
|
|
|
|
V
|
|
|
|
Dictionary header
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Secondary index tree latch The tree latch protects also all
|
|
|
|
| the B-tree non-leaf pages. These
|
|
|
|
V can be read with the page only
|
|
|
|
Secondary index non-leaf bufferfixed to save CPU time,
|
|
|
|
| no s-latch is needed on the page.
|
|
|
|
| Modification of a page requires an
|
|
|
|
| x-latch on the page, however. If a
|
|
|
|
| thread owns an x-latch to the tree,
|
|
|
|
| it is allowed to latch non-leaf pages
|
|
|
|
| even after it has acquired the fsp
|
|
|
|
| latch.
|
|
|
|
V
|
|
|
|
Secondary index leaf The latch on the secondary index leaf
|
|
|
|
| can be kept while accessing the
|
|
|
|
| clustered index, to save CPU time.
|
|
|
|
V
|
|
|
|
Clustered index tree latch To increase concurrency, the tree
|
|
|
|
| latch is usually released when the
|
|
|
|
| leaf page latch has been acquired.
|
|
|
|
V
|
|
|
|
Clustered index non-leaf
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Clustered index leaf
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Transaction system header
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Transaction undo mutex The undo log entry must be written
|
|
|
|
| before any index page is modified.
|
|
|
|
| Transaction undo mutex is for the undo
|
|
|
|
| logs the analogue of the tree latch
|
|
|
|
| for a B-tree. If a thread has the
|
|
|
|
| trx undo mutex reserved, it is allowed
|
|
|
|
| to latch the undo log pages in any
|
|
|
|
| order, and also after it has acquired
|
|
|
|
| the fsp latch.
|
|
|
|
V
|
|
|
|
Rollback segment mutex The rollback segment mutex must be
|
|
|
|
| reserved, if, e.g., a new page must
|
|
|
|
| be added to an undo log. The rollback
|
|
|
|
| segment and the undo logs in its
|
|
|
|
| history list can be seen as an
|
|
|
|
| analogue of a B-tree, and the latches
|
|
|
|
| reserved similarly, using a version of
|
|
|
|
| lock-coupling. If an undo log must be
|
|
|
|
| extended by a page when inserting an
|
|
|
|
| undo log record, this corresponds to
|
|
|
|
| a pessimistic insert in a B-tree.
|
|
|
|
V
|
|
|
|
Rollback segment header
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Purge system latch
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Undo log pages If a thread owns the trx undo mutex,
|
|
|
|
| or for a log in the history list, the
|
|
|
|
| rseg mutex, it is allowed to latch
|
|
|
|
| undo log pages in any order, and even
|
|
|
|
| after it has acquired the fsp latch.
|
|
|
|
| If a thread does not have the
|
|
|
|
| appropriate mutex, it is allowed to
|
|
|
|
| latch only a single undo log page in
|
|
|
|
| a mini-transaction.
|
|
|
|
V
|
|
|
|
File space management latch If a mini-transaction must allocate
|
|
|
|
| several file pages, it can do that,
|
|
|
|
| because it keeps the x-latch to the
|
|
|
|
| file space management in its memo.
|
|
|
|
V
|
|
|
|
File system pages
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Kernel mutex If a kernel operation needs a file
|
|
|
|
| page allocation, it must reserve the
|
|
|
|
| fsp x-latch before acquiring the kernel
|
|
|
|
| mutex.
|
|
|
|
V
|
|
|
|
Search system mutex
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Buffer pool mutex
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Log mutex
|
|
|
|
|
|
|
|
|
Any other latch
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Memory pool mutex */
|
|
|
|
|
|
|
|
/* Latching order levels */
|
2002-04-18 10:40:32 +03:00
|
|
|
|
|
|
|
/* User transaction locks are higher than any of the latch levels below:
|
|
|
|
no latches are allowed when a thread goes to wait for a normal table
|
|
|
|
or row lock! */
|
|
|
|
#define SYNC_USER_TRX_LOCK 9999
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_NO_ORDER_CHECK 3000 /* this can be used to suppress
|
|
|
|
latching order checking */
|
|
|
|
#define SYNC_LEVEL_NONE 2000 /* default: level not defined */
|
Many files:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/ha_innodb.cc:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
sql/ha_innodb.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/buf0buf.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/dict0dict.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/fil0fil.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/lock0lock.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0file.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0proc.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0thread.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0cur.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0page.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/read0read.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0rw.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0sync.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0purge.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.ic:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0btr.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0pcur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0buf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0flu.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fil/fil0fil.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fsp/fsp0fsp.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/ibuf/ibuf0ibuf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/lock/lock0lock.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/mem/mem0dbg.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0file.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0proc.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0page.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/lexyy.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/pars0grm.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/read/read0read.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0ins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0sel.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0uins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0undo.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0upd.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0rw.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0sync.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
2002-10-29 23:16:46 +02:00
|
|
|
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
|
|
|
|
this in X-mode, implicit or backround
|
|
|
|
operations purge, rollback, foreign
|
|
|
|
key checks reserve this in S-mode */
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_DICT 1000
|
2001-05-21 19:04:46 +03:00
|
|
|
#define SYNC_DICT_AUTOINC_MUTEX 999
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_DICT_HEADER 995
|
|
|
|
#define SYNC_IBUF_HEADER 914
|
|
|
|
#define SYNC_IBUF_PESS_INSERT_MUTEX 912
|
|
|
|
#define SYNC_IBUF_MUTEX 910 /* ibuf mutex is really below
|
2003-10-07 17:28:59 +03:00
|
|
|
SYNC_FSP_PAGE: we assign a value this
|
|
|
|
high only to make the program to pass
|
2001-02-17 14:19:19 +02:00
|
|
|
the debug checks */
|
|
|
|
/*-------------------------------*/
|
|
|
|
#define SYNC_INDEX_TREE 900
|
|
|
|
#define SYNC_TREE_NODE_NEW 892
|
|
|
|
#define SYNC_TREE_NODE_FROM_HASH 891
|
|
|
|
#define SYNC_TREE_NODE 890
|
|
|
|
#define SYNC_PURGE_SYS 810
|
|
|
|
#define SYNC_PURGE_LATCH 800
|
|
|
|
#define SYNC_TRX_UNDO 700
|
|
|
|
#define SYNC_RSEG 600
|
|
|
|
#define SYNC_RSEG_HEADER_NEW 591
|
|
|
|
#define SYNC_RSEG_HEADER 590
|
|
|
|
#define SYNC_TRX_UNDO_PAGE 570
|
srv0srv.h Support raw disk partitions as data files
srv0start.c Support raw disk partitions as data files
srv0srv.c Support raw disk partitions as data files
row0purge.c < 4 GB rows, doublewrite, hang fixes
row0row.c < 4 GB rows, doublewrite, hang fixes
row0sel.c < 4 GB rows, doublewrite, hang fixes
row0uins.c < 4 GB rows, doublewrite, hang fixes
row0umod.c < 4 GB rows, doublewrite, hang fixes
row0undo.c < 4 GB rows, doublewrite, hang fixes
row0upd.c < 4 GB rows, doublewrite, hang fixes
srv0srv.c < 4 GB rows, doublewrite, hang fixes
srv0start.c < 4 GB rows, doublewrite, hang fixes
sync0rw.c < 4 GB rows, doublewrite, hang fixes
sync0sync.c < 4 GB rows, doublewrite, hang fixes
trx0purge.c < 4 GB rows, doublewrite, hang fixes
trx0rec.c < 4 GB rows, doublewrite, hang fixes
trx0sys.c < 4 GB rows, doublewrite, hang fixes
btr0btr.c < 4 GB rows, doublewrite, hang fixes
btr0cur.c < 4 GB rows, doublewrite, hang fixes
buf0buf.c < 4 GB rows, doublewrite, hang fixes
buf0flu.c < 4 GB rows, doublewrite, hang fixes
buf0rea.c < 4 GB rows, doublewrite, hang fixes
data0data.c < 4 GB rows, doublewrite, hang fixes
fil0fil.c < 4 GB rows, doublewrite, hang fixes
fsp0fsp.c < 4 GB rows, doublewrite, hang fixes
ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes
lock0lock.c < 4 GB rows, doublewrite, hang fixes
log0log.c < 4 GB rows, doublewrite, hang fixes
log0recv.c < 4 GB rows, doublewrite, hang fixes
os0file.c < 4 GB rows, doublewrite, hang fixes
page0cur.c < 4 GB rows, doublewrite, hang fixes
pars0pars.c < 4 GB rows, doublewrite, hang fixes
rem0cmp.c < 4 GB rows, doublewrite, hang fixes
rem0rec.c < 4 GB rows, doublewrite, hang fixes
row0ins.c < 4 GB rows, doublewrite, hang fixes
row0mysql.c < 4 GB rows, doublewrite, hang fixes
univ.i < 4 GB rows, doublewrite, hang fixes
data0data.ic < 4 GB rows, doublewrite, hang fixes
mach0data.ic < 4 GB rows, doublewrite, hang fixes
rem0rec.ic < 4 GB rows, doublewrite, hang fixes
row0upd.ic < 4 GB rows, doublewrite, hang fixes
trx0rec.ic < 4 GB rows, doublewrite, hang fixes
rem0cmp.h < 4 GB rows, doublewrite, hang fixes
rem0rec.h < 4 GB rows, doublewrite, hang fixes
row0ins.h < 4 GB rows, doublewrite, hang fixes
row0mysql.h < 4 GB rows, doublewrite, hang fixes
row0row.h < 4 GB rows, doublewrite, hang fixes
row0upd.h < 4 GB rows, doublewrite, hang fixes
srv0srv.h < 4 GB rows, doublewrite, hang fixes
sync0sync.h < 4 GB rows, doublewrite, hang fixes
trx0rec.h < 4 GB rows, doublewrite, hang fixes
trx0sys.h < 4 GB rows, doublewrite, hang fixes
trx0types.h < 4 GB rows, doublewrite, hang fixes
trx0undo.h < 4 GB rows, doublewrite, hang fixes
ut0dbg.h < 4 GB rows, doublewrite, hang fixes
ut0ut.h < 4 GB rows, doublewrite, hang fixes
btr0btr.h < 4 GB rows, doublewrite, hang fixes
btr0cur.h < 4 GB rows, doublewrite, hang fixes
buf0buf.h < 4 GB rows, doublewrite, hang fixes
buf0flu.h < 4 GB rows, doublewrite, hang fixes
data0data.h < 4 GB rows, doublewrite, hang fixes
dict0mem.h < 4 GB rows, doublewrite, hang fixes
fil0fil.h < 4 GB rows, doublewrite, hang fixes
fsp0fsp.h < 4 GB rows, doublewrite, hang fixes
os0file.h < 4 GB rows, doublewrite, hang fixes
innobase/include/btr0btr.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/btr0cur.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0buf.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0flu.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/dict0mem.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fil0fil.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fsp0fsp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/os0file.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0cmp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0ins.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0mysql.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0row.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/sync0sync.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0sys.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0types.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0undo.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0dbg.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0ut.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/mach0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/univ.i:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0btr.c:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0buf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0flu.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0rea.c:
< 4 GB rows, doublewrite, hang fixes
innobase/data/data0data.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fil/fil0fil.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fsp/fsp0fsp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/ibuf/ibuf0ibuf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/lock/lock0lock.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0log.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0recv.c:
< 4 GB rows, doublewrite, hang fixes
innobase/os/os0file.c:
< 4 GB rows, doublewrite, hang fixes
innobase/page/page0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/pars/pars0pars.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0cmp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0ins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0mysql.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0row.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0sel.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0uins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0umod.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0undo.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0upd.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0rw.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0sync.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0sys.c:
< 4 GB rows, doublewrite, hang fixes
innobase/srv/srv0srv.c:
Support raw disk partitions as data files
innobase/srv/srv0start.c:
Support raw disk partitions as data files
innobase/include/srv0srv.h:
Support raw disk partitions as data files
2001-08-04 19:36:14 +03:00
|
|
|
#define SYNC_EXTERN_STORAGE 500
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_FSP 400
|
|
|
|
#define SYNC_FSP_PAGE 395
|
|
|
|
/*------------------------------------- Insert buffer headers */
|
|
|
|
/*------------------------------------- ibuf_mutex */
|
2003-10-07 17:28:59 +03:00
|
|
|
/*------------------------------------- Insert buffer tree */
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_IBUF_BITMAP_MUTEX 351
|
|
|
|
#define SYNC_IBUF_BITMAP 350
|
2005-01-12 18:25:39 +02:00
|
|
|
/*------------------------------------- MySQL query cache mutex */
|
|
|
|
/*------------------------------------- MySQL binlog mutex */
|
2001-02-17 14:19:19 +02:00
|
|
|
/*-------------------------------*/
|
|
|
|
#define SYNC_KERNEL 300
|
|
|
|
#define SYNC_REC_LOCK 299
|
|
|
|
#define SYNC_TRX_LOCK_HEAP 298
|
|
|
|
#define SYNC_TRX_SYS_HEADER 290
|
|
|
|
#define SYNC_LOG 170
|
|
|
|
#define SYNC_RECV 168
|
|
|
|
#define SYNC_SEARCH_SYS 160 /* NOTE that if we have a memory
|
|
|
|
heap that can be extended to the
|
|
|
|
buffer pool, its logical level is
|
|
|
|
SYNC_SEARCH_SYS, as memory allocation
|
|
|
|
can call routines there! Otherwise
|
|
|
|
the level is SYNC_MEM_HASH. */
|
|
|
|
#define SYNC_BUF_POOL 150
|
|
|
|
#define SYNC_BUF_BLOCK 149
|
srv0srv.h Support raw disk partitions as data files
srv0start.c Support raw disk partitions as data files
srv0srv.c Support raw disk partitions as data files
row0purge.c < 4 GB rows, doublewrite, hang fixes
row0row.c < 4 GB rows, doublewrite, hang fixes
row0sel.c < 4 GB rows, doublewrite, hang fixes
row0uins.c < 4 GB rows, doublewrite, hang fixes
row0umod.c < 4 GB rows, doublewrite, hang fixes
row0undo.c < 4 GB rows, doublewrite, hang fixes
row0upd.c < 4 GB rows, doublewrite, hang fixes
srv0srv.c < 4 GB rows, doublewrite, hang fixes
srv0start.c < 4 GB rows, doublewrite, hang fixes
sync0rw.c < 4 GB rows, doublewrite, hang fixes
sync0sync.c < 4 GB rows, doublewrite, hang fixes
trx0purge.c < 4 GB rows, doublewrite, hang fixes
trx0rec.c < 4 GB rows, doublewrite, hang fixes
trx0sys.c < 4 GB rows, doublewrite, hang fixes
btr0btr.c < 4 GB rows, doublewrite, hang fixes
btr0cur.c < 4 GB rows, doublewrite, hang fixes
buf0buf.c < 4 GB rows, doublewrite, hang fixes
buf0flu.c < 4 GB rows, doublewrite, hang fixes
buf0rea.c < 4 GB rows, doublewrite, hang fixes
data0data.c < 4 GB rows, doublewrite, hang fixes
fil0fil.c < 4 GB rows, doublewrite, hang fixes
fsp0fsp.c < 4 GB rows, doublewrite, hang fixes
ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes
lock0lock.c < 4 GB rows, doublewrite, hang fixes
log0log.c < 4 GB rows, doublewrite, hang fixes
log0recv.c < 4 GB rows, doublewrite, hang fixes
os0file.c < 4 GB rows, doublewrite, hang fixes
page0cur.c < 4 GB rows, doublewrite, hang fixes
pars0pars.c < 4 GB rows, doublewrite, hang fixes
rem0cmp.c < 4 GB rows, doublewrite, hang fixes
rem0rec.c < 4 GB rows, doublewrite, hang fixes
row0ins.c < 4 GB rows, doublewrite, hang fixes
row0mysql.c < 4 GB rows, doublewrite, hang fixes
univ.i < 4 GB rows, doublewrite, hang fixes
data0data.ic < 4 GB rows, doublewrite, hang fixes
mach0data.ic < 4 GB rows, doublewrite, hang fixes
rem0rec.ic < 4 GB rows, doublewrite, hang fixes
row0upd.ic < 4 GB rows, doublewrite, hang fixes
trx0rec.ic < 4 GB rows, doublewrite, hang fixes
rem0cmp.h < 4 GB rows, doublewrite, hang fixes
rem0rec.h < 4 GB rows, doublewrite, hang fixes
row0ins.h < 4 GB rows, doublewrite, hang fixes
row0mysql.h < 4 GB rows, doublewrite, hang fixes
row0row.h < 4 GB rows, doublewrite, hang fixes
row0upd.h < 4 GB rows, doublewrite, hang fixes
srv0srv.h < 4 GB rows, doublewrite, hang fixes
sync0sync.h < 4 GB rows, doublewrite, hang fixes
trx0rec.h < 4 GB rows, doublewrite, hang fixes
trx0sys.h < 4 GB rows, doublewrite, hang fixes
trx0types.h < 4 GB rows, doublewrite, hang fixes
trx0undo.h < 4 GB rows, doublewrite, hang fixes
ut0dbg.h < 4 GB rows, doublewrite, hang fixes
ut0ut.h < 4 GB rows, doublewrite, hang fixes
btr0btr.h < 4 GB rows, doublewrite, hang fixes
btr0cur.h < 4 GB rows, doublewrite, hang fixes
buf0buf.h < 4 GB rows, doublewrite, hang fixes
buf0flu.h < 4 GB rows, doublewrite, hang fixes
data0data.h < 4 GB rows, doublewrite, hang fixes
dict0mem.h < 4 GB rows, doublewrite, hang fixes
fil0fil.h < 4 GB rows, doublewrite, hang fixes
fsp0fsp.h < 4 GB rows, doublewrite, hang fixes
os0file.h < 4 GB rows, doublewrite, hang fixes
innobase/include/btr0btr.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/btr0cur.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0buf.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0flu.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/dict0mem.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fil0fil.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fsp0fsp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/os0file.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0cmp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0ins.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0mysql.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0row.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/sync0sync.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0sys.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0types.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0undo.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0dbg.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0ut.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/mach0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/univ.i:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0btr.c:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0buf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0flu.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0rea.c:
< 4 GB rows, doublewrite, hang fixes
innobase/data/data0data.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fil/fil0fil.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fsp/fsp0fsp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/ibuf/ibuf0ibuf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/lock/lock0lock.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0log.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0recv.c:
< 4 GB rows, doublewrite, hang fixes
innobase/os/os0file.c:
< 4 GB rows, doublewrite, hang fixes
innobase/page/page0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/pars/pars0pars.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0cmp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0ins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0mysql.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0row.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0sel.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0uins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0umod.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0undo.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0upd.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0rw.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0sync.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0sys.c:
< 4 GB rows, doublewrite, hang fixes
innobase/srv/srv0srv.c:
Support raw disk partitions as data files
innobase/srv/srv0start.c:
Support raw disk partitions as data files
innobase/include/srv0srv.h:
Support raw disk partitions as data files
2001-08-04 19:36:14 +03:00
|
|
|
#define SYNC_DOUBLEWRITE 140
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_ANY_LATCH 135
|
2001-10-10 22:47:08 +03:00
|
|
|
#define SYNC_THR_LOCAL 133
|
2001-02-17 14:19:19 +02:00
|
|
|
#define SYNC_MEM_HASH 131
|
|
|
|
#define SYNC_MEM_POOL 130
|
|
|
|
|
|
|
|
/* Codes used to designate lock operations */
|
|
|
|
#define RW_LOCK_NOT_LOCKED 350
|
|
|
|
#define RW_LOCK_EX 351
|
|
|
|
#define RW_LOCK_EXCLUSIVE 351
|
|
|
|
#define RW_LOCK_SHARED 352
|
|
|
|
#define RW_LOCK_WAIT_EX 353
|
|
|
|
#define SYNC_MUTEX 354
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
implementation of a mutual exclusion semaphore. */
|
|
|
|
|
|
|
|
struct mutex_struct {
|
|
|
|
ulint lock_word; /* This ulint is the target of the atomic
|
|
|
|
test-and-set instruction in Win32 */
|
2002-04-18 10:40:32 +03:00
|
|
|
#if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER)
|
2001-02-17 14:19:19 +02:00
|
|
|
os_fast_mutex_t
|
|
|
|
os_fast_mutex; /* In other systems we use this OS mutex
|
|
|
|
in place of lock_word */
|
|
|
|
#endif
|
|
|
|
ulint waiters; /* This ulint is set to 1 if there are (or
|
|
|
|
may be) threads waiting in the global wait
|
|
|
|
array for this mutex to be released.
|
|
|
|
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. */
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
const char* file_name; /* File where the mutex was locked */
|
|
|
|
ulint line; /* Line where the mutex was locked */
|
2001-02-17 14:19:19 +02:00
|
|
|
os_thread_id_t thread_id; /* Debug version: The thread id of the
|
|
|
|
thread which locked the mutex. */
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
ulint level; /* Level in the global latching
|
2001-02-17 14:19:19 +02:00
|
|
|
order; default SYNC_LEVEL_NONE */
|
2004-05-14 16:06:21 +03:00
|
|
|
const char* cfile_name;/* File name where mutex created */
|
2001-02-17 14:19:19 +02:00
|
|
|
ulint cline; /* Line where created */
|
|
|
|
ulint magic_n;
|
2005-02-04 16:25:13 +02:00
|
|
|
#ifndef UNIV_HOTBACKUP
|
2004-12-24 12:13:32 +01:00
|
|
|
ulong count_using; /* count of times mutex used */
|
|
|
|
ulong count_spin_loop; /* count of spin loops */
|
|
|
|
ulong count_spin_rounds; /* count of spin rounds */
|
|
|
|
ulong count_os_wait; /* count of os_wait */
|
|
|
|
ulong count_os_yield; /* count of os_wait */
|
|
|
|
ulonglong lspent_time; /* mutex os_wait timer msec */
|
|
|
|
ulonglong lmax_spent_time; /* mutex os_wait timer msec */
|
2004-12-24 13:31:21 +01:00
|
|
|
const char* cmutex_name;/* mutex name */
|
2004-12-24 12:13:32 +01:00
|
|
|
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
|
2005-02-04 16:25:13 +02:00
|
|
|
#endif /* !UNIV_HOTBACKUP */
|
2001-02-17 14:19:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MUTEX_MAGIC_N (ulint)979585
|
|
|
|
|
|
|
|
/* The global array of wait cells for implementation of the databases own
|
|
|
|
mutexes and read-write locks. Appears here for debugging purposes only! */
|
|
|
|
|
|
|
|
extern sync_array_t* sync_primary_wait_array;
|
|
|
|
|
|
|
|
/* Constant determining how long spin wait is continued before suspending
|
|
|
|
the thread. A value 600 rounds on a 1995 100 MHz Pentium seems to correspond
|
|
|
|
to 20 microseconds. */
|
|
|
|
|
|
|
|
#define SYNC_SPIN_ROUNDS srv_n_spin_wait_rounds
|
|
|
|
|
|
|
|
#define SYNC_INFINITE_TIME ((ulint)(-1))
|
|
|
|
|
|
|
|
/* Means that a timeout elapsed when waiting */
|
|
|
|
|
|
|
|
#define SYNC_TIME_EXCEEDED (ulint)1
|
|
|
|
|
|
|
|
/* The number of system calls made in this module. Intended for performance
|
|
|
|
monitoring. */
|
|
|
|
|
|
|
|
extern ulint mutex_system_call_count;
|
|
|
|
extern ulint mutex_exit_count;
|
|
|
|
|
|
|
|
/* Latching order checks start when this is set TRUE */
|
|
|
|
extern ibool sync_order_checks_on;
|
|
|
|
|
|
|
|
/* This variable is set to TRUE when sync_init is called */
|
|
|
|
extern ibool sync_initialized;
|
|
|
|
|
2004-12-24 12:13:32 +01:00
|
|
|
/* Global list of database mutexes (not OS mutexes) created. */
|
2005-07-21 18:05:10 +02:00
|
|
|
typedef UT_LIST_BASE_NODE_T(mutex_t) ut_list_base_node_t;
|
|
|
|
extern ut_list_base_node_t mutex_list;
|
2004-12-24 12:13:32 +01:00
|
|
|
|
|
|
|
/* Mutex protecting the mutex_list variable */
|
2005-07-21 18:05:10 +02:00
|
|
|
extern mutex_t mutex_list_mutex;
|
2004-12-24 12:13:32 +01:00
|
|
|
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
#include "sync0sync.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|