Commit 8c806c41 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup

prefer backup-my.cnf from the incremental-dir over the one in target-dir
parent 5a330d4c
......@@ -55,12 +55,13 @@ static char XTRABACKUP_EXE[] = "xtrabackup";
Read "plugin-load" value from backup-my.cnf during prepare phase.
The value is stored during backup phase.
*/
static std::string get_encryption_plugin_from_cnf()
static std::string get_encryption_plugin_from_cnf(const char *dir)
{
FILE *f = fopen("backup-my.cnf", "r");
std::string path = dir + std::string("/backup-my.cnf");
FILE *f = fopen(path.c_str(), "r");
if (!f)
{
die("Can't open backup-my.cnf for reading");
die("Can't open %s for reading", path.c_str());
}
char line[512];
std::string plugin_load;
......@@ -185,9 +186,9 @@ const char *encryption_plugin_get_config()
extern int finalize_encryption_plugin(st_plugin_int *plugin);
void encryption_plugin_prepare_init(int argc, char **argv)
void encryption_plugin_prepare_init(int argc, char **argv, const char *dir)
{
std::string plugin_load= get_encryption_plugin_from_cnf();
std::string plugin_load= get_encryption_plugin_from_cnf(dir ? dir : ".");
if (plugin_load.size())
{
msg("Loading plugins from %s", plugin_load.c_str());
......
......@@ -2,6 +2,6 @@
#include <string>
extern void encryption_plugin_backup_init(MYSQL *mysql);
extern const char* encryption_plugin_get_config();
extern void encryption_plugin_prepare_init(int argc, char **argv);
extern void encryption_plugin_prepare_init(int argc, char **argv, const char *dir);
//extern void encryption_plugin_init(int argc, char **argv);
......@@ -5774,7 +5774,7 @@ static bool xtrabackup_prepare_func(char** argv)
}
int argc; for (argc = 0; argv[argc]; argc++) {}
encryption_plugin_prepare_init(argc, argv);
encryption_plugin_prepare_init(argc, argv, xtrabackup_incremental_dir);
xtrabackup_target_dir= mysql_data_home_buff;
xtrabackup_target_dir[0]=FN_CURLIB; // all paths are relative from here
......@@ -6332,12 +6332,17 @@ void handle_options(int argc, char **argv, char ***argv_server,
{
prepare= true;
}
else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) &&
else if (!strncmp(argv[i], "--incremental-dir", optend - argv[i]) &&
*optend)
{
target_dir= optend + 1;
}
else if (!*optend && argv[i][0] != '-')
else if (!strncmp(argv[i], "--target-dir", optend - argv[i]) &&
*optend && !target_dir)
{
target_dir= optend + 1;
}
else if (!*optend && argv[i][0] != '-' && !target_dir)
{
target_dir= argv[i];
}
......
#
# MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup
#
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (1),(2);
INSTALL SONAME 'provider_snappy';
SET GLOBAL innodb_compression_algorithm= snappy;
CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1;
INSERT INTO t_snappy VALUES (3),(4);
# restart: --innodb_buffer_pool_load_at_startup=0
# Prepare initial backup
# Prepare incremental backup
DROP TABLE t;
--echo #
--echo # MDEV-26794 MariaBackup does not recognize added providers upon prepare of incremental backup
--echo #
if (!$PROVIDER_SNAPPY_SO) {
skip "Needs provider_snappy plugin";
}
--source include/have_innodb.inc
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--let $incdir=$MYSQLTEST_VARDIR/tmp/inc
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t VALUES (1),(2);
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir
INSTALL SONAME 'provider_snappy';
SET GLOBAL innodb_compression_algorithm= snappy;
CREATE TABLE t_snappy (a INT) ENGINE=InnoDB page_compressed=1;
INSERT INTO t_snappy VALUES (3),(4);
# disable buffer pool load to avoid MDEV-26794 warnings
--let $restart_parameters= --innodb_buffer_pool_load_at_startup=0
--source include/restart_mysqld.inc
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --incremental-basedir=$targetdir --target-dir=$incdir
--echo # Prepare initial backup
--exec $XTRABACKUP --prepare --target-dir=$targetdir
--echo # Prepare incremental backup
--exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $MYSQLTEST_VARDIR/prepare.log 2>&1
DROP TABLE t;
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