summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-08-22 18:36:30 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-08-24 10:58:08 +0530
commit0b805733105cd5b5f8b16146ec804e56018b43d9 (patch)
tree286697fc651f050af3f209e92fc8f50331ae46c5
parent8963d64ee87e92a07f1175292f5010c3a0d03090 (diff)
downloadmariadb-git-0b805733105cd5b5f8b16146ec804e56018b43d9.tar.gz
MDEV-29319 Assertion failure size_in_header >= space.free_limit in fsp_get_available_space_in_free_extents()
- Race condition between fsp_get_available_space_in_free_extents() and fsp_try_extend_data_file() while accessing space.free_limit. Before calling fsp_get_available_space_in_free_extents(), take shared lock on space->latch.
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e1b645c1cc3..1e9c9f03ed1 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14202,7 +14202,7 @@ 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)
{
ulint size_in_header = space.size_in_header;
if (size_in_header < FSP_EXTENT_SIZE) {
@@ -14394,9 +14394,11 @@ ha_innobase::info_low(
stats.index_file_length
= ulonglong(stat_sum_of_other_index_sizes)
* size;
+ rw_lock_s_lock(&space->latch);
stats.delete_length = 1024
* fsp_get_available_space_in_free_extents(
*space);
+ rw_lock_s_unlock(&space->latch);
}
stats.check_time = 0;
stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *));