mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
Cleanup: More use of mtr_memo_type_t
This commit is contained in:
parent
ae90f8431b
commit
786b004972
5 changed files with 16 additions and 13 deletions
|
@ -2345,7 +2345,9 @@ need_opposite_intention:
|
||||||
? RW_X_LATCH : RW_SX_LATCH, false, mtr);
|
? RW_X_LATCH : RW_SX_LATCH, false, mtr);
|
||||||
btr_assert_not_corrupted(child_block, index);
|
btr_assert_not_corrupted(child_block, index);
|
||||||
} else {
|
} else {
|
||||||
ut_ad(mtr_memo_contains(mtr, block, upper_rw_latch));
|
ut_ad(mtr_memo_contains(mtr, block,
|
||||||
|
static_cast<mtr_memo_type_t>
|
||||||
|
(upper_rw_latch)));
|
||||||
btr_assert_not_corrupted(block, index);
|
btr_assert_not_corrupted(block, index);
|
||||||
|
|
||||||
if (s_latch_by_caller) {
|
if (s_latch_by_caller) {
|
||||||
|
@ -2671,8 +2673,8 @@ btr_cur_open_at_index_side_func(
|
||||||
ut_ad(latch_mode == BTR_SEARCH_TREE);
|
ut_ad(latch_mode == BTR_SEARCH_TREE);
|
||||||
ut_ad(s_latch_by_caller);
|
ut_ad(s_latch_by_caller);
|
||||||
ut_ad(upper_rw_latch == RW_S_LATCH);
|
ut_ad(upper_rw_latch == RW_S_LATCH);
|
||||||
|
ut_ad(mtr_memo_contains(mtr, block,
|
||||||
ut_ad(mtr_memo_contains(mtr, block, upper_rw_latch));
|
MTR_MEMO_PAGE_S_FIX));
|
||||||
|
|
||||||
if (s_latch_by_caller) {
|
if (s_latch_by_caller) {
|
||||||
/* to exclude modifying tree operations
|
/* to exclude modifying tree operations
|
||||||
|
|
|
@ -185,7 +185,7 @@ btr_leaf_page_release(
|
||||||
|
|
||||||
ut_ad(!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY));
|
ut_ad(!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY));
|
||||||
|
|
||||||
ulint mode;
|
mtr_memo_type_t mode;
|
||||||
switch (latch_mode) {
|
switch (latch_mode) {
|
||||||
case BTR_SEARCH_LEAF:
|
case BTR_SEARCH_LEAF:
|
||||||
mode = MTR_MEMO_PAGE_S_FIX;
|
mode = MTR_MEMO_PAGE_S_FIX;
|
||||||
|
|
|
@ -119,8 +119,8 @@ struct mtr_memo_slot_t {
|
||||||
/** pointer to the object */
|
/** pointer to the object */
|
||||||
void* object;
|
void* object;
|
||||||
|
|
||||||
/** type of the stored object (MTR_MEMO_S_LOCK, ...) */
|
/** type of the stored object */
|
||||||
ulint type;
|
mtr_memo_type_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Mini-transaction handle and buffer */
|
/** Mini-transaction handle and buffer */
|
||||||
|
@ -301,7 +301,7 @@ struct mtr_t {
|
||||||
|
|
||||||
/** Release an object in the memo stack.
|
/** Release an object in the memo stack.
|
||||||
@param object object
|
@param object object
|
||||||
@param type object type: MTR_MEMO_S_LOCK, ...
|
@param type object type
|
||||||
@return bool if lock released */
|
@return bool if lock released */
|
||||||
bool memo_release(const void* object, ulint type);
|
bool memo_release(const void* object, ulint type);
|
||||||
/** Release a page latch.
|
/** Release a page latch.
|
||||||
|
@ -354,13 +354,13 @@ struct mtr_t {
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
/** Check if memo contains the given item.
|
/** Check if memo contains the given item.
|
||||||
@param memo memo stack
|
@param memo memo stack
|
||||||
@param object, object to search
|
@param object object to search
|
||||||
@param type type of object
|
@param type type of object
|
||||||
@return true if contains */
|
@return true if contains */
|
||||||
static bool memo_contains(
|
static bool memo_contains(
|
||||||
const mtr_buf_t* memo,
|
const mtr_buf_t* memo,
|
||||||
const void* object,
|
const void* object,
|
||||||
ulint type)
|
mtr_memo_type_t type)
|
||||||
MY_ATTRIBUTE((warn_unused_result));
|
MY_ATTRIBUTE((warn_unused_result));
|
||||||
|
|
||||||
/** Check if memo contains the given item.
|
/** Check if memo contains the given item.
|
||||||
|
|
|
@ -255,8 +255,7 @@ mach_write_to_8(checkpoint_lsn). */
|
||||||
#define SIZE_OF_MLOG_CHECKPOINT 9
|
#define SIZE_OF_MLOG_CHECKPOINT 9
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
/** Types for the mlock objects to store in the mtr memo; NOTE that the
|
/** Types for the mlock objects to store in the mtr_t::m_memo */
|
||||||
first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
|
|
||||||
enum mtr_memo_type_t {
|
enum mtr_memo_type_t {
|
||||||
MTR_MEMO_PAGE_S_FIX = RW_S_LATCH,
|
MTR_MEMO_PAGE_S_FIX = RW_S_LATCH,
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ struct Find {
|
||||||
mtr_memo_slot_t*m_slot;
|
mtr_memo_slot_t*m_slot;
|
||||||
|
|
||||||
/** Type of the object to look for */
|
/** Type of the object to look for */
|
||||||
ulint m_type;
|
const ulint m_type;
|
||||||
|
|
||||||
/** The object instance to look for */
|
/** The object instance to look for */
|
||||||
const void* m_object;
|
const void* m_object;
|
||||||
|
@ -728,7 +728,7 @@ bool
|
||||||
mtr_t::memo_contains(
|
mtr_t::memo_contains(
|
||||||
const mtr_buf_t* memo,
|
const mtr_buf_t* memo,
|
||||||
const void* object,
|
const void* object,
|
||||||
ulint type)
|
mtr_memo_type_t type)
|
||||||
{
|
{
|
||||||
Iterate<Find> iteration(Find(object, type));
|
Iterate<Find> iteration(Find(object, type));
|
||||||
if (memo->for_each_block_in_reverse(iteration)) {
|
if (memo->for_each_block_in_reverse(iteration)) {
|
||||||
|
@ -745,6 +745,8 @@ mtr_t::memo_contains(
|
||||||
case MTR_MEMO_S_LOCK:
|
case MTR_MEMO_S_LOCK:
|
||||||
ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_S));
|
ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_S));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue