[MDEV-23335] MariaBackup Incremental Does Not Reflect Dropped/Created Databases Created: 2020-07-30  Updated: 2023-01-19  Resolved: 2023-01-19

Status: Closed
Project: MariaDB Server
Component/s: mariabackup
Affects Version/s: 10.5.4, 10.6.2, 10.3.37, 10.4.28
Fix Version/s: 10.11.2, 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Blocker
Reporter: Juan Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7


Issue Links:
Relates
relates to MDEV-28446 mariabackup prepare fails for increme... Closed

 Description   

Create a test database, say "t2".
Run mariabackup --backup.
Drop database "t2"
Run mariabackup --incremental(-basedir)
Prepare and restore the backup.
See the dropped database restored. - All the objects in the database will be gone, but the database itself is still there.



 Comments   
Comment by Alexander Barkov [ 2022-11-09 ]

This mtr test demonstrates the problem:

call mtr.add_suppression("InnoDB: New log files created");
--let $basedir=$MYSQLTEST_VARDIR/tmp/backup
--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1
 
CREATE DATABASE db1;
 
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir
--enable_result_log
 
CREATE TABLE db1.t1 (a INT);
DROP DATABASE db1;
 
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir
 
--disable_result_log
--echo # Prepare full backup, apply incremental one
--exec $XTRABACKUP --prepare --target-dir=$basedir
--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir
--enable_result_log
 
--let $targetdir=$basedir
--source include/restart_and_restore.inc
--enable_result_log
 
SHOW DATABASES;
SHOW TABLES IN db1;
 
--rmdir $basedir
--rmdir $incremental_dir

This is the output:

CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
DROP DATABASE db1;
# Prepare full backup, apply incremental one
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SHOW DATABASES;
Database
db1
information_schema
mtr
mysql
performance_schema
test
SHOW TABLES IN db1;
Tables_in_db1

Notice, the database db1 is still there. Note, there are no tables in the database.

Comment by Alexander Barkov [ 2022-11-09 ]

The problem is also repeatable with 10.3.37 and 10.4.28.

Comment by Alexander Barkov [ 2022-11-10 ]

Hello serg. Can you please review this patch:
https://github.com/MariaDB/server/commit/df09b3a646b4f4ef15e5182a6c0b86710e1740e2

?

Thanks!

Comment by Sergei Golubchik [ 2023-01-06 ]

df09b3a646b4f4ef15e5182a6c0b86710e1740e2 is ok to push

Generated at Thu Feb 08 09:21:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.