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 @@ buf_buddy_relocate(
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 @@ buf_buddy_relocate(
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 @@ 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);
}
if (buf_buddy_relocate_block(src, dst)) {
......@@ -558,7 +558,7 @@ buf_buddy_relocate(
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 @@ buf_buddy_relocate(
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);
}
}
......
This diff is collapsed.
......@@ -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 @@ buf_LRU_invalidate_tablespace(
//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 @@ buf_LRU_invalidate_tablespace(
//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 @@ buf_LRU_invalidate_tablespace(
//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 @@ buf_LRU_free_block(
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 @@ buf_LRU_free_block(
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 @@ buf_LRU_free_block(
//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 @@ buf_LRU_free_block(
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