Skip to content

Commit

Permalink
Follow-up to MDEV-12266: Remove latch_t::m_temp_fsp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Jul 23, 2018
1 parent 141a5b2 commit b9865b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
1 change: 0 additions & 1 deletion storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,6 @@ fil_space_create(
rw_lock_create(fil_space_latch_key, &space->latch, SYNC_FSP);

if (space->purpose == FIL_TYPE_TEMPORARY) {
ut_d(space->latch.set_temp_fsp());
/* SysTablespace::open_or_create() would pass
size!=0 to fil_node_create(), so first_time_open
would not hold in fil_node_open_file(), and we
Expand Down
24 changes: 1 addition & 23 deletions storage/innobase/include/sync0types.h
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,7 @@ struct latch_t {
UNIV_NOTHROW
:
m_id(id),
m_rw_lock(),
m_temp_fsp() { }
m_rw_lock() {}

/** Destructor */
virtual ~latch_t() UNIV_NOTHROW { }
Expand Down Expand Up @@ -1014,24 +1013,6 @@ struct latch_t {
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 */
const char* get_name() const
UNIV_NOTHROW
Expand All @@ -1047,9 +1028,6 @@ struct latch_t {
/** true if it is a rw-lock. In debug mode, rw_lock_t derives from
this class and sets this variable. */
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. */
Expand Down
18 changes: 5 additions & 13 deletions storage/innobase/sync/sync0debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Created 2012-08-21 Sunny Bains

#include "ut0new.h"
#include "srv0start.h"
#include "fil0fil.h"

#include <map>
#include <vector>
Expand Down Expand Up @@ -910,19 +911,10 @@ LatchDebug::check_order(

case SYNC_TREE_NODE:

{
const latch_t* fsp_latch;

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)
|| basic_check(latches,
level, SYNC_TREE_NODE - 1));
}

ut_a(find(latches, SYNC_FSP) == &fil_system.temp_space->latch
|| find(latches, SYNC_INDEX_TREE)
|| find(latches, SYNC_DICT_OPERATION)
|| basic_check(latches, level, SYNC_TREE_NODE - 1));
break;

case SYNC_TREE_NODE_NEW:
Expand Down

0 comments on commit b9865b2

Please sign in to comment.