Merge 10.3 into 10.4
This commit is contained in:
commit
89ae01fd00
@ -4851,13 +4851,13 @@ btr_validate_level(
|
||||
ulint parent_right_page_no = FIL_NULL;
|
||||
bool rightmost_child = false;
|
||||
|
||||
mtr_start(&mtr);
|
||||
mtr.start();
|
||||
|
||||
if (!srv_read_only_mode) {
|
||||
if (lockout) {
|
||||
mtr_x_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_x_lock_index(index, &mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4934,9 +4934,9 @@ loop:
|
||||
offsets = offsets2 = NULL;
|
||||
if (!srv_read_only_mode) {
|
||||
if (lockout) {
|
||||
mtr_x_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_x_lock_index(index, &mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5234,13 +5234,13 @@ node_ptr_fails:
|
||||
/* Commit the mini-transaction to release the latch on 'page'.
|
||||
Re-acquire the latch on right_page, which will become 'page'
|
||||
on the next loop. The page has already been checked. */
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
if (trx_is_interrupted(trx)) {
|
||||
/* On interrupt, return the current status. */
|
||||
} else if (right_page_no != FIL_NULL) {
|
||||
|
||||
mtr_start(&mtr);
|
||||
mtr.start();
|
||||
|
||||
if (!lockout) {
|
||||
if (rightmost_child) {
|
||||
@ -5300,9 +5300,9 @@ btr_validate_index(
|
||||
|
||||
if (!srv_read_only_mode) {
|
||||
if (lockout) {
|
||||
mtr_x_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_x_lock_index(index, &mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ BtrBulk::finish(dberr_t err)
|
||||
|
||||
mtr.start();
|
||||
m_index->set_modified(mtr);
|
||||
mtr_x_lock(&m_index->lock, &mtr);
|
||||
mtr_x_lock_index(m_index, &mtr);
|
||||
|
||||
ut_ad(last_page_no != FIL_NULL);
|
||||
last_block = btr_block_get(
|
||||
|
@ -1406,16 +1406,16 @@ btr_cur_search_to_nth_level_func(
|
||||
if (lock_intention == BTR_INTENTION_DELETE
|
||||
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
|
||||
&& buf_get_n_pending_read_ios()) {
|
||||
mtr_x_lock(dict_index_get_lock(index), mtr);
|
||||
} else if (dict_index_is_spatial(index)
|
||||
x_latch_index:
|
||||
mtr_x_lock_index(index, mtr);
|
||||
} else if (index->is_spatial()
|
||||
&& lock_intention <= BTR_INTENTION_BOTH) {
|
||||
/* X lock the if there is possibility of
|
||||
pessimistic delete on spatial index. As we could
|
||||
lock upward for the tree */
|
||||
|
||||
mtr_x_lock(dict_index_get_lock(index), mtr);
|
||||
goto x_latch_index;
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
upper_rw_latch = RW_X_LATCH;
|
||||
break;
|
||||
@ -1447,10 +1447,10 @@ btr_cur_search_to_nth_level_func(
|
||||
BTR_ALREADY_S_LATCHED */
|
||||
ut_ad(latch_mode != BTR_SEARCH_TREE);
|
||||
|
||||
mtr_s_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_s_lock_index(index, mtr);
|
||||
} else {
|
||||
/* BTR_MODIFY_EXTERNAL needs to be excluded */
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
upper_rw_latch = RW_S_LATCH;
|
||||
} else {
|
||||
@ -2541,9 +2541,9 @@ btr_cur_open_at_index_side_func(
|
||||
if (lock_intention == BTR_INTENTION_DELETE
|
||||
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
|
||||
&& buf_get_n_pending_read_ios()) {
|
||||
mtr_x_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_x_lock_index(index, mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
upper_rw_latch = RW_X_LATCH;
|
||||
break;
|
||||
@ -2559,7 +2559,7 @@ btr_cur_open_at_index_side_func(
|
||||
BTR_ALREADY_S_LATCHED */
|
||||
ut_ad(latch_mode != BTR_SEARCH_TREE);
|
||||
|
||||
mtr_s_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_s_lock_index(index, mtr);
|
||||
}
|
||||
upper_rw_latch = RW_S_LATCH;
|
||||
} else {
|
||||
@ -2870,7 +2870,7 @@ btr_cur_open_at_rnd_pos_func(
|
||||
ulint* offsets = offsets_;
|
||||
rec_offs_init(offsets_);
|
||||
|
||||
ut_ad(!dict_index_is_spatial(index));
|
||||
ut_ad(!index->is_spatial());
|
||||
|
||||
lock_intention = btr_cur_get_and_clear_intention(&latch_mode);
|
||||
|
||||
@ -2886,9 +2886,9 @@ btr_cur_open_at_rnd_pos_func(
|
||||
if (lock_intention == BTR_INTENTION_DELETE
|
||||
&& trx_sys.rseg_history_len > BTR_CUR_FINE_HISTORY_LENGTH
|
||||
&& buf_get_n_pending_read_ios()) {
|
||||
mtr_x_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_x_lock_index(index, mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
upper_rw_latch = RW_X_LATCH;
|
||||
break;
|
||||
@ -2904,7 +2904,7 @@ btr_cur_open_at_rnd_pos_func(
|
||||
/* fall through */
|
||||
default:
|
||||
if (!srv_read_only_mode) {
|
||||
mtr_s_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_s_lock_index(index, mtr);
|
||||
upper_rw_latch = RW_S_LATCH;
|
||||
} else {
|
||||
upper_rw_latch = RW_NO_LATCH;
|
||||
@ -5130,7 +5130,7 @@ btr_cur_pessimistic_update(
|
||||
MTR_MEMO_X_LOCK |
|
||||
MTR_MEMO_SX_LOCK));
|
||||
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
|
||||
/* Was the record to be updated positioned as the first user
|
||||
|
@ -748,7 +748,7 @@ DECLARE_THREAD(btr_defragment_thread)(void*)
|
||||
index->set_modified(mtr);
|
||||
/* To follow the latching order defined in WL#6326, acquire index->lock X-latch.
|
||||
This entitles us to acquire page latches in any order for the index. */
|
||||
mtr_x_lock(&index->lock, &mtr);
|
||||
mtr_x_lock_index(index, &mtr);
|
||||
/* This will acquire index->lock SX-latch, which per WL#6363 is allowed
|
||||
when we are already holding the X-latch. */
|
||||
btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, &mtr);
|
||||
|
@ -742,7 +742,7 @@ btr_scrub_recheck_page(
|
||||
}
|
||||
|
||||
mtr_start(mtr);
|
||||
mtr_x_lock(dict_index_get_lock(scrub_data->current_index), mtr);
|
||||
mtr_x_lock_index(scrub_data->current_index, mtr);
|
||||
/** set savepoint for X-latch of block */
|
||||
scrub_data->savepoint = mtr_set_savepoint(mtr);
|
||||
return BTR_SCRUB_PAGE;
|
||||
|
@ -279,11 +279,11 @@ dict_stats_save_defrag_stats(
|
||||
mtr_t mtr;
|
||||
ulint n_leaf_pages;
|
||||
ulint n_leaf_reserved;
|
||||
mtr_start(&mtr);
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr.start();
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
n_leaf_reserved = btr_get_size_and_reserved(index, BTR_N_LEAF_PAGES,
|
||||
&n_leaf_pages, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
if (n_leaf_reserved == ULINT_UNDEFINED) {
|
||||
// The index name is different during fast index creation,
|
||||
|
@ -850,10 +850,8 @@ dict_stats_update_transient_for_index(
|
||||
mtr_t mtr;
|
||||
ulint size;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
|
||||
mtr.start();
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
|
||||
|
||||
if (size != ULINT_UNDEFINED) {
|
||||
@ -863,7 +861,7 @@ dict_stats_update_transient_for_index(
|
||||
index, BTR_N_LEAF_PAGES, &mtr);
|
||||
}
|
||||
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
switch (size) {
|
||||
case ULINT_UNDEFINED:
|
||||
@ -1925,10 +1923,8 @@ dict_stats_analyze_index(
|
||||
|
||||
dict_stats_empty_index(index, false);
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
|
||||
mtr.start();
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
|
||||
|
||||
if (size != ULINT_UNDEFINED) {
|
||||
@ -1937,7 +1933,7 @@ dict_stats_analyze_index(
|
||||
}
|
||||
|
||||
/* Release the X locks on the root page taken by btr_get_size() */
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
switch (size) {
|
||||
case ULINT_UNDEFINED:
|
||||
@ -1950,10 +1946,8 @@ dict_stats_analyze_index(
|
||||
|
||||
index->stat_n_leaf_pages = size;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
|
||||
mtr.start();
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
root_level = btr_height_get(index, &mtr);
|
||||
|
||||
n_uniq = dict_index_get_n_unique(index);
|
||||
@ -1993,7 +1987,7 @@ dict_stats_analyze_index(
|
||||
index->stat_n_sample_sizes[i] = total_pages;
|
||||
}
|
||||
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
dict_stats_assert_initialized_index(index);
|
||||
DBUG_VOID_RETURN;
|
||||
@ -2039,9 +2033,9 @@ dict_stats_analyze_index(
|
||||
|
||||
/* Commit the mtr to release the tree S lock to allow
|
||||
other threads to do some work too. */
|
||||
mtr_commit(&mtr);
|
||||
mtr_start(&mtr);
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr.commit();
|
||||
mtr.start();
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
if (root_level != btr_height_get(index, &mtr)) {
|
||||
/* Just quit if the tree has changed beyond
|
||||
recognition here. The old stats from previous
|
||||
@ -2179,7 +2173,7 @@ found_level:
|
||||
data, &mtr);
|
||||
}
|
||||
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
UT_DELETE_ARRAY(n_diff_boundaries);
|
||||
|
||||
|
@ -626,7 +626,7 @@ void fsp_header_init(fil_space_t* space, ulint size, mtr_t* mtr)
|
||||
const page_id_t page_id(space->id, 0);
|
||||
const ulint zip_size = space->zip_size();
|
||||
|
||||
mtr_x_lock(&space->latch, mtr);
|
||||
mtr_x_lock_space(space, mtr);
|
||||
buf_block_t* block = buf_page_create(page_id, zip_size, mtr);
|
||||
buf_page_get(page_id, zip_size, RW_SX_LATCH, mtr);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
@ -1888,7 +1888,7 @@ fseg_create(
|
||||
ut_ad(byte_offset + FSEG_HEADER_SIZE
|
||||
<= srv_page_size - FIL_PAGE_DATA_END);
|
||||
|
||||
mtr_x_lock(&space->latch, mtr);
|
||||
mtr_x_lock_space(space, mtr);
|
||||
ut_d(space->modify_check(*mtr));
|
||||
|
||||
if (page != 0) {
|
||||
@ -2577,7 +2577,7 @@ fsp_reserve_free_extents(
|
||||
ut_ad(mtr);
|
||||
*n_reserved = n_ext;
|
||||
|
||||
mtr_x_lock(&space->latch, mtr);
|
||||
mtr_x_lock_space(space, mtr);
|
||||
const ulint physical_size = space->physical_size();
|
||||
|
||||
space_header = fsp_get_space_header(space, mtr);
|
||||
@ -2864,7 +2864,7 @@ fseg_free_page_func(
|
||||
DBUG_ENTER("fseg_free_page");
|
||||
fseg_inode_t* seg_inode;
|
||||
buf_block_t* iblock;
|
||||
mtr_x_lock(&space->latch, mtr);
|
||||
mtr_x_lock_space(space, mtr);
|
||||
|
||||
DBUG_LOG("fseg_free_page", "space_id: " << space->id
|
||||
<< ", page_no: " << offset);
|
||||
@ -2894,7 +2894,7 @@ fseg_page_is_free(fil_space_t* space, unsigned page)
|
||||
page);
|
||||
|
||||
mtr.start();
|
||||
mtr_s_lock(&space->latch, &mtr);
|
||||
mtr_s_lock_space(space, &mtr);
|
||||
|
||||
if (page >= space->free_limit || page >= space->size_in_header) {
|
||||
is_free = true;
|
||||
|
@ -1848,7 +1848,7 @@ rtr_estimate_n_rows_in_range(
|
||||
|
||||
mtr.start();
|
||||
index->set_modified(mtr);
|
||||
mtr_s_lock(&index->lock, &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
|
||||
buf_block_t* block = btr_block_get(
|
||||
page_id_t(index->table->space_id, index->page),
|
||||
|
@ -137,7 +137,7 @@ rtr_pcur_getnext_from_path(
|
||||
if (!index_locked) {
|
||||
ut_ad(latch_mode & BTR_SEARCH_LEAF
|
||||
|| latch_mode & BTR_MODIFY_LEAF);
|
||||
mtr_s_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_s_lock_index(index, mtr);
|
||||
} else {
|
||||
ut_ad(mtr_memo_contains_flagged(mtr, &index->lock,
|
||||
MTR_MEMO_SX_LOCK
|
||||
|
@ -361,7 +361,7 @@ ibuf_tree_root_get(
|
||||
ut_ad(ibuf_inside(mtr));
|
||||
ut_ad(mutex_own(&ibuf_mutex));
|
||||
|
||||
mtr_sx_lock(dict_index_get_lock(ibuf->index), mtr);
|
||||
mtr_sx_lock_index(ibuf->index, mtr);
|
||||
|
||||
/* only segment list access is exclusive each other */
|
||||
block = buf_page_get(
|
||||
@ -459,7 +459,7 @@ ibuf_init_at_db_start(void)
|
||||
|
||||
compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE);
|
||||
compile_time_assert(IBUF_SPACE_ID == 0);
|
||||
mtr_x_lock(&fil_system.sys_space->latch, &mtr);
|
||||
mtr_x_lock_space(fil_system.sys_space, &mtr);
|
||||
|
||||
mutex_enter(&ibuf_mutex);
|
||||
|
||||
@ -1929,7 +1929,7 @@ ibuf_add_free_page(void)
|
||||
mtr_start(&mtr);
|
||||
/* Acquire the fsp latch before the ibuf header, obeying the latching
|
||||
order */
|
||||
mtr_x_lock(&fil_system.sys_space->latch, &mtr);
|
||||
mtr_x_lock_space(fil_system.sys_space, &mtr);
|
||||
header_page = ibuf_header_page_get(&mtr);
|
||||
|
||||
/* Allocate a new page: NOTE that if the page has been a part of a
|
||||
@ -2008,7 +2008,7 @@ ibuf_remove_free_page(void)
|
||||
/* Acquire the fsp latch before the ibuf header, obeying the latching
|
||||
order */
|
||||
|
||||
mtr_x_lock(&fil_system.sys_space->latch, &mtr);
|
||||
mtr_x_lock_space(fil_system.sys_space, &mtr);
|
||||
header_page = ibuf_header_page_get(&mtr);
|
||||
|
||||
/* Prevent pessimistic inserts to insert buffer trees for a while */
|
||||
|
@ -81,17 +81,12 @@ savepoint. */
|
||||
/** Push an object to an mtr memo stack. */
|
||||
#define mtr_memo_push(m, o, t) (m)->memo_push(o, t)
|
||||
|
||||
/** Lock an rw-lock in s-mode. */
|
||||
#define mtr_s_lock(l, m) (m)->s_lock((l), __FILE__, __LINE__)
|
||||
|
||||
/** Lock an rw-lock in x-mode. */
|
||||
#define mtr_x_lock(l, m) (m)->x_lock((l), __FILE__, __LINE__)
|
||||
|
||||
/** Lock a tablespace in x-mode. */
|
||||
#define mtr_s_lock_space(s, m) (m)->s_lock_space((s), __FILE__, __LINE__)
|
||||
#define mtr_x_lock_space(s, m) (m)->x_lock_space((s), __FILE__, __LINE__)
|
||||
|
||||
/** Lock an rw-lock in sx-mode. */
|
||||
#define mtr_sx_lock(l, m) (m)->sx_lock((l), __FILE__, __LINE__)
|
||||
#define mtr_s_lock_index(i, m) (m)->s_lock(&(i)->lock, __FILE__, __LINE__)
|
||||
#define mtr_x_lock_index(i, m) (m)->x_lock(&(i)->lock, __FILE__, __LINE__)
|
||||
#define mtr_sx_lock_index(i, m) (m)->sx_lock(&(i)->lock, __FILE__, __LINE__)
|
||||
|
||||
#define mtr_memo_contains_flagged(m, p, l) \
|
||||
(m)->memo_contains_flagged((p), (l))
|
||||
@ -240,29 +235,7 @@ struct mtr_t {
|
||||
bool is_named_space(const fil_space_t* space) const;
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Locks a rw-latch in S mode.
|
||||
NOTE: use mtr_s_lock().
|
||||
@param lock rw-lock
|
||||
@param file file name from where called
|
||||
@param line line number in file */
|
||||
inline void s_lock(rw_lock_t* lock, const char* file, unsigned line);
|
||||
|
||||
/** Locks a rw-latch in X mode.
|
||||
NOTE: use mtr_x_lock().
|
||||
@param lock rw-lock
|
||||
@param file file name from where called
|
||||
@param line line number in file */
|
||||
inline void x_lock(rw_lock_t* lock, const char* file, unsigned line);
|
||||
|
||||
/** Locks a rw-latch in X mode.
|
||||
NOTE: use mtr_sx_lock().
|
||||
@param lock rw-lock
|
||||
@param file file name from where called
|
||||
@param line line number in file */
|
||||
inline void sx_lock(rw_lock_t* lock, const char* file, unsigned line);
|
||||
|
||||
/** Acquire a tablespace X-latch.
|
||||
NOTE: use mtr_x_lock_space().
|
||||
@param[in] space_id tablespace ID
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file
|
||||
@ -272,6 +245,60 @@ struct mtr_t {
|
||||
const char* file,
|
||||
unsigned line);
|
||||
|
||||
/** Acquire a shared rw-latch.
|
||||
@param[in] lock rw-latch
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file */
|
||||
void s_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_s_lock_inline(lock, 0, file, line);
|
||||
memo_push(lock, MTR_MEMO_S_LOCK);
|
||||
}
|
||||
|
||||
/** Acquire an exclusive rw-latch.
|
||||
@param[in] lock rw-latch
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file */
|
||||
void x_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_x_lock_inline(lock, 0, file, line);
|
||||
memo_push(lock, MTR_MEMO_X_LOCK);
|
||||
}
|
||||
|
||||
/** Acquire an shared/exclusive rw-latch.
|
||||
@param[in] lock rw-latch
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file */
|
||||
void sx_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_sx_lock_inline(lock, 0, file, line);
|
||||
memo_push(lock, MTR_MEMO_SX_LOCK);
|
||||
}
|
||||
|
||||
/** Acquire a tablespace S-latch.
|
||||
@param[in] space tablespace
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file */
|
||||
void s_lock_space(fil_space_t* space, const char* file, unsigned line)
|
||||
{
|
||||
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|
||||
|| space->purpose == FIL_TYPE_IMPORT
|
||||
|| space->purpose == FIL_TYPE_TABLESPACE);
|
||||
s_lock(&space->latch, file, line);
|
||||
}
|
||||
|
||||
/** Acquire a tablespace X-latch.
|
||||
@param[in] space tablespace
|
||||
@param[in] file file name from where called
|
||||
@param[in] line line number in file */
|
||||
void x_lock_space(fil_space_t* space, const char* file, unsigned line)
|
||||
{
|
||||
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|
||||
|| space->purpose == FIL_TYPE_IMPORT
|
||||
|| space->purpose == FIL_TYPE_TABLESPACE);
|
||||
x_lock(&space->latch, file, line);
|
||||
}
|
||||
|
||||
/** Release an object in the memo stack.
|
||||
@param object object
|
||||
@param type object type: MTR_MEMO_S_LOCK, ...
|
||||
|
@ -227,36 +227,3 @@ mtr_t::set_log_mode(mtr_log_t mode)
|
||||
ut_ad(0);
|
||||
return(old_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
Locks a lock in s-mode. */
|
||||
|
||||
void
|
||||
mtr_t::s_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_s_lock_inline(lock, 0, file, line);
|
||||
|
||||
memo_push(lock, MTR_MEMO_S_LOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
Locks a lock in x-mode. */
|
||||
|
||||
void
|
||||
mtr_t::x_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_x_lock_inline(lock, 0, file, line);
|
||||
|
||||
memo_push(lock, MTR_MEMO_X_LOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
Locks a lock in sx-mode. */
|
||||
|
||||
void
|
||||
mtr_t::sx_lock(rw_lock_t* lock, const char* file, unsigned line)
|
||||
{
|
||||
rw_lock_sx_lock_inline(lock, 0, file, line);
|
||||
|
||||
memo_push(lock, MTR_MEMO_SX_LOCK);
|
||||
}
|
||||
|
@ -569,10 +569,7 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
|
||||
|
||||
ut_ad(space);
|
||||
ut_ad(space->id == space_id);
|
||||
x_lock(&space->latch, file, line);
|
||||
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|
||||
|| space->purpose == FIL_TYPE_IMPORT
|
||||
|| space->purpose == FIL_TYPE_TABLESPACE);
|
||||
x_lock_space(space, file, line);
|
||||
return(space);
|
||||
}
|
||||
|
||||
|
@ -2622,7 +2622,7 @@ row_ins_clust_index_entry_low(
|
||||
if (mode == BTR_MODIFY_LEAF
|
||||
&& dict_index_is_online_ddl(index)) {
|
||||
mode = BTR_MODIFY_LEAF_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
if (unsigned ai = index->table->persistent_autoinc) {
|
||||
@ -2847,9 +2847,9 @@ row_ins_sec_mtr_start_and_check_if_aborted(
|
||||
}
|
||||
|
||||
if (search_mode & BTR_ALREADY_S_LATCHED) {
|
||||
mtr_s_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_s_lock_index(index, mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), mtr);
|
||||
mtr_sx_lock_index(index, mtr);
|
||||
}
|
||||
|
||||
switch (index->online_status) {
|
||||
@ -2935,9 +2935,9 @@ row_ins_sec_index_entry_low(
|
||||
DEBUG_SYNC_C("row_ins_sec_index_enter");
|
||||
if (mode == BTR_MODIFY_LEAF) {
|
||||
search_mode |= BTR_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
} else {
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
if (row_log_online_op_try(
|
||||
|
@ -388,14 +388,14 @@ row_purge_remove_sec_if_poss_tree(
|
||||
enum row_search_result search_result;
|
||||
|
||||
log_free_check();
|
||||
mtr_start(&mtr);
|
||||
mtr.start();
|
||||
index->set_modified(mtr);
|
||||
|
||||
if (!index->is_committed()) {
|
||||
/* The index->online_status may change if the index is
|
||||
or was being created online, but not committed yet. It
|
||||
is protected by index->lock. */
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
|
||||
if (dict_index_is_online_ddl(index)) {
|
||||
/* Online secondary index creation will not
|
||||
@ -490,9 +490,9 @@ row_purge_remove_sec_if_poss_tree(
|
||||
}
|
||||
|
||||
func_exit:
|
||||
btr_pcur_close(&pcur);
|
||||
btr_pcur_close(&pcur); // FIXME: need this?
|
||||
func_exit_no_pcur:
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
|
||||
return(success);
|
||||
}
|
||||
@ -519,7 +519,7 @@ row_purge_remove_sec_if_poss_leaf(
|
||||
log_free_check();
|
||||
ut_ad(index->table == node->table);
|
||||
ut_ad(!index->table->is_temporary());
|
||||
mtr_start(&mtr);
|
||||
mtr.start();
|
||||
index->set_modified(mtr);
|
||||
|
||||
if (!index->is_committed()) {
|
||||
@ -531,7 +531,7 @@ row_purge_remove_sec_if_poss_leaf(
|
||||
/* The index->online_status may change if the the
|
||||
index is or was being created online, but not
|
||||
committed yet. It is protected by index->lock. */
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
|
||||
if (dict_index_is_online_ddl(index)) {
|
||||
/* Online secondary index creation will not
|
||||
@ -635,7 +635,7 @@ row_purge_remove_sec_if_poss_leaf(
|
||||
->page.id);
|
||||
|
||||
btr_pcur_close(&pcur);
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
return(success);
|
||||
}
|
||||
}
|
||||
@ -661,9 +661,9 @@ row_purge_remove_sec_if_poss_leaf(
|
||||
/* The deletion was buffered. */
|
||||
case ROW_NOT_FOUND:
|
||||
/* The index entry does not exist, nothing to do. */
|
||||
btr_pcur_close(&pcur);
|
||||
btr_pcur_close(&pcur); // FIXME: do we need these? when is btr_cur->rtr_info set?
|
||||
func_exit_no_pcur:
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
return(success);
|
||||
}
|
||||
|
||||
@ -954,12 +954,12 @@ skip_secondaries:
|
||||
ut_ad(rseg->id == rseg_id);
|
||||
ut_ad(rseg->is_persistent());
|
||||
|
||||
mtr_start(&mtr);
|
||||
mtr.start();
|
||||
|
||||
/* We have to acquire an SX-latch to the clustered
|
||||
index tree (exclude other tree changes) */
|
||||
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
|
||||
index->set_modified(mtr);
|
||||
|
||||
@ -990,7 +990,7 @@ skip_secondaries:
|
||||
data_field + dfield_get_len(&ufield->new_val)
|
||||
- BTR_EXTERN_FIELD_REF_SIZE,
|
||||
NULL, NULL, NULL, 0, false, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
mtr.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ row_undo_ins_remove_clust_rec(
|
||||
!= RW_X_LATCH);
|
||||
ut_ad(node->table->id != DICT_INDEXES_ID);
|
||||
ut_ad(node->table->id != DICT_COLUMNS_ID);
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,10 +257,10 @@ row_undo_ins_remove_sec_low(
|
||||
|
||||
if (modify_leaf) {
|
||||
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
} else {
|
||||
ut_ad(mode == (BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE));
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
if (row_log_online_op_try(index, entry, 0)) {
|
||||
|
@ -237,7 +237,7 @@ static bool row_undo_mod_must_purge(undo_node_t* node, mtr_t* mtr)
|
||||
btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&node->pcur);
|
||||
ut_ad(btr_cur->index->is_primary());
|
||||
|
||||
mtr_s_lock(&purge_sys.latch, mtr);
|
||||
mtr->s_lock(&purge_sys.latch, __FILE__, __LINE__);
|
||||
|
||||
if (!purge_sys.view.changes_visible(node->new_trx_id,
|
||||
node->table->name)) {
|
||||
@ -288,7 +288,7 @@ row_undo_mod_clust(
|
||||
online = dict_index_is_online_ddl(index);
|
||||
if (online) {
|
||||
ut_ad(node->trx->dict_operation_lock_mode != RW_X_LATCH);
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
mem_heap_t* heap = mem_heap_create(1024);
|
||||
@ -443,7 +443,7 @@ row_undo_mod_clust(
|
||||
goto mtr_commit_exit;
|
||||
}
|
||||
rec_t* rec = btr_pcur_get_rec(pcur);
|
||||
mtr_s_lock(&purge_sys.latch, &mtr);
|
||||
mtr.s_lock(&purge_sys.latch, __FILE__, __LINE__);
|
||||
if (!purge_sys.view.changes_visible(node->new_trx_id,
|
||||
node->table->name)) {
|
||||
goto mtr_commit_exit;
|
||||
@ -536,10 +536,10 @@ row_undo_mod_del_mark_or_remove_sec_low(
|
||||
is protected by index->lock. */
|
||||
if (modify_leaf) {
|
||||
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
} else {
|
||||
ut_ad(mode == (BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE));
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
if (row_log_online_op_try(index, entry, 0)) {
|
||||
@ -732,10 +732,10 @@ try_again:
|
||||
is protected by index->lock. */
|
||||
if (mode == BTR_MODIFY_LEAF) {
|
||||
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
} else {
|
||||
ut_ad(mode == BTR_MODIFY_TREE);
|
||||
mtr_sx_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_sx_lock_index(index, &mtr);
|
||||
}
|
||||
|
||||
if (row_log_online_op_try(index, entry, trx->id)) {
|
||||
|
@ -2321,7 +2321,7 @@ row_upd_sec_index_entry(
|
||||
or was being created online, but not committed yet. It
|
||||
is protected by index->lock. */
|
||||
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
|
||||
switch (dict_index_get_online_status(index)) {
|
||||
case ONLINE_INDEX_COMPLETE:
|
||||
@ -3100,7 +3100,7 @@ row_upd_clust_step(
|
||||
if (dict_index_is_online_ddl(index)) {
|
||||
ut_ad(node->table->id != DICT_INDEXES_ID);
|
||||
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
|
||||
mtr_s_lock(dict_index_get_lock(index), &mtr);
|
||||
mtr_s_lock_index(index, &mtr);
|
||||
} else {
|
||||
mode = BTR_MODIFY_LEAF;
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ not_free:
|
||||
mtr_t mtr;
|
||||
const ulint size = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
|
||||
mtr.start();
|
||||
mtr_x_lock(&purge_sys.truncate.current->latch, &mtr);
|
||||
mtr_x_lock_space(purge_sys.truncate.current, &mtr);
|
||||
fil_truncate_log(purge_sys.truncate.current, size, &mtr);
|
||||
fsp_header_init(purge_sys.truncate.current, size, &mtr);
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
@ -696,7 +696,7 @@ trx_temp_rseg_create()
|
||||
for (ulong i = 0; i < TRX_SYS_N_RSEGS; i++) {
|
||||
mtr.start();
|
||||
mtr.set_log_mode(MTR_LOG_NO_REDO);
|
||||
mtr_x_lock(&fil_system.temp_space->latch, &mtr);
|
||||
mtr_x_lock_space(fil_system.temp_space, &mtr);
|
||||
|
||||
buf_block_t* rblock = trx_rseg_header_create(
|
||||
fil_system.temp_space, i, NULL, &mtr);
|
||||
|
@ -156,7 +156,7 @@ trx_sysf_create(
|
||||
then enter the kernel: we must do it in this order to conform
|
||||
to the latching order rules. */
|
||||
|
||||
mtr_x_lock(&fil_system.sys_space->latch, mtr);
|
||||
mtr_x_lock_space(fil_system.sys_space, mtr);
|
||||
compile_time_assert(TRX_SYS_SPACE == 0);
|
||||
|
||||
/* Create the trx sys file block in a new allocated file segment */
|
||||
|
Loading…
x
Reference in New Issue
Block a user