Commit 0cca8166 authored by Vlad Lesin's avatar Vlad Lesin

MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855

Post-push fix.

10.5 MDEV-30775 fix inserts just opened tablespace just after the element
which fil_system.space_list_last_opened points to.

In MDEV-25223 fil_system_t::space_list was changed from UT_LIST to
ilist. ilist<...>::insert(iterator pos, reference value) inserts element
to list before pos.

But it was not taken into account during 10.5->10.6 merge in
85cbfaef, and the fix
does not work properly, i.e. it inserted just opened tablespace to the
position preceding fil_system.space_list_last_opened.
parent f2fde3f6
......@@ -803,8 +803,17 @@ pfs_os_file_t fil_system_t::detach(fil_space_t *space, bool detach_handle)
space_list_t::iterator s= space_list_t::iterator(space);
if (space_list_last_opened == space)
{
space_list_t::iterator prev= s;
space_list_last_opened= &*--prev;
if (s == space_list.begin())
{
ut_ad(srv_operation > SRV_OPERATION_EXPORT_RESTORED ||
srv_shutdown_state > SRV_SHUTDOWN_NONE);
space_list_last_opened= nullptr;
}
else
{
space_list_t::iterator prev= s;
space_list_last_opened= &*--prev;
}
}
space_list.erase(s);
}
......@@ -1317,9 +1326,9 @@ void fil_system_t::close()
void fil_system_t::add_opened_last_to_space_list(fil_space_t *space)
{
if (UNIV_LIKELY(space_list_last_opened != nullptr))
space_list.insert(space_list_t::iterator(space_list_last_opened), *space);
space_list.insert(++space_list_t::iterator(space_list_last_opened), *space);
else
space_list.push_back(*space);
space_list.push_front(*space);
space_list_last_opened= space;
}
......
......@@ -1552,6 +1552,7 @@ struct fil_system_t {
if (space_list_last_opened == space)
{
ut_ad(s != space_list.begin());
space_list_t::iterator prev= s;
space_list_last_opened= &*--prev;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment