Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/ilist.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ template <class T, class Tag= void> class ilist
ListNode *prev= pos.node_->prev;
ListNode *next= pos.node_->next;

DBUG_ASSERT(prev->next == pos.node_);
DBUG_ASSERT(next->prev == pos.node_);

prev->next= next;
next->prev= prev;

Expand All @@ -198,7 +201,7 @@ template <class T, class Tag= void> class ilist
}

void push_back(reference value) noexcept { insert(end(), value); }
void pop_back() noexcept { erase(end()); }
void pop_back() noexcept { erase(--end()); }

void push_front(reference value) noexcept { insert(begin(), value); }
void pop_front() noexcept { erase(begin()); }
Expand Down
22 changes: 14 additions & 8 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ bool fil_space_free(ulint id, bool x_latched) noexcept
mysql_mutex_assert_owner(&log_sys.mutex);

if (space->max_lsn != 0) {
ut_d(space->max_lsn = 0);
space->max_lsn = 0;
fil_system.named_spaces.remove(*space);
}

Expand Down Expand Up @@ -1595,6 +1595,18 @@ fil_space_t *fil_space_t::drop(ulint id, pfs_os_file_t *detached_handle)
*detached_handle = handle;
else
os_file_close(handle);

/* The above mnt.commit_file() call should remove the space from
fil_system.named_spaces, but some pending operations can push it back
to the container again. */
mysql_mutex_lock(&log_sys.mutex);
if (space->max_lsn != 0)
{
space->max_lsn= 0;
fil_system.named_spaces.remove(*space);
}
mysql_mutex_unlock(&log_sys.mutex);

return space;
}

Expand All @@ -1617,12 +1629,6 @@ void fil_close_tablespace(ulint id) noexcept
while (buf_flush_list_space(space));

space->x_unlock();
mysql_mutex_lock(&log_sys.mutex);
if (space->max_lsn != 0) {
ut_d(space->max_lsn = 0);
fil_system.named_spaces.remove(*space);
}
mysql_mutex_unlock(&log_sys.mutex);
fil_space_free_low(space);
}

Expand All @@ -1631,7 +1637,7 @@ pfs_os_file_t fil_delete_tablespace(ulint id) noexcept
ut_ad(!is_system_tablespace(id));
pfs_os_file_t handle= OS_FILE_CLOSED;
if (fil_space_t *space= fil_space_t::drop(id, &handle))
fil_space_free_low(space);
fil_space_free_low(space);
return handle;
}

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/mtr/mtr0mtr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ bool mtr_t::commit_file(fil_space_t &space, const char *name)

if (!name && space.max_lsn)
{
ut_d(space.max_lsn= 0);
space.max_lsn= 0;
fil_system.named_spaces.remove(space);
}

Expand Down