1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-18931 Rename Mariabackup's xtrabackup_* files to mariadb_backup_*

Renaming the default MariaDB backup directory from
xtrabackup_backupfiles to mariadb_backup_files.

Renaming files:
- xtrabackup_binlog_info to mariadb_backup_binlog_info
- xtrabackup_checkpoints to mariadb_backup_checkpoints
- xtrabackup_galera_info to mariadb_backup_galera_info
- xtrabackup_info to mariadb_backup_info
- xtrabackup_slave_info to mariadb_backup_slave_info
This commit is contained in:
Alexander Barkov
2023-02-03 07:42:59 +04:00
committed by Sergei Golubchik
parent 4ae97333f0
commit b314f7b642
17 changed files with 202 additions and 86 deletions

View File

@@ -1557,7 +1557,7 @@ bool backup_finish()
return(false); return(false);
} }
if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO, if (!write_xtrabackup_info(mysql_connection, MB_INFO,
opt_history != 0, true)) { opt_history != 0, true)) {
return(false); return(false);
} }
@@ -1613,10 +1613,14 @@ ibx_copy_incremental_over_full()
const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI", const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI",
"MRG", "TRG", "TRN", "ARM", "ARZ", "CSM", "CSV", "opt", "par", "MRG", "TRG", "TRN", "ARM", "ARZ", "CSM", "CSV", "opt", "par",
NULL}; NULL};
const char *sup_files[] = {"xtrabackup_binlog_info", const char *sup_files[] = {MB_BINLOG_INFO,
"xtrabackup_galera_info", MB_GALERA_INFO,
"xtrabackup_slave_info", MB_SLAVE_INFO,
"xtrabackup_info", MB_INFO,
XTRABACKUP_BINLOG_INFO,
XTRABACKUP_GALERA_INFO,
XTRABACKUP_SLAVE_INFO,
XTRABACKUP_INFO,
"ib_lru_dump", "ib_lru_dump",
NULL}; NULL};
datadir_iter_t *it = NULL; datadir_iter_t *it = NULL;
@@ -1894,8 +1898,12 @@ copy_back()
while (datadir_iter_next(it, &node)) { while (datadir_iter_next(it, &node)) {
const char *ext_list[] = {"backup-my.cnf", const char *ext_list[] = {"backup-my.cnf",
"xtrabackup_binary", "xtrabackup_binlog_info", "xtrabackup_binary",
"xtrabackup_checkpoints", ".qp", ".pmap", ".tmp", MB_BINLOG_INFO,
MB_METADATA_FILENAME,
XTRABACKUP_BINLOG_INFO,
XTRABACKUP_METADATA_FILENAME,
".qp", ".pmap", ".tmp",
NULL}; NULL};
const char *filename; const char *filename;
char c_tmp; char c_tmp;

View File

@@ -6,11 +6,19 @@
#include <mysql.h> #include <mysql.h>
#include "datasink.h" #include "datasink.h"
/* special files */ /* special files, backward compatibility */
#define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info" #define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info"
#define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info" #define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info"
#define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_info" #define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_info"
#define XTRABACKUP_INFO "xtrabackup_info" #define XTRABACKUP_INFO "xtrabackup_info"
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
/* special files */
#define MB_SLAVE_INFO "mariadb_backup_slave_info"
#define MB_GALERA_INFO "mariadb_backup_galera_info"
#define MB_BINLOG_INFO "mariadb_backup_binlog_info"
#define MB_INFO "mariadb_backup_info"
#define MB_METADATA_FILENAME "mariadb_backup_checkpoints"
extern bool binlog_locked; extern bool binlog_locked;

View File

@@ -1339,7 +1339,7 @@ write_slave_info(MYSQL *connection)
} }
mysql_slave_position= strdup(comment.c_ptr()); mysql_slave_position= strdup(comment.c_ptr());
return backup_file_print_buf(XTRABACKUP_SLAVE_INFO, sql.ptr(), sql.length()); return backup_file_print_buf(MB_SLAVE_INFO, sql.ptr(), sql.length());
} }
@@ -1362,7 +1362,7 @@ write_galera_info(MYSQL *connection)
}; };
/* When backup locks are supported by the server, we should skip /* When backup locks are supported by the server, we should skip
creating xtrabackup_galera_info file on the backup stage, because creating MB_GALERA_INFO file on the backup stage, because
wsrep_local_state_uuid and wsrep_last_committed will be inconsistent wsrep_local_state_uuid and wsrep_last_committed will be inconsistent
without blocking commits. The state file will be created on the prepare without blocking commits. The state file will be created on the prepare
stage using the WSREP recovery procedure. */ stage using the WSREP recovery procedure. */
@@ -1379,7 +1379,7 @@ write_galera_info(MYSQL *connection)
goto cleanup; goto cleanup;
} }
result = backup_file_printf(XTRABACKUP_GALERA_INFO, result = backup_file_printf(MB_GALERA_INFO,
"%s:%s\n", state_uuid ? state_uuid : state_uuid55, "%s:%s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55); last_committed ? last_committed : last_committed55);
if (result) if (result)
@@ -1513,7 +1513,7 @@ write_binlog_info(MYSQL *connection)
read_mysql_variables(connection, "SHOW VARIABLES", vars, true); read_mysql_variables(connection, "SHOW VARIABLES", vars, true);
if (filename == NULL || position == NULL) { if (filename == NULL || position == NULL) {
/* Do not create xtrabackup_binlog_info if binary /* Do not create MB_BINLOG_INFO if binary
log is disabled */ log is disabled */
result = true; result = true;
goto cleanup; goto cleanup;
@@ -1529,14 +1529,14 @@ write_binlog_info(MYSQL *connection)
"filename '%s', position '%s', " "filename '%s', position '%s', "
"GTID of the last change '%s'", "GTID of the last change '%s'",
filename, position, gtid) != -1); filename, position, gtid) != -1);
result = backup_file_printf(XTRABACKUP_BINLOG_INFO, result = backup_file_printf(MB_BINLOG_INFO,
"%s\t%s\t%s\n", filename, position, "%s\t%s\t%s\n", filename, position,
gtid); gtid);
} else { } else {
ut_a(asprintf(&mysql_binlog_position, ut_a(asprintf(&mysql_binlog_position,
"filename '%s', position '%s'", "filename '%s', position '%s'",
filename, position) != -1); filename, position) != -1);
result = backup_file_printf(XTRABACKUP_BINLOG_INFO, result = backup_file_printf(MB_BINLOG_INFO,
"%s\t%s\n", filename, position); "%s\t%s\n", filename, position);
} }
@@ -1571,7 +1571,7 @@ operator<<(std::ostream& s, const escape_and_quote& eq)
} }
/*********************************************************************//** /*********************************************************************//**
Writes xtrabackup_info file and if backup_history is enable creates Writes MB_INFO file and if backup_history is enable creates
mysql.mariabackup_history and writes a new history record to the mysql.mariabackup_history and writes a new history record to the
table containing all the history info particular to the just completed table containing all the history info particular to the just completed
backup. */ backup. */
@@ -1647,7 +1647,7 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
xb_stream_name[xtrabackup_stream_fmt], /* format */ xb_stream_name[xtrabackup_stream_fmt], /* format */
xtrabackup_compress ? "compressed" : "N"); /* compressed */ xtrabackup_compress ? "compressed" : "N"); /* compressed */
if (buf_len < 0) { if (buf_len < 0) {
msg("Error: cannot generate xtrabackup_info"); msg("Error: cannot generate " MB_INFO);
result = false; result = false;
goto cleanup; goto cleanup;
} }

View File

@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#define BACKUP_WSREP_H #define BACKUP_WSREP_H
/*********************************************************************** /***********************************************************************
Store Galera checkpoint info in the 'xtrabackup_galera_info' file, if that Store Galera checkpoint info in the MB_GALERA_INFO file, if that
information is present in the trx system header. Otherwise, do nothing. */ information is present in the trx system header. Otherwise, do nothing. */
void void
xb_write_galera_info(bool incremental_prepare); xb_write_galera_info(bool incremental_prepare);

View File

@@ -242,7 +242,7 @@ static struct my_option ibx_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"galera-info", OPT_GALERA_INFO, "This options creates the " {"galera-info", OPT_GALERA_INFO, "This options creates the "
"xtrabackup_galera_info file which contains the local node state at " MB_GALERA_INFO " file which contains the local node state at "
"the time of the backup. Option should be used when performing the " "the time of the backup. Option should be used when performing the "
"backup of MariaDB Galera Cluster. Has no effect when backup locks " "backup of MariaDB Galera Cluster. Has no effect when backup locks "
"are used to create the backup.", "are used to create the backup.",
@@ -252,10 +252,10 @@ static struct my_option ibx_long_options[] =
{"slave-info", OPT_SLAVE_INFO, "This option is useful when backing " {"slave-info", OPT_SLAVE_INFO, "This option is useful when backing "
"up a replication slave server. It prints the binary log position " "up a replication slave server. It prints the binary log position "
"and name of the master server. It also writes this information to " "and name of the master server. It also writes this information to "
"the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. " "the \"" MB_SLAVE_INFO "\" file as a \"CHANGE MASTER\" command. "
"A new slave for this master can be set up by starting a slave server " "A new slave for this master can be set up by starting a slave server "
"on this backup and issuing a \"CHANGE MASTER\" command with the " "on this backup and issuing a \"CHANGE MASTER\" command with the "
"binary log position saved in the \"xtrabackup_slave_info\" file.", "binary log position saved in the \"" MB_SLAVE_INFO "\" file.",
(uchar *) &opt_ibx_slave_info, (uchar *) &opt_ibx_slave_info, 0, (uchar *) &opt_ibx_slave_info, (uchar *) &opt_ibx_slave_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -518,7 +518,7 @@ static struct my_option ibx_long_options[] =
{"extra-lsndir", OPT_EXTRA_LSNDIR, "This option specifies the " {"extra-lsndir", OPT_EXTRA_LSNDIR, "This option specifies the "
"directory in which to save an extra copy of the " "directory in which to save an extra copy of the "
"\"xtrabackup_checkpoints\" file. The option accepts a string " "\"" MB_METADATA_FILENAME "\" file. The option accepts a string "
"argument.", "argument.",
(uchar*) &ibx_xtrabackup_extra_lsndir, (uchar*) &ibx_xtrabackup_extra_lsndir,
(uchar*) &ibx_xtrabackup_extra_lsndir, (uchar*) &ibx_xtrabackup_extra_lsndir,

View File

@@ -53,9 +53,10 @@ permission notice:
/*! Name of file where Galera info is stored on recovery */ /*! Name of file where Galera info is stored on recovery */
#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info" #define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
#define MB_GALERA_INFO_FILENAME "mariadb_backup_galera_info"
/*********************************************************************** /***********************************************************************
Store Galera checkpoint info in the 'xtrabackup_galera_info' file, if that Store Galera checkpoint info in the MB_GALERA_INFO_FILENAME file, if that
information is present in the trx system header. Otherwise, do nothing. */ information is present in the trx system header. Otherwise, do nothing. */
void void
xb_write_galera_info(bool incremental_prepare) xb_write_galera_info(bool incremental_prepare)
@@ -70,7 +71,8 @@ xb_write_galera_info(bool incremental_prepare)
/* Do not overwrite existing an existing file to be compatible with /* Do not overwrite existing an existing file to be compatible with
servers with older server versions */ servers with older server versions */
if (!incremental_prepare && if (!incremental_prepare &&
my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL) { (my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL ||
my_stat(MB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL)) {
return; return;
} }
@@ -89,11 +91,11 @@ xb_write_galera_info(bool incremental_prepare)
return; return;
} }
fp = fopen(XB_GALERA_INFO_FILENAME, "w"); fp = fopen(MB_GALERA_INFO_FILENAME, "w");
if (fp == NULL) { if (fp == NULL) {
die( die(
"could not create " XB_GALERA_INFO_FILENAME "could not create " MB_GALERA_INFO_FILENAME
", errno = %d\n", ", errno = %d\n",
errno); errno);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@@ -107,7 +109,7 @@ xb_write_galera_info(bool incremental_prepare)
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) { if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
die( die(
"could not write to " XB_GALERA_INFO_FILENAME "could not write to " MB_GALERA_INFO_FILENAME
", errno = %d\n", ", errno = %d\n",
errno);; errno);;
} }

View File

@@ -120,7 +120,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
int sys_var_init(); int sys_var_init();
/* === xtrabackup specific options === */ /* === xtrabackup specific options === */
char xtrabackup_real_target_dir[FN_REFLEN] = "./xtrabackup_backupfiles/"; char xtrabackup_real_target_dir[FN_REFLEN] = "./mariadb_backup_files/";
char *xtrabackup_target_dir= xtrabackup_real_target_dir; char *xtrabackup_target_dir= xtrabackup_real_target_dir;
static my_bool xtrabackup_version; static my_bool xtrabackup_version;
static my_bool verbose; static my_bool verbose;
@@ -217,7 +217,6 @@ my_bool opt_extended_validation;
my_bool opt_encrypted_backup; my_bool opt_encrypted_backup;
/* === metadata of backup === */ /* === metadata of backup === */
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/ char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/
static lsn_t metadata_from_lsn; static lsn_t metadata_from_lsn;
lsn_t metadata_to_lsn; lsn_t metadata_to_lsn;
@@ -1129,8 +1128,8 @@ struct my_option xb_client_options[]= {
(G_PTR *) &xtrabackup_log_copy_interval, 0, GET_LONG, REQUIRED_ARG, 1000, (G_PTR *) &xtrabackup_log_copy_interval, 0, GET_LONG, REQUIRED_ARG, 1000,
0, LONG_MAX, 0, 1, 0}, 0, LONG_MAX, 0, 1, 0},
{"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR, {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR,
"(for --backup): save an extra copy of the xtrabackup_checkpoints file " "(for --backup): save an extra copy of the " MB_METADATA_FILENAME
"in this directory.", " file in this directory.",
(G_PTR *) &xtrabackup_extra_lsndir, (G_PTR *) &xtrabackup_extra_lsndir, 0, (G_PTR *) &xtrabackup_extra_lsndir, (G_PTR *) &xtrabackup_extra_lsndir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"incremental-lsn", OPT_XTRA_INCREMENTAL, {"incremental-lsn", OPT_XTRA_INCREMENTAL,
@@ -1244,7 +1243,7 @@ struct my_option xb_client_options[]= {
{"galera-info", OPT_GALERA_INFO, {"galera-info", OPT_GALERA_INFO,
"This options creates the " "This options creates the "
"xtrabackup_galera_info file which contains the local node state at " MB_GALERA_INFO " file which contains the local node state at "
"the time of the backup. Option should be used when performing the " "the time of the backup. Option should be used when performing the "
"backup of MariaDB Galera Cluster. Has no effect when backup locks " "backup of MariaDB Galera Cluster. Has no effect when backup locks "
"are used to create the backup.", "are used to create the backup.",
@@ -1255,10 +1254,10 @@ struct my_option xb_client_options[]= {
"This option is useful when backing " "This option is useful when backing "
"up a replication slave server. It prints the binary log position " "up a replication slave server. It prints the binary log position "
"and name of the master server. It also writes this information to " "and name of the master server. It also writes this information to "
"the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. " "the \"" MB_SLAVE_INFO "\" file as a \"CHANGE MASTER\" command. "
"A new slave for this master can be set up by starting a slave server " "A new slave for this master can be set up by starting a slave server "
"on this backup and issuing a \"CHANGE MASTER\" command with the " "on this backup and issuing a \"CHANGE MASTER\" command with the "
"binary log position saved in the \"xtrabackup_slave_info\" file.", "binary log position saved in the \"" MB_SLAVE_INFO "\" file.",
(uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, GET_BOOL, NO_ARG, (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
@@ -2373,6 +2372,37 @@ end:
return(r); return(r);
} }
/*
Read backup meta info.
@return TRUE on success, FALSE on failure. */
static
my_bool
mb_read_metadata(const char *dir, const char *name)
{
char filename[FN_REFLEN];
snprintf(filename, sizeof(filename), "%s/%s", dir, name);
if (!xtrabackup_read_metadata(filename)) {
msg("mariabackup: error: failed to read metadata from "
"%s", filename);
return false;
}
return true;
}
/*
Read backup meta info from the given directory
with backward compatibility. */
static
my_bool
mb_read_metadata_from_dir(const char *dir)
{
return mb_read_metadata(dir, MB_METADATA_FILENAME) ||
mb_read_metadata(dir, XTRABACKUP_METADATA_FILENAME);
}
/*********************************************************************** /***********************************************************************
Print backup meta info to a specified buffer. */ Print backup meta info to a specified buffer. */
static static
@@ -2412,9 +2442,12 @@ xtrabackup_stream_metadata(ds_ctxt_t *ds_ctxt)
mystat.st_size = len; mystat.st_size = len;
mystat.st_mtime = my_time(0); mystat.st_mtime = my_time(0);
stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat); stream = ds_open(ds_ctxt, MB_METADATA_FILENAME, &mystat);
if (stream == NULL) { if (stream == NULL) {
msg("Error: cannot open output stream for %s", XTRABACKUP_METADATA_FILENAME); stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat);
}
if (stream == NULL) {
msg("Error: cannot open output stream for %s", MB_METADATA_FILENAME);
return(FALSE); return(FALSE);
} }
@@ -4451,14 +4484,14 @@ static bool xtrabackup_backup_low()
char filename[FN_REFLEN]; char filename[FN_REFLEN];
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
XTRABACKUP_METADATA_FILENAME); MB_METADATA_FILENAME);
if (!xtrabackup_write_metadata(filename)) { if (!xtrabackup_write_metadata(filename)) {
msg("Error: failed to write metadata " msg("Error: failed to write metadata "
"to '%s'.", filename); "to '%s'.", filename);
return false; return false;
} }
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, sprintf(filename, "%s/%s", xtrabackup_extra_lsndir,
XTRABACKUP_INFO); MB_INFO);
if (!write_xtrabackup_info(mysql_connection, filename, false, false)) { if (!write_xtrabackup_info(mysql_connection, filename, false, false)) {
msg("Error: failed to write info " msg("Error: failed to write info "
"to '%s'.", filename); "to '%s'.", filename);
@@ -5823,7 +5856,6 @@ static ibool prepare_handle_del_files(const char *datadir, const char *db, const
static bool xtrabackup_prepare_func(char** argv) static bool xtrabackup_prepare_func(char** argv)
{ {
CorruptedPages corrupted_pages; CorruptedPages corrupted_pages;
char metadata_path[FN_REFLEN];
/* cd to target-dir */ /* cd to target-dir */
@@ -5874,12 +5906,7 @@ static bool xtrabackup_prepare_func(char** argv)
/* /*
read metadata of target read metadata of target
*/ */
sprintf(metadata_path, "%s/%s", xtrabackup_target_dir, if (!mb_read_metadata_from_dir(xtrabackup_target_dir)) {
XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_read_metadata(metadata_path)) {
msg("Error: failed to read metadata from '%s'\n",
metadata_path);
return(false); return(false);
} }
@@ -6038,14 +6065,14 @@ error:
metadata_last_lsn = incremental_last_lsn; metadata_last_lsn = incremental_last_lsn;
} }
sprintf(filename, "%s/%s", xtrabackup_target_dir, XTRABACKUP_METADATA_FILENAME); sprintf(filename, "%s/%s", xtrabackup_target_dir, MB_METADATA_FILENAME);
if (!xtrabackup_write_metadata(filename)) { if (!xtrabackup_write_metadata(filename)) {
msg("mariabackup: Error: failed to write metadata " msg("mariabackup: Error: failed to write metadata "
"to '%s'", filename); "to '%s'", filename);
ok = false; ok = false;
} else if (xtrabackup_extra_lsndir) { } else if (xtrabackup_extra_lsndir) {
sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, MB_METADATA_FILENAME);
if (!xtrabackup_write_metadata(filename)) { if (!xtrabackup_write_metadata(filename)) {
msg("mariabackup: Error: failed to write " msg("mariabackup: Error: failed to write "
"metadata to '%s'", filename); "metadata to '%s'", filename);
@@ -6802,26 +6829,14 @@ static int main_low(char** argv)
return(EXIT_FAILURE); return(EXIT_FAILURE);
} }
} else if (xtrabackup_backup && xtrabackup_incremental_basedir) { } else if (xtrabackup_backup && xtrabackup_incremental_basedir) {
char filename[FN_REFLEN]; if (!mb_read_metadata_from_dir(xtrabackup_incremental_basedir)) {
sprintf(filename, "%s/%s", xtrabackup_incremental_basedir, XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_read_metadata(filename)) {
msg("mariabackup: error: failed to read metadata from "
"%s", filename);
return(EXIT_FAILURE); return(EXIT_FAILURE);
} }
incremental_lsn = metadata_to_lsn; incremental_lsn = metadata_to_lsn;
xtrabackup_incremental = xtrabackup_incremental_basedir; //dummy xtrabackup_incremental = xtrabackup_incremental_basedir; //dummy
} else if (xtrabackup_prepare && xtrabackup_incremental_dir) { } else if (xtrabackup_prepare && xtrabackup_incremental_dir) {
char filename[FN_REFLEN]; if (!mb_read_metadata_from_dir(xtrabackup_incremental_dir)) {
sprintf(filename, "%s/%s", xtrabackup_incremental_dir, XTRABACKUP_METADATA_FILENAME);
if (!xtrabackup_read_metadata(filename)) {
msg("mariabackup: error: failed to read metadata from "
"%s", filename);
return(EXIT_FAILURE); return(EXIT_FAILURE);
} }

View File

@@ -0,0 +1,21 @@
call mtr.add_suppression("InnoDB: New log files created");
#
# Start of 10.11 tests
#
#
# MDEV-18931 Rename Mariabackup's xtrabackup_* files to mariadb_backup_*
#
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE MYISAM;
INSERT INTO t1 VALUES (1);
# Prepare full backup, apply incremental one
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT * FROM test.t1;
i
1
DROP TABLE t1;
#
# End of 10.11 tests
#

View File

@@ -0,0 +1,62 @@
call mtr.add_suppression("InnoDB: New log files created");
--echo #
--echo # Start of 10.11 tests
--echo #
--echo #
--echo # MDEV-18931 Rename Mariabackup's xtrabackup_* files to mariadb_backup_*
--echo #
--let $basedir=$MYSQLTEST_VARDIR/tmp/backup
--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE MYISAM;
INSERT INTO t1 VALUES (1);
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir
--enable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir
#
# Emulate a backup created by an older version:
# Rename mariadb_backup_checkpoints
#
--move_file $basedir/mariadb_backup_checkpoints $basedir/xtrabackup_checkpoints
--move_file $incremental_dir/mariadb_backup_checkpoints $incremental_dir/xtrabackup_checkpoints
#
# Emulate a backup created by an older version:
# Rename mariadb_backup_info
# Note, mariadb_backup_info is not currently used during --prepare or --restore
# But it's still good to rename it:
# - we can start using it during --prepare or --restore
# - to provide full emulation
#
--move_file $basedir/mariadb_backup_info $basedir/mariadb_backup_info
--move_file $incremental_dir/mariadb_backup_info $incremental_dir/mariadb_backup_info
--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
SELECT * FROM test.t1;
DROP TABLE t1;
--rmdir $basedir
--rmdir $incremental_dir
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -1,2 +1,2 @@
xtrabackup_checkpoints mariadb_backup_checkpoints
xtrabackup_info mariadb_backup_info

View File

@@ -1,2 +1,2 @@
xtrabackup_checkpoints mariadb_backup_checkpoints
xtrabackup_info mariadb_backup_info

View File

@@ -1,8 +1,8 @@
--disable_query_log --disable_query_log
--file_exists $targetdir/xtrabackup_slave_info --file_exists $targetdir/mariadb_backup_slave_info
CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT); CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT);
--replace_result $targetdir TARGETDIR --replace_result $targetdir TARGETDIR
--eval LOAD DATA LOCAL INFILE '$targetdir/xtrabackup_slave_info' INTO TABLE tmp_slave_info (line); --eval LOAD DATA LOCAL INFILE '$targetdir/mariadb_backup_slave_info' INTO TABLE tmp_slave_info (line);
SELECT SELECT
lineno, lineno,
regexp_replace( regexp_replace(

View File

@@ -11,8 +11,8 @@ connection master;
CREATE TABLE t(i INT); CREATE TABLE t(i INT);
connection slave; connection slave;
"using_gtid: Slave_Pos" "using_gtid: Slave_Pos"
FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info FOUND 1 /gtid_slave_pos/ in mariadb_backup_slave_info
NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info NOT FOUND /MASTER_LOG_FILE/ in mariadb_backup_slave_info
lineno line lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>'; 1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>';
2 CHANGE MASTER TO master_use_gtid = slave_pos; 2 CHANGE MASTER TO master_use_gtid = slave_pos;
@@ -21,8 +21,8 @@ lineno line
######################## ########################
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL gtid_slave_pos=""; SET GLOBAL gtid_slave_pos="";
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info NOT FOUND /gtid_slave_pos/ in mariadb_backup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info FOUND 1 /MASTER_LOG_FILE/ in mariadb_backup_slave_info
lineno line lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>; 1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
############### ###############
@@ -34,8 +34,8 @@ connection master;
INSERT INTO t VALUES(1); INSERT INTO t VALUES(1);
connection slave; connection slave;
"using_gtid: No" "using_gtid: No"
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info NOT FOUND /gtid_slave_pos/ in mariadb_backup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info FOUND 1 /MASTER_LOG_FILE/ in mariadb_backup_slave_info
lineno line lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>; 1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
connection master; connection master;

View File

@@ -22,7 +22,7 @@ CREATE TABLE t(i INT);
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
--enable_result_log --enable_result_log
--let SEARCH_FILE=$targetdir/xtrabackup_slave_info --let SEARCH_FILE=$targetdir/mariadb_backup_slave_info
--let SEARCH_PATTERN=gtid_slave_pos --let SEARCH_PATTERN=gtid_slave_pos
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE --let SEARCH_PATTERN=MASTER_LOG_FILE
@@ -45,7 +45,7 @@ SET GLOBAL gtid_slave_pos="";
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
--enable_result_log --enable_result_log
--let SEARCH_FILE=$targetdir/xtrabackup_slave_info --let SEARCH_FILE=$targetdir/mariadb_backup_slave_info
--let SEARCH_PATTERN=gtid_slave_pos --let SEARCH_PATTERN=gtid_slave_pos
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE --let SEARCH_PATTERN=MASTER_LOG_FILE
@@ -73,7 +73,7 @@ INSERT INTO t VALUES(1);
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
--enable_result_log --enable_result_log
--let SEARCH_FILE=$targetdir/xtrabackup_slave_info --let SEARCH_FILE=$targetdir/mariadb_backup_slave_info
--let SEARCH_PATTERN=gtid_slave_pos --let SEARCH_PATTERN=gtid_slave_pos
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE --let SEARCH_PATTERN=MASTER_LOG_FILE

View File

@@ -8,7 +8,7 @@ SELECT @@global.gtid_slave_pos;
@@global.gtid_slave_pos @@global.gtid_slave_pos
# Without any masters the file xtrabackup_slave_info is not created # Without any masters the file mariadb_backup_slave_info is not created
line line
[00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option [00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option

View File

@@ -19,13 +19,13 @@
SELECT @@global.gtid_slave_pos; SELECT @@global.gtid_slave_pos;
--echo --echo
--echo # Without any masters the file xtrabackup_slave_info is not created --echo # Without any masters the file mariadb_backup_slave_info is not created
--disable_result_log --disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT; exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log --enable_result_log
--error 1 --error 1
--file_exists $targetdir/xtrabackup_slave_info --file_exists $targetdir/mariadb_backup_slave_info
--source include/show_xtrabackup_slave_info_out.inc --source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT --remove_file $XTRABACKUP_OUT
rmdir $targetdir; rmdir $targetdir;

View File

@@ -102,7 +102,7 @@ if [ -z "$BACKUP_BIN" ]; then
fi fi
DATA="$WSREP_SST_OPT_DATA" DATA="$WSREP_SST_OPT_DATA"
INFO_FILE='xtrabackup_galera_info' INFO_FILE='mariadb_backup_galera_info'
IST_FILE='xtrabackup_ist' IST_FILE='xtrabackup_ist'
MAGIC_FILE="$DATA/$INFO_FILE" MAGIC_FILE="$DATA/$INFO_FILE"
@@ -1317,9 +1317,9 @@ else # joiner
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE"
# May need xtrabackup_checkpoints later on # May need mariadb_backup_checkpoints later on
[ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary"
[ -f "$DATA/xtrabackup_galera_info" ] && rm -f "$DATA/xtrabackup_galera_info" [ -f "$DATA/mariadb_backup_galera_info" ] && rm -f "$DATA/mariadb_backup_galera_info"
ADDR="$WSREP_SST_OPT_HOST" ADDR="$WSREP_SST_OPT_HOST"
@@ -1448,14 +1448,14 @@ else # joiner
wsrep_log_info "Waiting for SST streaming to complete!" wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid monitor_process $jpid
if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then if [ ! -s "$DATA/mariadb_backup_checkpoints" ]; then
wsrep_log_error "xtrabackup_checkpoints missing," \ wsrep_log_error "mariadb_backup_checkpoints missing," \
"failed mariabackup/SST on donor" "failed mariabackup/SST on donor"
exit 2 exit 2
fi fi
# Compact backups are not supported by mariabackup # Compact backups are not supported by mariabackup
if grep -qw -F 'compact = 1' "$DATA/xtrabackup_checkpoints"; then if grep -qw -F 'compact = 1' "$DATA/mariadb_backup_checkpoints"; then
wsrep_log_info "Index compaction detected" wsrep_log_info "Index compaction detected"
wsrel_log_error "Compact backups are not supported by mariabackup" wsrel_log_error "Compact backups are not supported by mariabackup"
exit 2 exit 2
@@ -1519,14 +1519,14 @@ else # joiner
if [ -n "$WSREP_SST_OPT_BINLOG" ]; then if [ -n "$WSREP_SST_OPT_BINLOG" ]; then
cd "$DATA" cd "$DATA"
binlogs="" binlogs=""
if [ -f 'xtrabackup_binlog_info' ]; then if [ -f 'mariadb_backup_binlog_info' ]; then
NL=$'\n' NL=$'\n'
while read bin_string || [ -n "$bin_string" ]; do while read bin_string || [ -n "$bin_string" ]; do
bin_file=$(echo "$bin_string" | cut -f1) bin_file=$(echo "$bin_string" | cut -f1)
if [ -f "$bin_file" ]; then if [ -f "$bin_file" ]; then
binlogs="$binlogs${binlogs:+$NL}$bin_file" binlogs="$binlogs${binlogs:+$NL}$bin_file"
fi fi
done < 'xtrabackup_binlog_info' done < 'mariadb_backup_binlog_info'
else else
binlogs=$(ls -d -1 "$binlog_base".[0-9]* 2>/dev/null || :) binlogs=$(ls -d -1 "$binlog_base".[0-9]* 2>/dev/null || :)
fi fi