Follow-up to MDEV-12266: Remove latch_t::m_temp_fsp
There is only one temporary tablespace. Reserving a data member in each read-write lock object for a Boolean flag seems like a huge waste, especially because this field was only actually used in debug builds. LatchDebug::check_order(): Compare to fil_system.temp_space->latch.
This commit is contained in:
parent
141a5b2484
commit
b9865b289a
@ -1480,7 +1480,6 @@ fil_space_create(
|
|||||||
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
|
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);
|
||||||
|
|
||||||
if (space->purpose == FIL_TYPE_TEMPORARY) {
|
if (space->purpose == FIL_TYPE_TEMPORARY) {
|
||||||
ut_d(space->latch.set_temp_fsp());
|
|
||||||
/* SysTablespace::open_or_create() would pass
|
/* SysTablespace::open_or_create() would pass
|
||||||
size!=0 to fil_node_create(), so first_time_open
|
size!=0 to fil_node_create(), so first_time_open
|
||||||
would not hold in fil_node_open_file(), and we
|
would not hold in fil_node_open_file(), and we
|
||||||
|
@ -979,8 +979,7 @@ struct latch_t {
|
|||||||
UNIV_NOTHROW
|
UNIV_NOTHROW
|
||||||
:
|
:
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_rw_lock(),
|
m_rw_lock() {}
|
||||||
m_temp_fsp() { }
|
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
virtual ~latch_t() UNIV_NOTHROW { }
|
virtual ~latch_t() UNIV_NOTHROW { }
|
||||||
@ -1014,24 +1013,6 @@ struct latch_t {
|
|||||||
return(sync_latch_get_level(m_id));
|
return(sync_latch_get_level(m_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return true if the latch is for a temporary file space*/
|
|
||||||
bool is_temp_fsp() const
|
|
||||||
UNIV_NOTHROW
|
|
||||||
{
|
|
||||||
return(m_temp_fsp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set the temporary tablespace flag. (For internal temporary
|
|
||||||
tables, MySQL 5.7 does not always acquire the index->lock. We
|
|
||||||
need to figure out the context and add some special rules
|
|
||||||
during the checks.) */
|
|
||||||
void set_temp_fsp()
|
|
||||||
UNIV_NOTHROW
|
|
||||||
{
|
|
||||||
ut_ad(get_id() == LATCH_ID_FIL_SPACE);
|
|
||||||
m_temp_fsp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return the latch name, m_id must be set */
|
/** @return the latch name, m_id must be set */
|
||||||
const char* get_name() const
|
const char* get_name() const
|
||||||
UNIV_NOTHROW
|
UNIV_NOTHROW
|
||||||
@ -1047,9 +1028,6 @@ struct latch_t {
|
|||||||
/** true if it is a rw-lock. In debug mode, rw_lock_t derives from
|
/** true if it is a rw-lock. In debug mode, rw_lock_t derives from
|
||||||
this class and sets this variable. */
|
this class and sets this variable. */
|
||||||
bool m_rw_lock;
|
bool m_rw_lock;
|
||||||
|
|
||||||
/** true if it is an temporary space latch */
|
|
||||||
bool m_temp_fsp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Subclass this to iterate over a thread's acquired latch levels. */
|
/** Subclass this to iterate over a thread's acquired latch levels. */
|
||||||
|
@ -35,6 +35,7 @@ Created 2012-08-21 Sunny Bains
|
|||||||
|
|
||||||
#include "ut0new.h"
|
#include "ut0new.h"
|
||||||
#include "srv0start.h"
|
#include "srv0start.h"
|
||||||
|
#include "fil0fil.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -910,19 +911,10 @@ LatchDebug::check_order(
|
|||||||
|
|
||||||
case SYNC_TREE_NODE:
|
case SYNC_TREE_NODE:
|
||||||
|
|
||||||
{
|
ut_a(find(latches, SYNC_FSP) == &fil_system.temp_space->latch
|
||||||
const latch_t* fsp_latch;
|
|| find(latches, SYNC_INDEX_TREE)
|
||||||
|
|
||||||
fsp_latch = find(latches, SYNC_FSP);
|
|
||||||
|
|
||||||
ut_a((fsp_latch != NULL
|
|
||||||
&& fsp_latch->is_temp_fsp())
|
|
||||||
|| find(latches, SYNC_INDEX_TREE) != 0
|
|
||||||
|| find(latches, SYNC_DICT_OPERATION)
|
|| find(latches, SYNC_DICT_OPERATION)
|
||||||
|| basic_check(latches,
|
|| basic_check(latches, level, SYNC_TREE_NODE - 1));
|
||||||
level, SYNC_TREE_NODE - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYNC_TREE_NODE_NEW:
|
case SYNC_TREE_NODE_NEW:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user