Commit 46f8c46e authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-30069 InnoDB: Trying to write ... bytes at ... outside the bounds

recv_sys_t::recover_deferred(): If the *.ibd file already exists,
adjust the size to the tablespace metadata. It could be that
in a multi-batch recovery, we will initially recover an all-zero
*.ibd file to a smaller size, and then a fatal error would be
reported during the last recovery batch.

This bug could be worked around by executing the recovery again.
During the initial (failed) recovery attempt, something should have
been written to the first page of the file and the file size should
be recovered by fil_node_t::read_page0().
parent 377ec1b5
......@@ -986,6 +986,20 @@ bool recv_sys_t::recover_deferred(recv_sys_t::map::iterator &p,
DB_SUCCESS == os_file_punch_hole(node->handle, 0, 4096) &&
!my_test_if_thinly_provisioned(node->handle);
#endif
/* Mimic fil_node_t::read_page0() in case the file exists and
has already been extended to a larger size. */
ut_ad(node->size == size);
const os_offset_t file_size= os_file_get_size(node->handle);
if (file_size != os_offset_t(-1))
{
const uint32_t n_pages=
uint32_t(file_size / fil_space_t::physical_size(flags));
if (n_pages > size)
{
space->size= node->size= n_pages;
space->set_committed_size();
}
}
if (!os_file_set_size(node->name, node->handle,
(size * fil_space_t::physical_size(flags)) &
~4095ULL, is_sparse))
......
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