Commit 4ba507ef authored by Vadim Tkachenko's avatar Vadim Tkachenko

sync with rev41 extensions

parent 0a073efd
......@@ -818,10 +818,10 @@ btr_search_guess_on_hash(
ulint space_id = page_get_space_id(page);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
block = (buf_block_t*) buf_page_hash_get(space_id, page_no);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
}
if (UNIV_UNLIKELY(!block)
......@@ -1705,7 +1705,7 @@ btr_search_validate(void)
rw_lock_x_lock(&btr_search_latch);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
cell_count = hash_get_n_cells(btr_search_sys->hash_index);
......@@ -1714,12 +1714,12 @@ btr_search_validate(void)
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
......@@ -1813,12 +1813,12 @@ btr_search_validate(void)
give other queries a chance to run. */
if (i != 0) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
rw_lock_x_unlock(&btr_search_latch);
os_thread_yield();
rw_lock_x_lock(&btr_search_latch);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
......@@ -1827,7 +1827,7 @@ btr_search_validate(void)
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
rw_lock_x_unlock(&btr_search_latch);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
......
......@@ -317,7 +317,7 @@ buf_buddy_alloc_low(
mutex_exit(&LRU_list_mutex);
if (have_page_hash_mutex) {
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
block = buf_LRU_get_free_block(0);
*lru = TRUE;
......@@ -325,7 +325,7 @@ buf_buddy_alloc_low(
mutex_enter(&LRU_list_mutex);
if (have_page_hash_mutex) {
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
alloc_big:
......@@ -450,7 +450,7 @@ buf_buddy_relocate(
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
/* The src block may be split into smaller blocks,
some of which may be free. Thus, the
......@@ -476,7 +476,7 @@ buf_buddy_relocate(
mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
return(FALSE);
}
......@@ -491,7 +491,7 @@ buf_buddy_relocate(
mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
return(FALSE);
}
......@@ -528,7 +528,7 @@ success:
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
return(TRUE);
}
......@@ -536,7 +536,7 @@ success:
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
mutex_exit(mutex);
......@@ -549,7 +549,7 @@ success:
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
if (buf_buddy_relocate_block(src, dst)) {
......@@ -558,7 +558,7 @@ success:
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
goto success;
......@@ -569,7 +569,7 @@ success:
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
}
......
......@@ -238,7 +238,7 @@ read-write lock in them */
UNIV_INTERN mutex_t buf_pool_mutex;
UNIV_INTERN mutex_t LRU_list_mutex;
UNIV_INTERN mutex_t flush_list_mutex;
UNIV_INTERN mutex_t page_hash_mutex;
UNIV_INTERN rw_lock_t page_hash_latch;
UNIV_INTERN mutex_t free_list_mutex;
UNIV_INTERN mutex_t zip_free_mutex;
UNIV_INTERN mutex_t zip_hash_mutex;
......@@ -937,7 +937,7 @@ buf_pool_init(void)
mutex_create(&buf_pool_mutex, SYNC_BUF_POOL);
mutex_create(&LRU_list_mutex, SYNC_NO_ORDER_CHECK);
mutex_create(&flush_list_mutex, SYNC_NO_ORDER_CHECK);
mutex_create(&page_hash_mutex, SYNC_NO_ORDER_CHECK);
rw_lock_create(&page_hash_latch, SYNC_NO_ORDER_CHECK);
mutex_create(&free_list_mutex, SYNC_NO_ORDER_CHECK);
mutex_create(&zip_free_mutex, SYNC_NO_ORDER_CHECK);
mutex_create(&zip_hash_mutex, SYNC_NO_ORDER_CHECK);
......@@ -946,7 +946,7 @@ buf_pool_init(void)
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
buf_pool_mutex_enter();
buf_pool->n_chunks = 1;
......@@ -985,7 +985,7 @@ buf_pool_init(void)
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_pool_mutex_exit();
btr_search_sys_create(buf_pool->curr_size
......@@ -1038,7 +1038,9 @@ buf_relocate(
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&LRU_list_mutex));
ut_ad(mutex_own(&page_hash_mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
......@@ -1271,7 +1273,7 @@ buf_pool_page_hash_rebuild(void)
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
/* Free, create, and populate the hash table. */
......@@ -1355,7 +1357,7 @@ buf_pool_page_hash_rebuild(void)
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
/************************************************************************
......@@ -1480,7 +1482,7 @@ buf_reset_check_index_page_at_flush(
buf_block_t* block;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
block = (buf_block_t*) buf_page_hash_get(space, offset);
......@@ -1489,7 +1491,7 @@ buf_reset_check_index_page_at_flush(
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
}
/************************************************************************
......@@ -1509,7 +1511,7 @@ buf_page_peek_if_search_hashed(
ibool is_hashed;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
block = (buf_block_t*) buf_page_hash_get(space, offset);
......@@ -1520,7 +1522,7 @@ buf_page_peek_if_search_hashed(
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(is_hashed);
}
......@@ -1543,7 +1545,7 @@ buf_page_set_file_page_was_freed(
buf_page_t* bpage;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
bpage = buf_page_hash_get(space, offset);
......@@ -1552,7 +1554,7 @@ buf_page_set_file_page_was_freed(
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(bpage);
}
......@@ -1574,7 +1576,7 @@ buf_page_reset_file_page_was_freed(
buf_page_t* bpage;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
bpage = buf_page_hash_get(space, offset);
......@@ -1583,7 +1585,7 @@ buf_page_reset_file_page_was_freed(
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(bpage);
}
......@@ -1617,7 +1619,7 @@ buf_page_get_zip(
for (;;) {
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
lookup:
bpage = buf_page_hash_get(space, offset);
if (bpage) {
......@@ -1627,7 +1629,7 @@ lookup:
/* Page not in buf_pool: needs to be read from file */
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
buf_read_page(space, zip_size, offset);
......@@ -1639,14 +1641,14 @@ lookup:
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(NULL);
}
block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_NOT_USED:
......@@ -1908,13 +1910,13 @@ loop:
}
if (block == NULL) {
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
block = (buf_block_t*) buf_page_hash_get(space, offset);
if (block) {
block_mutex = buf_page_get_mutex((buf_page_t*)block);
mutex_enter(block_mutex);
}
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
}
loop2:
......@@ -1991,7 +1993,7 @@ wait_until_unfixed:
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
mutex_enter(block_mutex);
{
......@@ -2011,7 +2013,7 @@ wait_until_unfixed:
block_mutex = buf_page_get_mutex((buf_page_t*)block);
mutex_enter(block_mutex);
}
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
goto loop2;
......@@ -2030,7 +2032,7 @@ wait_until_unfixed:
buf_LRU_block_free_non_file_page(block, TRUE);
//mutex_exit(&block->mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
goto wait_until_unfixed;
......@@ -2043,7 +2045,7 @@ wait_until_unfixed:
buf_relocate(bpage, &block->page);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
......@@ -2459,18 +2461,18 @@ buf_page_try_get_func(
ulint fix_type;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
block = buf_block_hash_get(space_id, page_no);
if (!block) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(NULL);
}
mutex_enter(&block->mutex);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
......@@ -2586,7 +2588,9 @@ buf_page_init(
buf_page_t* hash_page;
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&page_hash_mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(&(block->mutex)));
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
......@@ -2620,7 +2624,7 @@ buf_page_init(
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_print();
buf_LRU_print();
buf_validate();
......@@ -2703,7 +2707,7 @@ buf_page_init_for_read(
if(!block) {
mutex_enter(&flush_list_mutex);
}
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
if (buf_page_hash_get(space, offset)) {
/* The page is already in the buffer pool. */
......@@ -2711,7 +2715,7 @@ err_exit:
if (block) {
mutex_enter(&block->mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_LRU_block_free_non_file_page(block, FALSE);
mutex_exit(&block->mutex);
}
......@@ -2720,7 +2724,7 @@ err_exit2:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
......@@ -2745,7 +2749,7 @@ err_exit2:
mutex_enter(&block->mutex);
buf_page_init(space, offset, block);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
......@@ -2838,7 +2842,7 @@ err_exit2:
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
buf_page_address_fold(space, offset), bpage);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
......@@ -2893,7 +2897,7 @@ buf_page_create(
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
block = (buf_block_t*) buf_page_hash_get(space, offset);
......@@ -2908,7 +2912,7 @@ buf_page_create(
/* Page can be found in buf_pool */
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_block_free(free_block);
......@@ -2930,7 +2934,7 @@ buf_page_create(
mutex_enter(&block->mutex);
buf_page_init(space, offset, block);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
/* The block must be put to the LRU list */
buf_LRU_add_block(&block->page, FALSE);
......@@ -3297,7 +3301,7 @@ buf_validate(void)
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
/* for keep the new latch order, it cannot validate correctly... */
chunk = buf_pool->chunks;
......@@ -3497,7 +3501,7 @@ buf_validate(void)
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
ut_a(buf_LRU_validate());
ut_a(buf_flush_validate());
......
......@@ -777,13 +777,13 @@ buf_flush_try_page(
|| flush_type == BUF_FLUSH_SINGLE_PAGE);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
bpage = buf_page_hash_get(space, offset);
if (!bpage) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(0);
}
......@@ -792,7 +792,7 @@ buf_flush_try_page(
mutex_enter(block_mutex);
mutex_enter(&buf_pool_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
if (!buf_flush_ready_for_flush(bpage, flush_type)) {
mutex_exit(block_mutex);
......@@ -954,7 +954,7 @@ buf_flush_try_neighbors(
}
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
for (i = low; i < high; i++) {
......@@ -989,7 +989,7 @@ buf_flush_try_neighbors(
waiting. */
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
mutex_exit(block_mutex);
......@@ -1003,7 +1003,7 @@ buf_flush_try_neighbors(
flush_type);
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
} else {
mutex_exit(block_mutex);
}
......@@ -1011,7 +1011,7 @@ buf_flush_try_neighbors(
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(count);
}
......
......@@ -330,7 +330,7 @@ scan_again:
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
all_freed = TRUE;
......@@ -374,7 +374,7 @@ scan_again:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
mutex_exit(block_mutex);
/* Note that the following call will acquire
......@@ -416,7 +416,7 @@ next_page:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
if (!all_freed) {
os_thread_sleep(20000);
......@@ -1447,7 +1447,7 @@ alloc:
if (!have_LRU_mutex)
mutex_enter(&LRU_list_mutex); /* optimistic */
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
mutex_enter(block_mutex);
/* recheck states of block */
......@@ -1460,7 +1460,7 @@ not_freed:
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
return(BUF_LRU_NOT_FREED);
} else if (zip || !bpage->zip.data) {
if (bpage->oldest_modification)
......@@ -1607,7 +1607,7 @@ not_freed:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
mutex_exit(block_mutex);
/* Remove possible adaptive hash index on the page.
......@@ -1658,9 +1658,7 @@ not_freed:
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
/* It may be bug of 1.0.2 */
rw_lock_x_unlock(&page_hash_latch);
}
return(BUF_LRU_FREED);
......@@ -1751,7 +1749,9 @@ buf_LRU_block_remove_hashed_page(
ut_ad(bpage);
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&LRU_list_mutex));
ut_ad(mutex_own(&page_hash_mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX));
#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
......@@ -1854,7 +1854,7 @@ buf_LRU_block_remove_hashed_page(
mutex_exit(buf_page_get_mutex(bpage));
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
buf_print();
buf_LRU_print();
buf_validate();
......
......@@ -245,7 +245,7 @@ buf_read_ahead_random(
/* 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);
rw_lock_s_lock(&page_hash_latch);
for (i = low; i < high; i++) {
const buf_page_t* bpage = buf_page_hash_get(space, i);
......@@ -258,14 +258,14 @@ buf_read_ahead_random(
if (recent_blocks >= BUF_READ_AHEAD_RANDOM_THRESHOLD) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
goto read_ahead;
}
}
}
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
/* Do nothing */
return(0);
......@@ -491,7 +491,7 @@ buf_read_ahead_linear(
fail_count = 0;
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
for (i = low; i < high; i++) {
bpage = buf_page_hash_get(space, i);
......@@ -516,7 +516,7 @@ buf_read_ahead_linear(
/* Too many failures: return */
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(0);
}
......@@ -528,7 +528,7 @@ buf_read_ahead_linear(
if (bpage == NULL) {
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(0);
}
......@@ -555,7 +555,7 @@ buf_read_ahead_linear(
succ_offset = fil_page_get_next(frame);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
if ((offset == low) && (succ_offset == offset + 1)) {
......
......@@ -110,7 +110,7 @@ buf_buddy_free(
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
rw_lock_x_lock(&page_hash_latch);
}
mutex_enter(&zip_free_mutex);
......@@ -120,7 +120,7 @@ buf_buddy_free(
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
rw_lock_x_unlock(&page_hash_latch);
}
}
......
......@@ -1312,7 +1312,7 @@ 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 rw_lock_t page_hash_latch;
extern mutex_t free_list_mutex;
extern mutex_t zip_free_mutex;
extern mutex_t zip_hash_mutex;
......
......@@ -665,10 +665,10 @@ buf_frame_get_page_zip(
{
const page_zip_des_t* page_zip;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
page_zip = buf_block_get_page_zip(buf_block_align(ptr));
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(page_zip);
}
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
......@@ -928,7 +928,10 @@ buf_page_hash_get(
ut_ad(buf_pool);
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&page_hash_mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&page_hash_latch, RW_LOCK_EX)
|| rw_lock_own(&page_hash_latch, RW_LOCK_SHARED));
#endif
/* Look for the page in the hash table */
......@@ -976,12 +979,12 @@ buf_page_peek(
const buf_page_t* bpage;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
bpage = buf_page_hash_get(space, offset);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
return(bpage != NULL);
}
......
......@@ -192,11 +192,11 @@ mlog_write_initial_log_record_fast(
#ifdef UNIV_DEBUG
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
/* We now assume that all x-latched pages have been modified! */
block = (buf_block_t*) buf_block_align(ptr);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
if (!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY)) {
......
......@@ -140,10 +140,10 @@ row_upd_rec_sys_fields(
#ifdef UNIV_SYNC_DEBUG
if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) {
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
ut_ad(!buf_block_align(rec)->is_hashed);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
}
#endif /* UNIV_SYNC_DEBUG */
......
......@@ -425,6 +425,12 @@ rw_lock_debug_print(
#ifdef HAVE_GCC_ATOMIC_BUILTINS
/* This value means NOT_LOCKED */
#define RW_LOCK_BIAS 0x00100000
#else
#error HAVE_GCC_ATOMIC_BUILTINS is not defined. Do you use enough new GCC or compatibles?
#error Or do you use exact options for CFLAGS?
#error e.g. (for x86_32): "-m32 -march=i586 -mtune=i686"
#error e.g. (for Sparc_64): "-m64 -mcpu=v9"
#error Otherwise, this build may be slower than normal version.
#endif
/* NOTE! The structure appears here only for the compiler to know its size.
......
......@@ -315,10 +315,10 @@ mtr_memo_contains_page(
ibool ret;
//buf_pool_mutex_enter();
mutex_enter(&page_hash_mutex);
rw_lock_s_lock(&page_hash_latch);
ret = mtr_memo_contains(mtr, buf_block_align(ptr), type);
//buf_pool_mutex_exit();
mutex_exit(&page_hash_mutex);
rw_lock_s_unlock(&page_hash_latch);
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