MDEV-10813: Update buf_page_t::buf_fix_count outside mutex

Since MySQL 5.6.16 (and MariaDB Server 10.0.11), changes of
buf_page_t::buf_fix_count are atomic memory operations if
PAGE_ATOMIC_REF_COUNT is defined. Since MySQL 5.7
(and MariaDB Server 10.2.2), the field is always updated
by atomic memory operations.

In a few occurrences, updates of the counter were unnecessarily
surrounded by an acquisition and release of the block mutex
(buf_block_t::mutex or buf_pool_t::zip_mutex). Remove these
unnecessary mutex operations.
This commit is contained in:
Marko Mäkelä 2019-02-22 16:21:03 +02:00
parent 945c748adc
commit 2c8d9a4e59
3 changed files with 0 additions and 22 deletions

View file

@ -463,11 +463,7 @@ btr_cur_optimistic_latch_leaves(
file, line, mtr)) {
if (btr_page_get_prev(buf_block_get_frame(block), mtr)
== left_page_no) {
/* adjust buf_fix_count */
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
*latch_mode = mode;
return(true);
} else {
@ -483,10 +479,7 @@ btr_cur_optimistic_latch_leaves(
}
unpin_failed:
/* unpin the block */
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
return(false);
default:

View file

@ -4915,10 +4915,7 @@ buf_page_optimistic_get(
}
if (!success) {
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
return(FALSE);
}
@ -4932,10 +4929,7 @@ buf_page_optimistic_get(
rw_lock_x_unlock(&block->lock);
}
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
return(FALSE);
}
@ -5040,10 +5034,7 @@ buf_page_get_known_nowait(
}
if (!success) {
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
return(FALSE);
}
@ -5137,10 +5128,7 @@ buf_page_try_get_func(
}
if (!success) {
buf_page_mutex_enter(block);
buf_block_buf_fix_dec(block);
buf_page_mutex_exit(block);
return(NULL);
}

View file

@ -1374,11 +1374,8 @@ fsp_page_create(
} else {
rw_lock_sx_lock(&block->lock);
}
mutex_enter(&block->mutex);
buf_block_buf_fix_inc(block, __FILE__, __LINE__);
mutex_exit(&block->mutex);
mtr_memo_push(init_mtr, block, rw_latch == RW_X_LATCH
? MTR_MEMO_PAGE_X_FIX : MTR_MEMO_PAGE_SX_FIX);