Commit b00b32c7 authored by Vadim Tkachenko's avatar Vadim Tkachenko

sync with extensions rev18

parent eb591867
......@@ -3689,7 +3689,7 @@ btr_blob_free(
mtr_commit(mtr);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
......@@ -3702,7 +3702,11 @@ btr_blob_free(
if (buf_LRU_free_block(&block->page, all, NULL)
!= BUF_LRU_FREED
&& all && block->page.zip.data) {
&& all && block->page.zip.data
/* Now, buf_LRU_free_block() may release mutex temporarily */
&& buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
......@@ -3710,7 +3714,7 @@ btr_blob_free(
}
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&block->mutex);
}
......
......@@ -814,9 +814,11 @@ btr_search_guess_on_hash(
ulint page_no = page_get_page_no(page);
ulint space_id = page_get_space_id(page);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
block = (buf_block_t*) buf_page_hash_get(space_id, page_no);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
}
if (UNIV_UNLIKELY(!block)
......@@ -1699,7 +1701,8 @@ btr_search_validate(void)
rec_offs_init(offsets_);
rw_lock_x_lock(&btr_search_latch);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
cell_count = hash_get_n_cells(btr_search_sys->hash_index);
......@@ -1707,11 +1710,13 @@ btr_search_validate(void)
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
}
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
......@@ -1804,11 +1809,13 @@ btr_search_validate(void)
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if (i != 0) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
}
if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
......@@ -1816,7 +1823,8 @@ btr_search_validate(void)
}
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&btr_search_latch);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
......
......@@ -115,7 +115,8 @@ buf_buddy_alloc_zip(
{
buf_page_t* bpage;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&zip_free_mutex));
ut_a(i < BUF_BUDDY_SIZES);
#if defined UNIV_DEBUG && !defined UNIV_DEBUG_VALGRIND
......@@ -167,10 +168,12 @@ buf_buddy_block_free(
buf_page_t* bpage;
buf_block_t* block;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(!mutex_own(&buf_pool_zip_mutex));
ut_a(!ut_align_offset(buf, UNIV_PAGE_SIZE));
mutex_enter(&zip_hash_mutex);
HASH_SEARCH(hash, buf_pool->zip_hash, fold, buf_page_t*, bpage,
((buf_block_t*) bpage)->frame == buf);
ut_a(bpage);
......@@ -180,6 +183,8 @@ buf_buddy_block_free(
ut_d(bpage->in_zip_hash = FALSE);
HASH_DELETE(buf_page_t, hash, buf_pool->zip_hash, fold, bpage);
mutex_exit(&zip_hash_mutex);
ut_d(memset(buf, 0, UNIV_PAGE_SIZE));
UNIV_MEM_INVALID(buf, UNIV_PAGE_SIZE);
......@@ -201,7 +206,7 @@ buf_buddy_block_register(
buf_block_t* block) /* in: buffer frame to allocate */
{
const ulint fold = BUF_POOL_ZIP_FOLD(block);
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(!mutex_own(&buf_pool_zip_mutex));
buf_block_set_state(block, BUF_BLOCK_MEMORY);
......@@ -212,7 +217,10 @@ buf_buddy_block_register(
ut_ad(!block->page.in_page_hash);
ut_ad(!block->page.in_zip_hash);
ut_d(block->page.in_zip_hash = TRUE);
mutex_enter(&zip_hash_mutex);
HASH_INSERT(buf_page_t, hash, buf_pool->zip_hash, fold, &block->page);
mutex_exit(&zip_hash_mutex);
ut_d(buf_buddy_n_frames++);
}
......@@ -273,17 +281,20 @@ buf_buddy_alloc_low(
{
buf_block_t* block;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(!mutex_own(&buf_pool_zip_mutex));
if (i < BUF_BUDDY_SIZES) {
/* Try to allocate from the buddy system. */
mutex_enter(&zip_free_mutex);
block = buf_buddy_alloc_zip(i);
if (block) {
goto func_exit;
}
mutex_exit(&zip_free_mutex);
}
/* Try allocating from the buf_pool->free list. */
......@@ -300,18 +311,21 @@ buf_buddy_alloc_low(
}
/* Try replacing an uncompressed page in the buffer pool. */
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
block = buf_LRU_get_free_block(0);
*lru = TRUE;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
alloc_big:
buf_buddy_block_register(block);
mutex_enter(&zip_free_mutex);
block = buf_buddy_alloc_from(block->frame, i, BUF_BUDDY_SIZES);
func_exit:
buf_buddy_stat[i].used++;
mutex_exit(&zip_free_mutex);
return(block);
}
......@@ -327,7 +341,7 @@ buf_buddy_relocate_block(
{
buf_page_t* b;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
......@@ -345,9 +359,20 @@ buf_buddy_relocate_block(
break;
}
/* optimistic */
if (!buf_page_can_relocate(bpage)) {
return(FALSE);
}
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
mutex_enter(&buf_pool_zip_mutex);
if (!buf_page_can_relocate(bpage)) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
mutex_exit(&buf_pool_zip_mutex);
return(FALSE);
}
......@@ -355,6 +380,9 @@ buf_buddy_relocate_block(
buf_relocate(bpage, dpage);
ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
/* relocate buf_pool->zip_clean */
b = UT_LIST_GET_PREV(list, dpage);
UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage);
......@@ -365,6 +393,7 @@ buf_buddy_relocate_block(
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage);
}
mutex_exit(&flush_list_mutex);
mutex_exit(&buf_pool_zip_mutex);
return(TRUE);
}
......@@ -384,7 +413,8 @@ buf_buddy_relocate(
const ulint size = BUF_BUDDY_LOW << i;
ullint usec = ut_time_us(NULL);
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&zip_free_mutex));
ut_ad(!mutex_own(&buf_pool_zip_mutex));
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
......@@ -403,9 +433,12 @@ buf_buddy_relocate(
actually is a properly initialized buf_page_t object. */
if (size >= PAGE_ZIP_MIN_SIZE) {
mutex_exit(&zip_free_mutex);
/* This is a compressed page. */
mutex_t* mutex;
mutex_enter(&page_hash_mutex);
/* The src block may be split into smaller blocks,
some of which may be free. Thus, the
mach_read_from_4() calls below may attempt to read
......@@ -426,6 +459,8 @@ buf_buddy_relocate(
added to buf_pool->page_hash yet. Obviously,
it cannot be relocated. */
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
return(FALSE);
}
......@@ -435,6 +470,8 @@ buf_buddy_relocate(
For the sake of simplicity, give up. */
ut_ad(page_zip_get_size(&bpage->zip) < size);
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
return(FALSE);
}
......@@ -445,6 +482,7 @@ buf_buddy_relocate(
mutex = buf_page_get_mutex(bpage);
mutex_enter(mutex);
mutex_exit(&page_hash_mutex);
if (buf_page_can_relocate(bpage)) {
/* Relocate the compressed page. */
......@@ -461,17 +499,23 @@ success:
buddy_stat->relocated_usec
+= ut_time_us(NULL) - usec;
}
mutex_enter(&zip_free_mutex);
return(TRUE);
}
mutex_exit(mutex);
mutex_enter(&zip_free_mutex);
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */
UNIV_MEM_ASSERT_RW(src, size);
mutex_exit(&zip_free_mutex);
if (buf_buddy_relocate_block(src, dst)) {
goto success;
}
mutex_enter(&zip_free_mutex);
}
return(FALSE);
......@@ -490,7 +534,8 @@ buf_buddy_free_low(
buf_page_t* bpage;
buf_page_t* buddy;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&zip_free_mutex));
ut_ad(!mutex_own(&buf_pool_zip_mutex));
ut_ad(i <= BUF_BUDDY_SIZES);
ut_ad(buf_buddy_stat[i].used > 0);
......
This diff is collapsed.
......@@ -45,7 +45,8 @@ buf_flush_insert_into_flush_list(
/*=============================*/
buf_page_t* bpage) /* in: block which is modified */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
<= bpage->oldest_modification));
......@@ -93,7 +94,8 @@ buf_flush_insert_sorted_into_flush_list(
buf_page_t* prev_b;
buf_page_t* b;
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_PAGE:
......@@ -188,7 +190,7 @@ buf_flush_ready_for_flush(
enum buf_flush flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
ut_a(buf_page_in_file(bpage));
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own()); /*optimistic...*/
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
if (bpage->oldest_modification != 0
......@@ -220,7 +222,8 @@ buf_flush_remove(
/*=============*/
buf_page_t* bpage) /* in: pointer to the block in question */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_flush_list);
ut_d(bpage->in_flush_list = FALSE);
......@@ -773,12 +776,14 @@ buf_flush_try_page(
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
bpage = buf_page_hash_get(space, offset);
if (!bpage) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
return(0);
}
......@@ -786,10 +791,13 @@ buf_flush_try_page(
block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex);
mutex_enter(&buf_pool_mutex);
mutex_exit(&page_hash_mutex);
if (!buf_flush_ready_for_flush(bpage, flush_type)) {
mutex_exit(block_mutex);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
return(0);
}
......@@ -818,7 +826,8 @@ buf_flush_try_page(
}
mutex_exit(block_mutex);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
if (!locked) {
buf_flush_buffered_writes();
......@@ -861,7 +870,8 @@ buf_flush_try_page(
immediately. */
mutex_exit(block_mutex);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
break;
case BUF_FLUSH_SINGLE_PAGE:
......@@ -877,8 +887,8 @@ buf_flush_try_page(
buf_pool->n_flush[flush_type]++;
mutex_exit(block_mutex);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
rw_lock_s_lock_gen(&((buf_block_t*) bpage)->lock,
BUF_IO_WRITE);
......@@ -943,7 +953,8 @@ buf_flush_try_neighbors(
high = fil_space_get_size(space);
}
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
for (i = low; i < high; i++) {
......@@ -977,7 +988,8 @@ buf_flush_try_neighbors(
flush the doublewrite buffer before we start
waiting. */
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
mutex_exit(block_mutex);
......@@ -990,14 +1002,16 @@ buf_flush_try_neighbors(
count += buf_flush_try_page(space, i,
flush_type);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
} else {
mutex_exit(block_mutex);
}
}
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
return(count);
}
......@@ -1041,20 +1055,29 @@ buf_flush_batch(
ut_ad((flush_type != BUF_FLUSH_LIST)
|| sync_thread_levels_empty_gen(TRUE));
#endif /* UNIV_SYNC_DEBUG */
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&buf_pool_mutex);
if ((buf_pool->n_flush[flush_type] > 0)
|| (buf_pool->init_flush[flush_type] == TRUE)) {
/* There is already a flush batch of the same type running */
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
return(ULINT_UNDEFINED);
}
buf_pool->init_flush[flush_type] = TRUE;
mutex_exit(&buf_pool_mutex);
if (flush_type == BUF_FLUSH_LRU) {
mutex_enter(&LRU_list_mutex);
}
mutex_enter(&flush_list_mutex);
for (;;) {
flush_next:
/* If we have flushed enough, leave the loop */
......@@ -1099,7 +1122,11 @@ flush_next:
space = buf_page_get_space(bpage);
offset = buf_page_get_page_no(bpage);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
if (flush_type == BUF_FLUSH_LRU) {
mutex_exit(&LRU_list_mutex);
}
mutex_exit(&flush_list_mutex);
mutex_exit(block_mutex);
old_page_count = page_count;
......@@ -1112,7 +1139,11 @@ flush_next:
flush_type, offset,
page_count - old_page_count); */
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
if (flush_type == BUF_FLUSH_LRU) {
mutex_enter(&LRU_list_mutex);
}
mutex_enter(&flush_list_mutex);
goto flush_next;
} else if (flush_type == BUF_FLUSH_LRU) {
......@@ -1135,6 +1166,13 @@ flush_next:
break;
}
if (flush_type == BUF_FLUSH_LRU) {
mutex_exit(&LRU_list_mutex);
}
mutex_exit(&flush_list_mutex);
mutex_enter(&buf_pool_mutex);
buf_pool->init_flush[flush_type] = FALSE;
if ((buf_pool->n_flush[flush_type] == 0)
......@@ -1145,7 +1183,8 @@ flush_next:
os_event_set(buf_pool->no_flush[flush_type]);
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
buf_flush_buffered_writes();
......@@ -1297,11 +1336,13 @@ buf_flush_validate(void)
{
ibool ret;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex);
ret = buf_flush_validate_low();
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex);
return(ret);
}
......
This diff is collapsed.
......@@ -229,18 +229,22 @@ buf_read_ahead_random(
LRU_recent_limit = buf_LRU_get_recent_limit();
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&buf_pool_mutex);
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
return(0);
}
mutex_exit(&buf_pool_mutex);
/* Count how many blocks in the area have been recently accessed,
that is, reside near the start of the LRU list. */
mutex_enter(&page_hash_mutex);
for (i = low; i < high; i++) {
const buf_page_t* bpage = buf_page_hash_get(space, i);
......@@ -252,13 +256,15 @@ buf_read_ahead_random(
if (recent_blocks >= BUF_READ_AHEAD_RANDOM_THRESHOLD) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
goto read_ahead;
}
}
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
/* Do nothing */
return(0);
......@@ -452,10 +458,12 @@ buf_read_ahead_linear(
tablespace_version = fil_space_get_version(space);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&buf_pool_mutex);
if (high > fil_space_get_size(space)) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
/* The area is not whole, return */
return(0);
......@@ -463,10 +471,12 @@ buf_read_ahead_linear(
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&buf_pool_mutex);
return(0);
}
mutex_exit(&buf_pool_mutex);
/* Check that almost all pages in the area have been accessed; if
offset == low, the accesses must be in a descending order, otherwise,
......@@ -480,6 +490,7 @@ buf_read_ahead_linear(
fail_count = 0;
mutex_enter(&page_hash_mutex);
for (i = low; i < high; i++) {
bpage = buf_page_hash_get(space, i);
......@@ -503,7 +514,8 @@ buf_read_ahead_linear(
* LINEAR_AREA_THRESHOLD_COEF) {
/* Too many failures: return */
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
return(0);
}
......@@ -514,7 +526,8 @@ buf_read_ahead_linear(
bpage = buf_page_hash_get(space, offset);
if (bpage == NULL) {
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
return(0);
}
......@@ -540,7 +553,8 @@ buf_read_ahead_linear(
pred_offset = fil_page_get_prev(frame);
succ_offset = fil_page_get_next(frame);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
if ((offset == low) && (succ_offset == offset + 1)) {
......
......@@ -2287,7 +2287,8 @@ i_s_cmpmem_fill_low(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&zip_free_mutex);
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
buf_buddy_stat_t* buddy_stat = &buf_buddy_stat[x];
......@@ -2313,7 +2314,8 @@ i_s_cmpmem_fill_low(
}
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&zip_free_mutex);
DBUG_RETURN(status);
}
......
......@@ -29,5 +29,6 @@ struct innodb_enhancement {
{"innodb_rw_lock","InnoDB RW-lock fixes","Useful for 8+ cores SMP systems","http://www.percona.com/docs/wiki/percona-xtradb:innodb_rw_lock"},
{"innodb_opt_lru_count","Fix of buffer_pool mutex","Decreases contention on buffer_pool mutex on LRU operations","http://www.percona.com/docs/wiki/percona-xtradb:innodb_opt_lru_count"},
{"innodb_buffer_pool_pages","Information of buffer pool content","","http://www.percona.com/docs/wiki/percona-xtradb:innodb_buffer_pool_pages"},
{"innodb_split_buf_pool_mutex","More fix of buffer_pool mutex","Spliting buf_pool_mutex and optimizing based on innodb_opt_lru_count","http://www.percona.com/docs/wiki/percona-xtradb:innodb_split_buf_pool_mutex"},
{NULL, NULL, NULL, NULL}
};
......@@ -86,7 +86,7 @@ buf_buddy_alloc(
and buf_pool_mutex was temporarily released,
or NULL if the LRU list should not be used */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
return(buf_buddy_alloc_low(buf_buddy_get_slot(size), lru));
}
......@@ -101,9 +101,11 @@ buf_buddy_free(
pointed to by the buffer pool */
ulint size) /* in: block size, up to UNIV_PAGE_SIZE */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
mutex_enter(&zip_free_mutex);
buf_buddy_free_low(buf, buf_buddy_get_slot(size));
mutex_exit(&zip_free_mutex);
}
#ifdef UNIV_MATERIALIZE
......
......@@ -1055,10 +1055,10 @@ struct buf_page_struct{
UT_LIST_NODE_T(buf_page_t) LRU;
/* node of the LRU list */
#ifdef UNIV_DEBUG
//#ifdef UNIV_DEBUG
ibool in_LRU_list; /* TRUE if the page is in the LRU list;
used in debugging */
#endif /* UNIV_DEBUG */
//#endif /* UNIV_DEBUG */
unsigned old:1; /* TRUE if the block is in the old
blocks in the LRU list */
unsigned LRU_position:31;/* value which monotonically decreases
......@@ -1310,6 +1310,12 @@ 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;
extern mutex_t LRU_list_mutex;
extern mutex_t flush_list_mutex;
extern mutex_t page_hash_mutex;
extern mutex_t free_list_mutex;
extern mutex_t zip_free_mutex;
extern mutex_t zip_hash_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;
......
......@@ -76,7 +76,8 @@ buf_pool_get_oldest_modification(void)
buf_page_t* bpage;
ib_uint64_t lsn;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex);
bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
......@@ -87,7 +88,8 @@ buf_pool_get_oldest_modification(void)
lsn = bpage->oldest_modification;
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex);
return(lsn);
}
......@@ -101,7 +103,8 @@ buf_pool_clock_tic(void)
/*====================*/
/* out: new clock value */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&LRU_list_mutex));
buf_pool->ulint_clock++;
......@@ -382,7 +385,7 @@ buf_page_set_io_fix(
buf_page_t* bpage, /* in/out: control block */
enum buf_io_fix io_fix) /* in: io_fix state */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
bpage->io_fix = io_fix;
......@@ -410,7 +413,7 @@ buf_page_can_relocate(
/*==================*/
const buf_page_t* bpage) /* control block being relocated */
{
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
......@@ -443,7 +446,8 @@ buf_page_set_old(
ibool old) /* in: old */
{
ut_a(buf_page_in_file(bpage));
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&LRU_list_mutex));
ut_ad(bpage->in_LRU_list);
#ifdef UNIV_LRU_DEBUG
......@@ -659,9 +663,9 @@ buf_frame_get_page_zip(
const byte* ptr) /* in: pointer to the page */
{
const page_zip_des_t* page_zip;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
page_zip = buf_block_get_page_zip(buf_block_align(ptr));
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
return(page_zip);
}
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
......@@ -726,7 +730,7 @@ buf_block_free(
/*===========*/
buf_block_t* block) /* in, own: block to be freed */
{
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&block->mutex);
......@@ -736,7 +740,7 @@ buf_block_free(
mutex_exit(&block->mutex);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
}
/*************************************************************************
......@@ -781,14 +785,17 @@ buf_page_io_query(
buf_page_t* bpage) /* in: buf_pool block, must be bufferfixed */
{
ibool io_fixed;
mutex_t* block_mutex = buf_page_get_mutex(bpage);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(block_mutex);
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->buf_fix_count > 0);
io_fixed = buf_page_get_io_fix(bpage) != BUF_IO_NONE;
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(block_mutex);
return(io_fixed);
}
......@@ -805,8 +812,10 @@ buf_page_get_newest_modification(
page frame */
{
ib_uint64_t lsn;
mutex_t* block_mutex = buf_page_get_mutex(bpage);
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(block_mutex);
if (buf_page_in_file(bpage)) {
lsn = bpage->newest_modification;
......@@ -814,7 +823,8 @@ buf_page_get_newest_modification(
lsn = 0;
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(block_mutex);
return(lsn);
}
......@@ -914,7 +924,8 @@ buf_page_hash_get(
ulint fold;
ut_ad(buf_pool);
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&page_hash_mutex));
/* Look for the page in the hash table */
......@@ -961,11 +972,13 @@ buf_page_peek(
{
const buf_page_t* bpage;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
bpage = buf_page_hash_get(space, offset);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
return(bpage != NULL);
}
......@@ -1028,9 +1041,11 @@ buf_page_release(
ut_a(block->page.buf_fix_count > 0);
if (rw_latch == RW_X_LATCH && mtr->modifications) {
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex);
buf_flush_note_modification(block, mtr);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex);
}
mutex_enter(&block->mutex);
......
......@@ -36,7 +36,8 @@ buf_flush_note_modification(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_pool_mutex_own());
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
ut_ad(mtr->start_lsn != 0);
ut_ad(mtr->modifications);
......@@ -76,7 +77,8 @@ buf_flush_recv_note_modification(
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex);
ut_ad(block->page.newest_modification <= end_lsn);
......@@ -93,5 +95,6 @@ buf_flush_recv_note_modification(
ut_ad(block->page.oldest_modification <= start_lsn);
}
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex);
}
......@@ -191,10 +191,10 @@ mlog_write_initial_log_record_fast(
#endif
#ifdef UNIV_DEBUG
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
/* We now assume that all x-latched pages have been modified! */
block = (buf_block_t*) buf_block_align(ptr);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
if (!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY)) {
......
......@@ -139,9 +139,9 @@ row_upd_rec_sys_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) {
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
ut_ad(!buf_block_align(rec)->is_hashed);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
}
#endif /* UNIV_SYNC_DEBUG */
......
......@@ -12,7 +12,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
#define INNODB_VERSION_BUGFIX 2
#define PERCONA_INNODB_VERSION 1
#define PERCONA_INNODB_VERSION 2
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
......
......@@ -314,9 +314,9 @@ mtr_memo_contains_page(
{
ibool ret;
buf_pool_mutex_enter();
//buf_pool_mutex_enter();
ret = mtr_memo_contains(mtr, buf_block_align(ptr), type);
buf_pool_mutex_exit();
//buf_pool_mutex_exit();
return(ret);
}
......
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