Skip to content

Commit fa0a68f

Browse files
MDEV-36270 mariabackup.incremental_compressed fails in 10.11+
Problem: ======= - 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 652f33e commit fa0a68f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

extra/mariabackup/xtrabackup.cc

+8-3
Original file line numberDiff line numberDiff line change
@@ -6250,9 +6250,14 @@ xtrabackup_apply_delta(
62506250
buf + FSP_HEADER_OFFSET + FSP_SIZE);
62516251
if (mach_read_from_4(buf
62526252
+ FIL_PAGE_SPACE_ID)) {
6253-
if (!os_file_set_size(
6254-
dst_path, dst_file,
6255-
n_pages * page_size))
6253+
os_offset_t last_page =
6254+
os_file_get_size(dst_file) /
6255+
page_size;
6256+
6257+
if (last_page < n_pages &&
6258+
!os_file_set_size(
6259+
dst_path, dst_file,
6260+
n_pages * page_size))
62566261
goto error;
62576262
} else if (fil_space_t* space
62586263
= fil_system.sys_space) {

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)