branches/zip:

Add the proper macros for checking the correct latching order in trx
information_schema code.

Approved by:	Marko
This commit is contained in:
vasil 2007-10-12 11:20:13 +00:00
parent 23b5958255
commit 5ccc74c515
3 changed files with 18 additions and 5 deletions

View file

@ -383,9 +383,10 @@ or row lock! */
their level set after the page is
locked; see e.g.
ibuf_bitmap_get_map_page(). */
#define SYNC_INFORMATION_SCHEMA 1900 /* Used when latching
INFORMATION SCHEMA internal
structures. */
#define SYNC_TRX_I_S_RWLOCK 1910 /* Used for
trx_i_s_cache_t::rw_lock */
#define SYNC_TRX_I_S_LAST_READ 1900 /* Used for
trx_i_s_cache_t::last_read_mutex */
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
this in X-mode, implicit or backround
operations purge, rollback, foreign

View file

@ -1036,6 +1036,8 @@ sync_thread_add_level(
case SYNC_DICT_AUTOINC_MUTEX:
case SYNC_DICT_OPERATION:
case SYNC_DICT_HEADER:
case SYNC_TRX_I_S_RWLOCK:
case SYNC_TRX_I_S_LAST_READ:
if (!sync_thread_levels_g(array, level)) {
fprintf(stderr,
"InnoDB: sync_thread_levels_g(array, %lu)"

View file

@ -834,11 +834,21 @@ trx_i_s_cache_init(
/*===============*/
trx_i_s_cache_t* cache) /* out: cache to init */
{
rw_lock_create(&cache->rw_lock, SYNC_INFORMATION_SCHEMA);
/* The latching is done in the following order:
acquire trx_i_s_cache_t::rw_lock, X
acquire kernel_mutex
release kernel_mutex
release trx_i_s_cache_t::rw_lock
acquire trx_i_s_cache_t::rw_lock, S
acquire trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::rw_lock */
rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0;
mutex_create(&cache->last_read_mutex, SYNC_INFORMATION_SCHEMA);
mutex_create(&cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));