Skip to content

Commit d8e93bd

Browse files
MDEV-36270 mariabackup.incremental_compressed fails in 10.11+
- During prepare of incremental backup, mariabackup does create new file in target directory with default file size of 4 * innodb_page_size. While applying .delta file to corresponding data file, it encounters the FSP_SIZE modification on page0 and tries to extend the file to the size which is 4 in our case. Since the table is in compressed row format, page_size for the table is 8k. This lead to shrinking of tablespace file from 65536 to 32768. This issue happens only in windows because os_file_set_size() doesn't check for the current size and shrinks the file. Solution: ======== xtrabackup_apply_delta(): Check for the current size before doing setting size for the file.
1 parent 868bc46 commit d8e93bd

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

extra/mariabackup/xtrabackup.cc

+16-3
Original file line numberDiff line numberDiff line change
@@ -5508,10 +5508,23 @@ xtrabackup_apply_delta(
55085508
buf + FSP_HEADER_OFFSET + FSP_SIZE);
55095509
if (mach_read_from_4(buf
55105510
+ FIL_PAGE_SPACE_ID)) {
5511-
if (!os_file_set_size(
5512-
dst_path, dst_file,
5513-
n_pages * page_size))
5511+
#ifdef _WIN32
5512+
os_offset_t last_page =
5513+
os_file_get_size(dst_file) /
5514+
page_size;
5515+
5516+
if (last_page < n_pages &&
5517+
!os_file_set_size(
5518+
dst_path, dst_file,
5519+
n_pages * page_size))
5520+
goto error;
5521+
#else
5522+
if (os_file_set_size(
5523+
dst_path, dst_file,
5524+
n_pages *page_size))
55145525
goto error;
5526+
#endif /* _WIN32 */
5527+
55155528
} else if (fil_space_t* space
55165529
= fil_system.sys_space) {
55175530
/* The system tablespace can

mysql-test/suite/mariabackup/incremental_compressed.result

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#
55
CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
66
ALTER TABLE t PARTITION BY KEY(pk);
7+
# Incremental backup
8+
# Prepare fullbackup
9+
# Prepare incremental backup
710
# shutdown server
811
# remove datadir
912
# xtrabackup move back

mysql-test/suite/mariabackup/incremental_compressed.test

+9-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
1616

1717
ALTER TABLE t PARTITION BY KEY(pk);
1818

19+
--echo # Incremental backup
1920
--exec $XTRABACKUP --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --protocol=tcp --port=$MASTER_MYPORT --user=root > $incremental_dir.log 2>&1
21+
--echo # Prepare fullbackup
2022
--exec $XTRABACKUP --prepare --target-dir=$basedir --user=root > $MYSQL_TMP_DIR/backup_prepare_0.log 2>&1
21-
--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log
22-
--cat_file $MYSQL_TMP_DIR/backup_prepare_1.log
23+
--echo # Prepare incremental backup
24+
--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log 2>&1
2325
let $targetdir=$basedir;
2426
-- source include/restart_and_restore.inc
25-
2627
SHOW CREATE TABLE t;
2728
DROP TABLE t;
29+
remove_file $incremental_dir.log;
30+
remove_file $MYSQL_TMP_DIR/backup_prepare_0.log;
31+
remove_file $MYSQL_TMP_DIR/backup_prepare_1.log;
32+
rmdir $basedir;
33+
rmdir $incremental_dir;

0 commit comments

Comments
 (0)