mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
BUG#59392, removed thread local storage use in MySQL Threads by storing ibuf_inside indicator in MTR object instead
This commit is contained in:
parent
6e7752d557
commit
7dae4282d4
14 changed files with 75 additions and 128 deletions
|
@ -33,10 +33,17 @@ MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
|
|||
int allocate_lex_string);
|
||||
#include <mysql/service_thd_wait.h>
|
||||
typedef enum _thd_wait_type_e {
|
||||
THD_WAIT_MUTEX= 1,
|
||||
THD_WAIT_SLEEP= 1,
|
||||
THD_WAIT_DISKIO= 2,
|
||||
THD_WAIT_ROW_TABLE_LOCK= 3,
|
||||
THD_WAIT_GLOBAL_LOCK= 4
|
||||
THD_WAIT_ROW_LOCK= 3,
|
||||
THD_WAIT_GLOBAL_LOCK= 4,
|
||||
THD_WAIT_META_DATA_LOCK= 5,
|
||||
THD_WAIT_TABLE_LOCK= 6,
|
||||
THD_WAIT_USER_LOCK= 7,
|
||||
THD_WAIT_BINLOG= 8,
|
||||
THD_WAIT_GROUP_COMMIT= 9,
|
||||
THD_WAIT_SYNC= 10,
|
||||
THD_WAIT_LAST= 11
|
||||
} thd_wait_type;
|
||||
extern struct thd_wait_service_st {
|
||||
void (*thd_wait_begin_func)(void*, thd_wait_type);
|
||||
|
|
|
@ -390,7 +390,7 @@ btr_cur_search_to_nth_level(
|
|||
|
||||
ut_ad(level == 0 || mode == PAGE_CUR_LE);
|
||||
ut_ad(dict_index_check_search_tuple(index, tuple));
|
||||
ut_ad(!dict_index_is_ibuf(index) || ibuf_inside());
|
||||
ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr));
|
||||
ut_ad(dtuple_check_typed(tuple));
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
|
|
|
@ -2314,9 +2314,6 @@ buf_page_get_zip(
|
|||
unsigned access_time;
|
||||
buf_pool_t* buf_pool = buf_pool_get(space, offset);
|
||||
|
||||
#ifndef UNIV_LOG_DEBUG
|
||||
ut_ad(!ibuf_inside());
|
||||
#endif
|
||||
buf_pool->stat.n_page_gets++;
|
||||
|
||||
for (;;) {
|
||||
|
@ -2745,7 +2742,7 @@ buf_page_get_gen(
|
|||
ut_ad(zip_size == fil_space_get_zip_size(space));
|
||||
ut_ad(ut_is_2pow(zip_size));
|
||||
#ifndef UNIV_LOG_DEBUG
|
||||
ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
|
||||
ut_ad(!ibuf_inside(mtr) || ibuf_page(space, zip_size, offset, NULL));
|
||||
#endif
|
||||
buf_pool->stat.n_page_gets++;
|
||||
fold = buf_page_address_fold(space, offset);
|
||||
|
@ -3114,7 +3111,7 @@ wait_until_unfixed:
|
|||
/* In the case of a first access, try to apply linear
|
||||
read-ahead */
|
||||
|
||||
buf_read_ahead_linear(space, zip_size, offset);
|
||||
buf_read_ahead_linear(space, zip_size, offset, mtr);
|
||||
}
|
||||
|
||||
#ifdef UNIV_IBUF_COUNT_DEBUG
|
||||
|
@ -3171,7 +3168,7 @@ buf_page_optimistic_get(
|
|||
access_time = buf_page_is_accessed(&block->page);
|
||||
buf_page_set_accessed_make_young(&block->page, access_time);
|
||||
|
||||
ut_ad(!ibuf_inside()
|
||||
ut_ad(!ibuf_inside(mtr)
|
||||
|| ibuf_page(buf_block_get_space(block),
|
||||
buf_block_get_zip_size(block),
|
||||
buf_block_get_page_no(block), NULL));
|
||||
|
@ -3227,7 +3224,8 @@ buf_page_optimistic_get(
|
|||
|
||||
buf_read_ahead_linear(buf_block_get_space(block),
|
||||
buf_block_get_zip_size(block),
|
||||
buf_block_get_page_no(block));
|
||||
buf_block_get_page_no(block),
|
||||
mtr);
|
||||
}
|
||||
|
||||
#ifdef UNIV_IBUF_COUNT_DEBUG
|
||||
|
@ -3303,7 +3301,7 @@ buf_page_get_known_nowait(
|
|||
buf_pool_mutex_exit(buf_pool);
|
||||
}
|
||||
|
||||
ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD));
|
||||
ut_ad(!ibuf_inside(mtr) || (mode == BUF_KEEP_OLD));
|
||||
|
||||
if (rw_latch == RW_S_LATCH) {
|
||||
success = rw_lock_s_lock_nowait(&(block->lock),
|
||||
|
@ -3568,9 +3566,9 @@ buf_page_init_for_read(
|
|||
/* It is a read-ahead within an ibuf routine */
|
||||
|
||||
ut_ad(!ibuf_bitmap_page(zip_size, offset));
|
||||
ut_ad(ibuf_inside());
|
||||
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
if (!recv_no_ibuf_operations
|
||||
&& !ibuf_page(space, zip_size, offset, &mtr)) {
|
||||
|
|
|
@ -238,8 +238,10 @@ buf_read_ahead_linear(
|
|||
/*==================*/
|
||||
ulint space, /*!< in: space id */
|
||||
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
|
||||
ulint offset) /*!< in: page number of a page; NOTE: the current thread
|
||||
ulint offset, /*!< in: page number of a page; NOTE: the current thread
|
||||
must want access to this page (see NOTE 3 above) */
|
||||
mtr_t *mtr) /*!< in: mtr with knowledge if we're inside ibuf
|
||||
routine */
|
||||
{
|
||||
buf_pool_t* buf_pool = buf_pool_get(space, offset);
|
||||
ib_int64_t tablespace_version;
|
||||
|
@ -429,7 +431,7 @@ buf_read_ahead_linear(
|
|||
|
||||
/* If we got this far, read-ahead can be sensible: do it */
|
||||
|
||||
if (ibuf_inside()) {
|
||||
if (ibuf_inside(mtr)) {
|
||||
ibuf_mode = BUF_READ_IBUF_PAGES_ONLY;
|
||||
} else {
|
||||
ibuf_mode = BUF_READ_ANY_PAGE;
|
||||
|
@ -520,7 +522,6 @@ buf_read_ibuf_merge_pages(
|
|||
{
|
||||
ulint i;
|
||||
|
||||
ut_ad(!ibuf_inside());
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a(n_stored < UNIV_PAGE_SIZE);
|
||||
#endif
|
||||
|
|
|
@ -4314,8 +4314,6 @@ fil_io(
|
|||
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|
||||
|| !ibuf_bitmap_page(zip_size, block_offset)
|
||||
|| sync || is_log);
|
||||
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|
||||
|| ibuf_page(space_id, zip_size, block_offset, NULL));
|
||||
# endif /* UNIV_LOG_DEBUG */
|
||||
if (sync) {
|
||||
mode = OS_AIO_SYNC;
|
||||
|
|
|
@ -3006,7 +3006,6 @@ innobase_close_connection(
|
|||
|
||||
innobase_rollback_trx(trx);
|
||||
|
||||
thr_local_free(trx->mysql_thread_id);
|
||||
trx_free_for_mysql(trx);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -324,37 +324,27 @@ still physically like the index page even if the index would have been
|
|||
dropped! So, there seems to be no problem. */
|
||||
|
||||
/******************************************************************//**
|
||||
Sets the flag in the current OS thread local storage denoting that it is
|
||||
Sets the flag in the current mini-transaction record indicating we're
|
||||
inside an insert buffer routine. */
|
||||
UNIV_INLINE
|
||||
UNIV_INTERN
|
||||
void
|
||||
ibuf_enter(void)
|
||||
ibuf_enter(
|
||||
mtr_t *mtr) /*!< in: mtr stores ibuf_inside info */
|
||||
/*============*/
|
||||
{
|
||||
ibool* ptr;
|
||||
|
||||
ptr = thr_local_get_in_ibuf_field();
|
||||
|
||||
ut_ad(*ptr == FALSE);
|
||||
|
||||
*ptr = TRUE;
|
||||
mtr->ibuf_inside = TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Sets the flag in the current OS thread local storage denoting that it is
|
||||
Sets the flag in the current mini-transaction record indicating we're
|
||||
exiting an insert buffer routine. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
ibuf_exit(void)
|
||||
ibuf_exit(
|
||||
mtr_t *mtr) /*!< in: mtr stores ibuf_inside info */
|
||||
/*===========*/
|
||||
{
|
||||
ibool* ptr;
|
||||
|
||||
ptr = thr_local_get_in_ibuf_field();
|
||||
|
||||
ut_ad(*ptr == TRUE);
|
||||
|
||||
*ptr = FALSE;
|
||||
mtr->ibuf_inside = FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
@ -366,10 +356,11 @@ that are executing an insert buffer routine.
|
|||
@return TRUE if inside an insert buffer routine */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
ibuf_inside(void)
|
||||
ibuf_inside(
|
||||
mtr_t *mtr) /*!< in: mtr stores ibuf_inside info */
|
||||
/*=============*/
|
||||
{
|
||||
return(*thr_local_get_in_ibuf_field());
|
||||
return(mtr->ibuf_inside);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
@ -383,7 +374,7 @@ ibuf_header_page_get(
|
|||
{
|
||||
buf_block_t* block;
|
||||
|
||||
ut_ad(!ibuf_inside());
|
||||
ut_ad(!ibuf_inside(mtr));
|
||||
|
||||
block = buf_page_get(
|
||||
IBUF_SPACE_ID, 0, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
|
||||
|
@ -404,7 +395,7 @@ ibuf_tree_root_get(
|
|||
buf_block_t* block;
|
||||
page_t* root;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(mutex_own(&ibuf_mutex));
|
||||
|
||||
mtr_x_lock(dict_index_get_lock(ibuf->index), mtr);
|
||||
|
@ -547,7 +538,7 @@ ibuf_init_at_db_start(void)
|
|||
|
||||
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
|
||||
&n_used, &mtr);
|
||||
ibuf_enter();
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
ut_ad(n_used >= 2);
|
||||
|
||||
|
@ -570,8 +561,6 @@ ibuf_init_at_db_start(void)
|
|||
ibuf->empty = (page_get_n_recs(root) == 0);
|
||||
mtr_commit(&mtr);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
heap = mem_heap_create(450);
|
||||
|
||||
/* Use old-style record format for the insert buffer. */
|
||||
|
@ -1164,7 +1153,6 @@ ibuf_rec_get_page_no(
|
|||
const byte* field;
|
||||
ulint len;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(rec_get_n_fields_old(rec) > 2);
|
||||
|
||||
field = rec_get_nth_field_old(rec, 1, &len);
|
||||
|
@ -1199,7 +1187,6 @@ ibuf_rec_get_space(
|
|||
const byte* field;
|
||||
ulint len;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(rec_get_n_fields_old(rec) > 2);
|
||||
|
||||
field = rec_get_nth_field_old(rec, 1, &len);
|
||||
|
@ -1244,7 +1231,6 @@ ibuf_rec_get_info(
|
|||
ulint info_len_local;
|
||||
ulint counter_local;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
fields = rec_get_n_fields_old(rec);
|
||||
ut_a(fields > 4);
|
||||
|
||||
|
@ -1304,7 +1290,6 @@ ibuf_rec_get_op_type(
|
|||
{
|
||||
ulint len;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(rec_get_n_fields_old(rec) > 2);
|
||||
|
||||
(void) rec_get_nth_field_old(rec, 1, &len);
|
||||
|
@ -1677,7 +1662,6 @@ ibuf_rec_get_volume(
|
|||
ibool pre_4_1;
|
||||
ulint comp;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(rec_get_n_fields_old(ibuf_rec) > 2);
|
||||
|
||||
data = rec_get_nth_field_old(ibuf_rec, 1, &len);
|
||||
|
@ -2094,7 +2078,7 @@ ibuf_add_free_page(void)
|
|||
page = buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
ibuf_enter();
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
mutex_enter(&ibuf_mutex);
|
||||
|
||||
|
@ -2124,8 +2108,6 @@ ibuf_add_free_page(void)
|
|||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
@ -2156,7 +2138,7 @@ ibuf_remove_free_page(void)
|
|||
header_page = ibuf_header_page_get(&mtr);
|
||||
|
||||
/* Prevent pessimistic inserts to insert buffer trees for a while */
|
||||
ibuf_enter();
|
||||
ibuf_enter(&mtr);
|
||||
mutex_enter(&ibuf_pessimistic_insert_mutex);
|
||||
mutex_enter(&ibuf_mutex);
|
||||
|
||||
|
@ -2165,14 +2147,14 @@ ibuf_remove_free_page(void)
|
|||
mutex_exit(&ibuf_mutex);
|
||||
mutex_exit(&ibuf_pessimistic_insert_mutex);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ibuf_exit(&mtr);
|
||||
mtr_start(&mtr2);
|
||||
ibuf_enter(&mtr2);
|
||||
|
||||
root = ibuf_tree_root_get(&mtr2);
|
||||
|
||||
|
@ -2187,8 +2169,6 @@ ibuf_remove_free_page(void)
|
|||
|
||||
mtr_commit(&mtr2);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
/* Since pessimistic inserts were prevented, we know that the
|
||||
page is still in the free list. NOTE that also deletes may take
|
||||
pages from the free list, but they take them from the start, and
|
||||
|
@ -2202,7 +2182,7 @@ ibuf_remove_free_page(void)
|
|||
buf_page_reset_file_page_was_freed(IBUF_SPACE_ID, page_no);
|
||||
#endif
|
||||
|
||||
ibuf_enter();
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
mutex_enter(&ibuf_mutex);
|
||||
|
||||
|
@ -2248,8 +2228,6 @@ ibuf_remove_free_page(void)
|
|||
buf_page_set_file_page_was_freed(IBUF_SPACE_ID, page_no);
|
||||
#endif
|
||||
mtr_commit(&mtr);
|
||||
|
||||
ibuf_exit();
|
||||
}
|
||||
|
||||
/***********************************************************************//**
|
||||
|
@ -2271,8 +2249,6 @@ ibuf_free_excess_pages(void)
|
|||
ut_ad(rw_lock_get_x_lock_count(
|
||||
fil_space_get_latch(IBUF_SPACE_ID, NULL)) == 1);
|
||||
|
||||
ut_ad(!ibuf_inside());
|
||||
|
||||
/* NOTE: We require that the thread did not own the latch before,
|
||||
because then we know that we can obey the correct latching order
|
||||
for ibuf latches */
|
||||
|
@ -2498,7 +2474,6 @@ ibuf_contract_ext(
|
|||
mtr_t mtr;
|
||||
|
||||
*n_pages = 0;
|
||||
ut_ad(!ibuf_inside());
|
||||
|
||||
/* We perform a dirty read of ibuf->empty, without latching
|
||||
the insert buffer root page. We trust this dirty read except
|
||||
|
@ -2529,7 +2504,7 @@ ibuf_is_empty:
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
ibuf_enter();
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
/* Open a cursor to a randomly chosen leaf of the tree, at a random
|
||||
position within the leaf */
|
||||
|
@ -2548,8 +2523,6 @@ ibuf_is_empty:
|
|||
ut_ad(page_get_page_no(btr_pcur_get_page(&pcur))
|
||||
== FSP_IBUF_TREE_ROOT_PAGE_NO);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
mtr_commit(&mtr);
|
||||
btr_pcur_close(&pcur);
|
||||
|
||||
|
@ -2563,8 +2536,6 @@ ibuf_is_empty:
|
|||
fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
|
||||
sync, *n_pages, sum_sizes);
|
||||
#endif
|
||||
ibuf_exit();
|
||||
|
||||
mtr_commit(&mtr);
|
||||
btr_pcur_close(&pcur);
|
||||
|
||||
|
@ -2725,7 +2696,6 @@ ibuf_get_volume_buffered_count(
|
|||
const byte* types;
|
||||
ulint n_fields = rec_get_n_fields_old(rec);
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(n_fields > 4);
|
||||
n_fields -= 4;
|
||||
|
||||
|
@ -3039,9 +3009,8 @@ ibuf_update_max_tablespace_id(void)
|
|||
|
||||
ut_a(!dict_table_is_comp(ibuf->index->table));
|
||||
|
||||
ibuf_enter();
|
||||
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
btr_pcur_open_at_index_side(
|
||||
FALSE, ibuf->index, BTR_SEARCH_LEAF, &pcur, TRUE, &mtr);
|
||||
|
@ -3065,7 +3034,6 @@ ibuf_update_max_tablespace_id(void)
|
|||
}
|
||||
|
||||
mtr_commit(&mtr);
|
||||
ibuf_exit();
|
||||
|
||||
/* printf("Maximum space id in insert buffer %lu\n", max_space_id); */
|
||||
|
||||
|
@ -3089,7 +3057,6 @@ ibuf_get_entry_counter_low(
|
|||
const byte* field;
|
||||
ulint len;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(rec_get_n_fields_old(rec) > 2);
|
||||
|
||||
field = rec_get_nth_field_old(rec, 1, &len);
|
||||
|
@ -3374,7 +3341,6 @@ ibuf_insert_low(
|
|||
|
||||
if (mode == BTR_MODIFY_TREE) {
|
||||
for (;;) {
|
||||
ibuf_enter();
|
||||
mutex_enter(&ibuf_pessimistic_insert_mutex);
|
||||
mutex_enter(&ibuf_mutex);
|
||||
|
||||
|
@ -3385,7 +3351,6 @@ ibuf_insert_low(
|
|||
|
||||
mutex_exit(&ibuf_mutex);
|
||||
mutex_exit(&ibuf_pessimistic_insert_mutex);
|
||||
ibuf_exit();
|
||||
|
||||
if (UNIV_UNLIKELY(!ibuf_add_free_page())) {
|
||||
|
||||
|
@ -3393,11 +3358,12 @@ ibuf_insert_low(
|
|||
return(DB_STRONG_FAIL);
|
||||
}
|
||||
}
|
||||
mtr_start(&mtr);
|
||||
} else {
|
||||
ibuf_enter();
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
}
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
btr_pcur_open(ibuf->index, ibuf_entry, PAGE_CUR_LE, mode, &pcur, &mtr);
|
||||
ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf->index));
|
||||
|
@ -3453,6 +3419,7 @@ fail_exit:
|
|||
ut_a((buffered == 0) || ibuf_count_get(space, page_no));
|
||||
#endif
|
||||
mtr_start(&bitmap_mtr);
|
||||
bitmap_mtr.ibuf_inside = mtr.ibuf_inside;
|
||||
|
||||
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
|
||||
zip_size, &bitmap_mtr);
|
||||
|
@ -3579,7 +3546,6 @@ func_exit:
|
|||
|
||||
mtr_commit(&mtr);
|
||||
btr_pcur_close(&pcur);
|
||||
ibuf_exit();
|
||||
|
||||
mem_heap_free(heap);
|
||||
|
||||
|
@ -3837,7 +3803,7 @@ ibuf_insert_to_index_page(
|
|||
page_t* page = buf_block_get_frame(block);
|
||||
rec_t* rec;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(dtuple_check_typed(entry));
|
||||
ut_ad(!buf_block_align(page)->is_hashed);
|
||||
|
||||
|
@ -3984,7 +3950,7 @@ ibuf_set_del_mark(
|
|||
page_cur_t page_cur;
|
||||
ulint low_match;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(dtuple_check_typed(entry));
|
||||
|
||||
low_match = page_cur_search(
|
||||
|
@ -4041,7 +4007,7 @@ ibuf_delete(
|
|||
page_cur_t page_cur;
|
||||
ulint low_match;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(dtuple_check_typed(entry));
|
||||
|
||||
low_match = page_cur_search(
|
||||
|
@ -4183,7 +4149,7 @@ ibuf_delete_rec(
|
|||
page_t* root;
|
||||
ulint err;
|
||||
|
||||
ut_ad(ibuf_inside());
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur)));
|
||||
ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
|
||||
ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
|
||||
|
@ -4373,8 +4339,6 @@ ibuf_merge_or_delete_for_page(
|
|||
return;
|
||||
}
|
||||
|
||||
ibuf_enter();
|
||||
|
||||
heap = mem_heap_create(512);
|
||||
|
||||
if (!trx_sys_multiple_tablespace_format) {
|
||||
|
@ -4405,6 +4369,7 @@ ibuf_merge_or_delete_for_page(
|
|||
ut_print_timestamp(stderr);
|
||||
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
|
||||
stderr);
|
||||
|
@ -4445,6 +4410,7 @@ ibuf_merge_or_delete_for_page(
|
|||
|
||||
loop:
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
if (block) {
|
||||
ibool success;
|
||||
|
@ -4551,6 +4517,7 @@ loop:
|
|||
btr_pcur_commit_specify_mtr(&pcur, &mtr);
|
||||
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
success = buf_page_get_known_nowait(
|
||||
RW_X_LATCH, block,
|
||||
|
@ -4649,8 +4616,6 @@ reset_bit:
|
|||
fil_decr_pending_ibuf_merges(space);
|
||||
}
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
#ifdef UNIV_IBUF_COUNT_DEBUG
|
||||
ut_a(ibuf_count_get(space, page_no) == 0);
|
||||
#endif
|
||||
|
@ -4687,9 +4652,8 @@ ibuf_delete_for_discarded_space(
|
|||
|
||||
memset(dops, 0, sizeof(dops));
|
||||
loop:
|
||||
ibuf_enter();
|
||||
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
/* Position pcur in the insert buffer at the first entry for the
|
||||
space */
|
||||
|
@ -4725,8 +4689,6 @@ loop:
|
|||
/* Deletion was pessimistic and mtr was committed:
|
||||
we start from the beginning again */
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
goto loop;
|
||||
}
|
||||
|
||||
|
@ -4734,8 +4696,6 @@ loop:
|
|||
mtr_commit(&mtr);
|
||||
btr_pcur_close(&pcur);
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
goto loop;
|
||||
}
|
||||
}
|
||||
|
@ -4753,8 +4713,6 @@ leave_loop:
|
|||
mutex_exit(&ibuf_mutex);
|
||||
#endif /* HAVE_ATOMIC_BUILTINS */
|
||||
|
||||
ibuf_exit();
|
||||
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
||||
|
@ -4770,8 +4728,8 @@ ibuf_is_empty(void)
|
|||
const page_t* root;
|
||||
mtr_t mtr;
|
||||
|
||||
ibuf_enter();
|
||||
mtr_start(&mtr);
|
||||
ibuf_enter(&mtr);
|
||||
|
||||
mutex_enter(&ibuf_mutex);
|
||||
root = ibuf_tree_root_get(&mtr);
|
||||
|
@ -4779,7 +4737,6 @@ ibuf_is_empty(void)
|
|||
|
||||
is_empty = (page_get_n_recs(root) == 0);
|
||||
mtr_commit(&mtr);
|
||||
ibuf_exit();
|
||||
|
||||
ut_a(is_empty == ibuf->empty);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ Created 11/5/1995 Heikki Tuuri
|
|||
|
||||
#include "univ.i"
|
||||
#include "buf0types.h"
|
||||
#include "mtr0types.h"
|
||||
|
||||
/********************************************************************//**
|
||||
High-level function which reads a page asynchronously from a file to the
|
||||
|
@ -72,8 +73,9 @@ buf_read_ahead_linear(
|
|||
/*==================*/
|
||||
ulint space, /*!< in: space id */
|
||||
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
|
||||
ulint offset);/*!< in: page number of a page; NOTE: the current thread
|
||||
ulint offset, /*!< in: page number of a page; NOTE: the current thread
|
||||
must want access to this page (see NOTE 3 above) */
|
||||
mtr_t *mtr); /*!< in: mtr to get ibuf_inside indicator */
|
||||
/********************************************************************//**
|
||||
Issues read requests for pages which the ibuf module wants to read in, in
|
||||
order to contract the insert buffer tree. Technically, this function is like
|
||||
|
|
|
@ -218,7 +218,7 @@ ibuf_should_try(
|
|||
a secondary index when we
|
||||
decide */
|
||||
/******************************************************************//**
|
||||
Returns TRUE if the current OS thread is performing an insert buffer
|
||||
Returns TRUE if the current MTR is performing an insert buffer
|
||||
routine.
|
||||
|
||||
For instance, a read-ahead of non-ibuf pages is forbidden by threads
|
||||
|
@ -226,7 +226,16 @@ that are executing an insert buffer routine.
|
|||
@return TRUE if inside an insert buffer routine */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
ibuf_inside(void);
|
||||
ibuf_inside(
|
||||
mtr_t* mtr);/*!< in: ibuf_inside stored on mtr */
|
||||
/*=============*/
|
||||
/***********************************************************************//**
|
||||
Sets ibuf_inside indicator on current MTR.
|
||||
*/
|
||||
UNIV_INTERN
|
||||
void
|
||||
ibuf_enter(
|
||||
mtr_t* mtr);/*!< in: ibuf_inside stored on mtr */
|
||||
/*=============*/
|
||||
/***********************************************************************//**
|
||||
Checks if a page address is an ibuf bitmap page (level 3 page) address.
|
||||
|
|
|
@ -378,6 +378,8 @@ struct mtr_struct{
|
|||
#endif
|
||||
dyn_array_t memo; /*!< memo stack for locks etc. */
|
||||
dyn_array_t log; /*!< mini-transaction log */
|
||||
ibool ibuf_inside;
|
||||
/* TRUE if inside ibuf changes */
|
||||
ibool modifications;
|
||||
/* TRUE if the mtr made modifications to
|
||||
buffer pool pages */
|
||||
|
|
|
@ -44,6 +44,7 @@ mtr_start(
|
|||
|
||||
mtr->log_mode = MTR_LOG_ALL;
|
||||
mtr->modifications = FALSE;
|
||||
mtr->ibuf_inside = FALSE;
|
||||
mtr->n_log_recs = 0;
|
||||
|
||||
ut_d(mtr->state = MTR_ACTIVE);
|
||||
|
|
|
@ -74,14 +74,6 @@ thr_local_set_slot_no(
|
|||
/*==================*/
|
||||
os_thread_id_t id, /*!< in: thread id of the thread */
|
||||
ulint slot_no);/*!< in: slot number */
|
||||
/*******************************************************************//**
|
||||
Returns pointer to the 'in_ibuf' field within the current thread local
|
||||
storage.
|
||||
@return pointer to the in_ibuf field */
|
||||
UNIV_INTERN
|
||||
ibool*
|
||||
thr_local_get_in_ibuf_field(void);
|
||||
/*=============================*/
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "thr0loc.ic"
|
||||
|
|
|
@ -267,6 +267,7 @@ mtr_commit(
|
|||
ut_d(mtr->state = MTR_COMMITTED);
|
||||
dyn_array_free(&(mtr->memo));
|
||||
dyn_array_free(&(mtr->log));
|
||||
mtr->ibuf_inside = FALSE;
|
||||
}
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
|
|
|
@ -174,26 +174,6 @@ thr_local_set_slot_no(
|
|||
mutex_exit(&thr_local_mutex);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Returns pointer to the 'in_ibuf' field within the current thread local
|
||||
storage.
|
||||
@return pointer to the in_ibuf field */
|
||||
UNIV_INTERN
|
||||
ibool*
|
||||
thr_local_get_in_ibuf_field(void)
|
||||
/*=============================*/
|
||||
{
|
||||
thr_local_t* local;
|
||||
|
||||
mutex_enter(&thr_local_mutex);
|
||||
|
||||
local = thr_local_get(os_thread_get_curr_id());
|
||||
|
||||
mutex_exit(&thr_local_mutex);
|
||||
|
||||
return(&(local->in_ibuf));
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Creates a local storage struct for the calling new thread. */
|
||||
UNIV_INTERN
|
||||
|
|
Loading…
Reference in a new issue