diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-08-22 18:36:30 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-08-22 18:36:30 +0530 |
commit | b55ad78aa4f8964ea3eabb673f415c0a729f3954 (patch) | |
tree | fae5026f3201382881a87052cbaf4e89c0ad7c1b | |
parent | a1055ab35d29437b717e83b1a388eaa02901c42f (diff) | |
download | mariadb-git-bb-10.3-MDEV-29319.tar.gz |
MDEV-29319 Assertion failure size_in_header >= space.free_limit in fsp_get_available_space_in_free_extents()bb-10.3-MDEV-29319
- Race condition between fsp_get_available_space_in_free_extents()
and fsp_try_extend_data_file() while accessing space.free_limit.
In fsp_get_available_space_in_free_extents(), take shared lock
on space->latch before accessing space.free_limit and space.size_in_header
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e1b645c1cc3..f749afa2627 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14202,10 +14202,12 @@ been acquired by the caller who holds it for the calculation, @param[in] space tablespace object from fil_space_acquire() @return available space in KiB */ static uintmax_t -fsp_get_available_space_in_free_extents(const fil_space_t& space) +fsp_get_available_space_in_free_extents(fil_space_t& space) { + ut_d(rw_lock_s_lock(&space.latch)); ulint size_in_header = space.size_in_header; if (size_in_header < FSP_EXTENT_SIZE) { + ut_d(rw_lock_s_unlock(&space.latch)); return 0; /* TODO: count free frag pages and return a value based on that */ } @@ -14214,6 +14216,7 @@ fsp_get_available_space_in_free_extents(const fil_space_t& space) some of them will contain extent descriptor pages, and therefore will not be free extents */ ut_ad(size_in_header >= space.free_limit); + ut_d(rw_lock_s_unlock(&space.latch)); ulint n_free_up = (size_in_header - space.free_limit) / FSP_EXTENT_SIZE; |