MDEV-29319 Assertion failure size_in_header >= space.free_limit in...

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.
parent 8963d64e
...@@ -14202,7 +14202,7 @@ been acquired by the caller who holds it for the calculation, ...@@ -14202,7 +14202,7 @@ been acquired by the caller who holds it for the calculation,
@param[in] space tablespace object from fil_space_acquire() @param[in] space tablespace object from fil_space_acquire()
@return available space in KiB */ @return available space in KiB */
static uintmax_t 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; ulint size_in_header = space.size_in_header;
if (size_in_header < FSP_EXTENT_SIZE) { if (size_in_header < FSP_EXTENT_SIZE) {
...@@ -14394,9 +14394,11 @@ ha_innobase::info_low( ...@@ -14394,9 +14394,11 @@ ha_innobase::info_low(
stats.index_file_length stats.index_file_length
= ulonglong(stat_sum_of_other_index_sizes) = ulonglong(stat_sum_of_other_index_sizes)
* size; * size;
rw_lock_s_lock(&space->latch);
stats.delete_length = 1024 stats.delete_length = 1024
* fsp_get_available_space_in_free_extents( * fsp_get_available_space_in_free_extents(
*space); *space);
rw_lock_s_unlock(&space->latch);
} }
stats.check_time = 0; stats.check_time = 0;
stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *)); stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *));
......
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