Commit 86018ed1 authored by marko's avatar marko

branches/zip: Fix and clarify the latching of some buf_block_t members.

buf_block_t::check_index_page_at_flush: Note that this field is not
protected by any mutex. Make it a separate field, not a bitfield that
could share the machine word with other fields.

buf_block_t::lock_hash_val: Note that this field is protected by
buf_block_t::lock (or during block creation, by buf_pool_mutex and
buf_block_t::mutex).

buf_block_get_lock_hash_val(): Assert that block->lock is held by the
current thread.

Issue #465, rb://267 approved by Inaam Rana
parent 33ebfa0b
2010-03-11 The InnoDB Team
* buf0buf.h, buf0buf.ic:
Fix and clarify the latching of some buf_block_t members.
Note that check_index_page_at_flush is not protected by any mutex.
Note and assert that lock_hash_val is protected by the rw-latch.
2010-03-10 The InnoDB Team 2010-03-10 The InnoDB Team
* trx/trx0sys.c: * trx/trx0sys.c:
......
...@@ -1179,15 +1179,21 @@ struct buf_block_struct{ ...@@ -1179,15 +1179,21 @@ struct buf_block_struct{
rw_lock_t lock; /*!< read-write lock of the buffer rw_lock_t lock; /*!< read-write lock of the buffer
frame */ frame */
unsigned lock_hash_val:32;/*!< hashed value of the page address unsigned lock_hash_val:32;/*!< hashed value of the page address
in the record lock hash table */ in the record lock hash table;
unsigned check_index_page_at_flush:1; protected by buf_block_t::lock
(or buf_block_t::mutex, buf_pool_mutex
in buf_page_get_gen(),
buf_page_init_for_read()
and buf_page_create()) */
ibool check_index_page_at_flush;
/*!< TRUE if we know that this is /*!< TRUE if we know that this is
an index page, and want the database an index page, and want the database
to check its consistency before flush; to check its consistency before flush;
note that there may be pages in the note that there may be pages in the
buffer pool which are index pages, buffer pool which are index pages,
but this flag is not set because but this flag is not set because
we do not keep track of all pages */ we do not keep track of all pages;
NOT protected by any mutex */
/* @} */ /* @} */
/** @name Optimistic search field */ /** @name Optimistic search field */
/* @{ */ /* @{ */
......
...@@ -705,6 +705,12 @@ buf_block_get_lock_hash_val( ...@@ -705,6 +705,12 @@ buf_block_get_lock_hash_val(
/*========================*/ /*========================*/
const buf_block_t* block) /*!< in: block */ const buf_block_t* block) /*!< in: block */
{ {
ut_ad(block);
ut_ad(buf_page_in_file(&block->page));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_EXCLUSIVE)
|| rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
return(block->lock_hash_val); return(block->lock_hash_val);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment