Commit 6979d204 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14499 Mariabackup 10.2 fails to back up a multi-file InnoDB system tablespace

When Mariabackup is invoked on an instance that uses a multi-file
InnoDB system tablespace, it may fail to other files of the system
tablespace than the first one.
This was revealed by the MDEV-14447 test case.
The offending code is assuming that the first page of each data file
is page 0. But, in multi-file system tablespaces that is not the case.

xb_fil_cur_open(): Instead of re-reading the first page of the file,
rely on the fil_space_t metadata that already exists in memory.

xb_get_space_flags(): Remove.
parent 59150361
......@@ -212,24 +212,7 @@ xb_fil_cur_open(
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
/* Determine the page size */
ulint flags = xb_get_space_flags(cursor->file);
if (flags == ULINT_UNDEFINED) {
xb_fil_cur_close(cursor);
return(XB_FIL_CUR_SKIP);
}
if (!fsp_flags_is_valid(flags, cursor->space_id)) {
ulint cflags = fsp_flags_convert_from_101(flags);
if (cflags == ULINT_UNDEFINED) {
msg("[%02u] mariabackup: Error: Invalid "
"tablespace flags: %x.\n", thread_n, uint(flags));
return(XB_FIL_CUR_SKIP);
}
flags = cflags;
}
const page_size_t page_size(flags);
const page_size_t page_size(cursor->node->space->flags);
cursor->page_size = page_size;
/* Allocate read buffer */
......
......@@ -2137,28 +2137,6 @@ check_if_skip_table(
return(FALSE);
}
/** @return the tablespace flags from a given data file
@retval ULINT_UNDEFINED if the file is not readable */
ulint xb_get_space_flags(pfs_os_file_t file)
{
byte *buf;
byte *page;
ulint flags;
buf = static_cast<byte *>(malloc(2 * UNIV_PAGE_SIZE));
page = static_cast<byte *>(ut_align(buf, UNIV_PAGE_SIZE));
if (os_file_read(IORequestRead, file, page, 0, UNIV_PAGE_SIZE)) {
flags = fsp_header_get_flags(page);
} else {
flags = ULINT_UNDEFINED;
}
free(buf);
return(flags);
}
const char*
xb_get_copy_action(const char *dflt)
{
......
......@@ -149,10 +149,6 @@ void xtrabackup_io_throttling(void);
my_bool xb_write_delta_metadata(const char *filename,
const xb_delta_info_t *info);
/** @return the tablespace flags from a given data file
@retval ULINT_UNDEFINED if the file is not readable */
ulint xb_get_space_flags(pfs_os_file_t file);
/************************************************************************
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
......
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