3264 Marko Mäkelä 2010-10-20 [merge]
Merge from mysql-5.5-innodb to mysql-trunk-innodb
modified:
storage/innobase/buf/buf0buddy.c
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0flu.c
storage/innobase/buf/buf0lru.c
storage/innobase/include/buf0buddy.h
storage/innobase/include/buf0buddy.ic
storage/innobase/include/buf0buf.h
storage/innobase/include/buf0flu.h
storage/innobase/sync/sync0sync.c
3263 Marko Mäkelä 2010-10-20
Fix two errors introduced in the Bug#57232 fix by Sunny Bains
revno: 3262
revision-id: sunny.bains@strippedom-20101020085444-drizi19jxee2kdkp
modified:
storage/innobase/lock/lock0lock.c
storage/innobase/row/row0mysql.c
=== modified file 'storage/innobase/buf/buf0buddy.c'
--- a/storage/innobase/buf/buf0buddy.c revid:marko.makela@stripped
+++ b/storage/innobase/buf/buf0buddy.c revid:marko.makela@oracle.com-20101020115325-awy8g543bms81hhz
@@ -281,7 +281,7 @@ buf_buddy_alloc_from(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c revid:marko.makela@oracle.com-20101020103435-stzwo66g76u1zqfz
+++ b/storage/innobase/buf/buf0buf.c revid:marko.makela@stripped1020115325-awy8g543bms81hhz
@@ -173,7 +173,7 @@ The chain of modified blocks (buf_pool->
holding file pages that have been modified in the memory
but not written to disk yet. The block with the oldest modification
which has not yet been written to disk is at the end of the chain.
-The access to this list is protected by flush_list_mutex.
+The access to this list is protected by buf_pool->flush_list_mutex.
The chain of unmodified compressed blocks (buf_pool->zip_clean)
contains the control blocks (buf_page_t) of those compressed pages
@@ -1932,7 +1932,7 @@ page_found:
hash_mutexes. buf_pool mutex is needed because any changes to
the page_hash must be covered by it and hash_mutexes are needed
because we don't want to read any stale information in
- buf_pool_watch[]. However, it is not in the critical code path
+ buf_pool->watch[]. However, it is not in the critical code path
as this function will be called only by the purge thread. */
@@ -1969,8 +1969,8 @@ page_found:
ut_ad(!bpage->in_page_hash);
ut_ad(bpage->buf_fix_count == 0);
- /* bpage is pointing to buf_pool_watch[],
- which is protected by buf_pool_mutex.
+ /* bpage is pointing to buf_pool->watch[],
+ which is protected by buf_pool->mutex.
Normally, buf_page_t objects are protected by
buf_block_t::mutex or buf_pool->zip_mutex or both. */
@@ -3061,7 +3061,7 @@ wait_until_unfixed:
mutex_enter(&block->mutex);
if (UNIV_UNLIKELY(bpage != hash_bpage)) {
/* The buf_pool->page_hash was modified
- while buf_pool_mutex was released.
+ while buf_pool->mutex was released.
Free the block that was allocated. */
buf_LRU_block_free_non_file_page(block);
=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c revid:marko.makela@stripped-stzwo66g76u1zqfz
+++ b/storage/innobase/buf/buf0flu.c revid:marko.makela@strippedhz
@@ -324,7 +324,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_flush_list_mutex_enter(buf_pool);
- /* The field in_LRU_list is protected by buf_pool_mutex, which
+ /* The field in_LRU_list is protected by buf_pool->mutex, which
we are not holding. However, while a block is in the flush
list, it is dirty and cannot be discarded, not from the
page_hash or from the LRU list. At most, the uncompressed
@@ -1066,7 +1066,7 @@ buf_flush_write_block_low(
ut_ad(buf_page_in_file(bpage));
- /* We are not holding buf_pool_mutex or block_mutex here.
+ /* We are not holding buf_pool->mutex or block_mutex here.
Nevertheless, it is safe to access bpage, because it is
io_fixed and oldest_modification != 0. Thus, it cannot be
relocated in the buffer pool or removed from flush_list or
@@ -1140,7 +1140,7 @@ buf_flush_write_block_low(
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
-NOTE: buf_pool_mutex and block->mutex must be held upon entering this
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
function, and they will be released by this function after flushing.
This is loosely based on buf_flush_batch() and buf_flush_page().
@return TRUE if the page was flushed and the mutexes released */
@@ -2198,12 +2198,12 @@ buf_flush_validate_low(
ut_ad(bpage->in_flush_list);
- /* A page in flush_list can be in BUF_BLOCK_REMOVE_HASH
- state. This happens when a page is in the middle of
- being relocated. In that case the original descriptor
- can have this state and still be in the flush list
- waiting to acquire the flush_list_mutex to complete
- the relocation. */
+ /* A page in buf_pool->flush_list can be in
+ BUF_BLOCK_REMOVE_HASH state. This happens when a page
+ is in the middle of being relocated. In that case the
+ original descriptor can have this state and still be
+ in the flush list waiting to acquire the
+ buf_pool->flush_list_mutex to complete the relocation. */
ut_a(buf_page_in_file(bpage)
|| buf_page_get_state(bpage) == BUF_BLOCK_REMOVE_HASH);
ut_a(om > 0);
=== modified file 'storage/innobase/buf/buf0lru.c'
--- a/storage/innobase/buf/buf0lru.c revid:marko.makela@oracle.com-20101020103435-stzwo66g76u1zqfz
+++ b/storage/innobase/buf/buf0lru.c revid:marko.makela@stripped325-awy8g543bms81hhz
@@ -123,7 +123,7 @@ Takes a block out of the LRU list and pa
If the block is compressed-only (BUF_BLOCK_ZIP_PAGE),
the object will be freed.
-The caller must hold buf_pool_mutex, the buf_page_get_mutex() mutex
+The caller must hold buf_pool->mutex, the buf_page_get_mutex() mutex
and the appropriate hash_mutex. This function will release the
buf_page_get_mutex() and the hash_mutex.
@@ -360,8 +360,8 @@ scan_again:
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
/* bpage->space and bpage->io_fix are protected by
- buf_pool_mutex and block_mutex. It is safe to check
- them while holding buf_pool_mutex only. */
+ buf_pool->mutex and block_mutex. It is safe to check
+ them while holding buf_pool->mutex only. */
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
@@ -415,7 +415,7 @@ scan_again:
/* Descriptors of uncompressed
blocks will not be relocated,
because we are holding the
- buf_pool_mutex. */
+ buf_pool->mutex. */
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
@@ -1447,10 +1447,10 @@ Try to free a block. If bpage is a desc
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
-release buf_pool_mutex. Furthermore, the page frame will no longer be
+release buf_pool->mutex. Furthermore, the page frame will no longer be
accessible via bpage.
-The caller must hold buf_pool_mutex and must not hold any
+The caller must hold buf_pool->mutex and must not hold any
buf_page_get_mutex() when calling this function.
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
BUF_LRU_NOT_FREED otherwise. */
=== modified file 'storage/innobase/include/buf0buddy.h'
--- a/storage/innobase/include/buf0buddy.h revid:marko.makela@strippedstzwo66g76u1zqfz
+++ b/storage/innobase/include/buf0buddy.h revid:marko.makela@strippedms81hhz
@@ -36,7 +36,7 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
=== modified file 'storage/innobase/include/buf0buddy.ic'
--- a/storage/innobase/include/buf0buddy.ic revid:marko.makela@strippedtzwo66g76u1zqfz
+++ b/storage/innobase/include/buf0buddy.ic revid:marko.makela@strippedms81hhz
@@ -35,7 +35,7 @@ Created December 2006 by Marko Makela
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
The buf_pool->mutex may only be released and reacquired if lru != NULL.
@return allocated block, possibly NULL if lru==NULL */
UNIV_INTERN
@@ -86,7 +86,7 @@ buf_buddy_get_slot(
/**********************************************************************//**
Allocate a block. The thread calling this function must hold
-buf_pool->mutex and must not hold buf_pool_zip_mutex or any
+buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool->mutex may only be released and reacquired
if lru != NULL. This function should only be used for allocating
compressed page frames or control blocks (buf_page_t). Allocated
=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h revid:marko.makela@stripped020103435-stzwo66g76u1zqfz
+++ b/storage/innobase/include/buf0buf.h revid:marko.makela@strippedwy8g543bms81hhz
@@ -99,7 +99,7 @@ enum buf_page_state {
BUF_BLOCK_ZIP_FREE = 0, /*!< contains a free
compressed page */
BUF_BLOCK_POOL_WATCH = 0, /*!< a sentinel for the buffer pool
- watch, element of buf_pool_watch[] */
+ watch, element of buf_pool->watch[] */
BUF_BLOCK_ZIP_PAGE, /*!< contains a clean
compressed page */
BUF_BLOCK_ZIP_DIRTY, /*!< contains a compressed
@@ -1242,10 +1242,10 @@ struct buf_page_struct{
#endif /* !UNIV_HOTBACKUP */
page_zip_des_t zip; /*!< compressed page; zip.data
(but not the data it points to) is
- also protected by buf_pool_mutex;
+ also protected by buf_pool->mutex;
state == BUF_BLOCK_ZIP_PAGE and
zip.data == NULL means an active
- buf_pool_watch */
+ buf_pool->watch */
#ifndef UNIV_HOTBACKUP
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
@@ -1256,15 +1256,16 @@ struct buf_page_struct{
#endif /* UNIV_DEBUG */
/** @name Page flushing fields
- All these are protected by buf_pool_mutex. */
+ All these are protected by buf_pool->mutex. */
/* @{ */
UT_LIST_NODE_T(buf_page_t) list;
/*!< based on state, this is a
list node, protected either by
- buf_pool_mutex or by
- flush_list_mutex, in one of the
- following lists in buf_pool:
+ buf_pool->mutex or by
+ buf_pool->flush_list_mutex,
+ in one of the following lists in
+ buf_pool:
- BUF_BLOCK_NOT_USED: free
- BUF_BLOCK_FILE_PAGE: flush_list
@@ -1274,9 +1275,9 @@ struct buf_page_struct{
If bpage is part of flush_list
then the node pointers are
- covered by flush_list_mutex.
+ covered by buf_pool->flush_list_mutex.
Otherwise these pointers are
- protected by buf_pool_mutex.
+ protected by buf_pool->mutex.
The contents of the list node
is undefined if !in_flush_list
@@ -1288,17 +1289,18 @@ struct buf_page_struct{
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
- when flush_list_mutex is free, the
- following should hold: in_flush_list
+ when buf_pool->flush_list_mutex is
+ free, the following should hold:
+ in_flush_list
== (state == BUF_BLOCK_FILE_PAGE
|| state == BUF_BLOCK_ZIP_DIRTY)
Writes to this field must be
covered by both block->mutex
- and flush_list_mutex. Hence
+ and buf_pool->flush_list_mutex. Hence
reads can happen while holding
any one of the two mutexes */
ibool in_free_list; /*!< TRUE if in buf_pool->free; when
- buf_pool_mutex is free, the following
+ buf_pool->mutex is free, the following
should hold: in_free_list
== (state == BUF_BLOCK_NOT_USED) */
#endif /* UNIV_DEBUG */
@@ -1318,7 +1320,7 @@ struct buf_page_struct{
modifications are on disk.
Writes to this field must be
covered by both block->mutex
- and flush_list_mutex. Hence
+ and buf_pool->flush_list_mutex. Hence
reads can happen while holding
any one of the two mutexes */
/* @} */
@@ -1572,9 +1574,9 @@ struct buf_pool_struct{
page_hash is protected by an
array of mutexes.
Changes in page_hash are protected
- by buf_pool_mutex and the relevant
+ by buf_pool->mutex and the relevant
page_hash mutex. Lookups can happen
- while holding the buf_pool_mutex or
+ while holding the buf_pool->mutex or
the relevant page_hash mutex. */
hash_table_t* zip_hash; /*!< hash table of buf_block_t blocks
whose frames are allocated to the
@@ -1700,20 +1702,13 @@ struct buf_pool_struct{
/* @} */
};
-/** mutex protecting the buffer pool struct and control blocks, except the
-read-write lock in them */
-extern mutex_t buf_pool_mutex;
-/** mutex protecting the control blocks of compressed-only pages
-(of type buf_page_t, not buf_block_t) */
-extern mutex_t buf_pool_zip_mutex;
-
-/** @name Accessors for buf_pool_mutex.
-Use these instead of accessing buf_pool_mutex directly. */
+/** @name Accessors for buf_pool->mutex.
+Use these instead of accessing buf_pool->mutex directly. */
/* @{ */
-/** Test if buf_pool_mutex is owned. */
+/** Test if a buffer pool mutex is owned. */
#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
-/** Acquire the buffer pool mutex. */
+/** Acquire a buffer pool mutex. */
#define buf_pool_mutex_enter(b) do { \
ut_ad(!mutex_own(&b->zip_mutex)); \
mutex_enter(&b->mutex); \
=== modified file 'storage/innobase/include/buf0flu.h'
--- a/storage/innobase/include/buf0flu.h revid:marko.makela@stripped
+++ b/storage/innobase/include/buf0flu.h revid:marko.makela@strippedom-20101020115325-awy8g543bms81hhz
@@ -87,7 +87,7 @@ buf_flush_init_for_writing(
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
-NOTE: buf_pool_mutex and block->mutex must be held upon entering this
+NOTE: buf_pool->mutex and block->mutex must be held upon entering this
function, and they will be released by this function after flushing.
This is loosely based on buf_flush_batch() and buf_flush_page().
@return TRUE if the page was flushed and the mutexes released */
=== modified file 'storage/innobase/sync/sync0sync.c'
--- a/storage/innobase/sync/sync0sync.c revid:marko.makela@oracle.com-20101020103435-stzwo66g76u1zqfz
+++ b/storage/innobase/sync/sync0sync.c revid:marko.makela@stripped01020115325-awy8g543bms81hhz
@@ -1214,8 +1214,8 @@ sync_thread_add_level(
case SYNC_BUF_BLOCK:
/* Either the thread must own the buffer pool mutex
- (buf_pool_mutex), or it is allowed to latch only ONE
- buffer block (block->mutex or buf_pool_zip_mutex). */
+ (buf_pool->mutex), or it is allowed to latch only ONE
+ buffer block (block->mutex or buf_pool->zip_mutex). */
if (!sync_thread_levels_g(array, level, FALSE)) {
ut_a(sync_thread_levels_g(array, level - 1, TRUE));
ut_a(sync_thread_levels_contain(array, SYNC_BUF_POOL));
Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20101020115325-awy8g543bms81hhz.bundle
| Thread |
|---|
| • bzr push into mysql-trunk-innodb branch (marko.makela:3263 to 3264) | marko.makela | 20 Oct |