diff options
author | Vlad Lesin <vlad_lesin@mail.ru> | 2023-04-07 00:16:16 +0300 |
---|---|---|
committer | Vlad Lesin <vlad_lesin@mail.ru> | 2023-04-14 10:41:59 +0300 |
commit | 0cca8166f3111901019dcd33747a1a1dfd9e66d1 (patch) | |
tree | 213ef47f9742f0086d671ecfefbb16386c830ac8 | |
parent | f2fde3f6675dff56e7f46c19c9f041cc7e259d43 (diff) | |
download | mariadb-git-0cca8166f3111901019dcd33747a1a1dfd9e66d1.tar.gz |
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
85cbfaefee694cdd490b357444f24ff16b8042e8, and the fix
does not work properly, i.e. it inserted just opened tablespace to the
position preceding fil_system.space_list_last_opened.
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 17 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 7e2b04eaa73..00ded1ab27e 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -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; } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 12ac86dc9be..165994eef35 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1552,6 +1552,7 @@ public: if (space_list_last_opened == space) { + ut_ad(s != space_list.begin()); space_list_t::iterator prev= s; space_list_last_opened= &*--prev; } |