Skip to content

Commit

Permalink
MDEV-18931 Rename Mariabackup's xtrabackup_* files to mariadb_backup_*
Browse files Browse the repository at this point in the history
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
  • Loading branch information
abarkov authored and vuvova committed Mar 10, 2023
1 parent 4ae9733 commit b314f7b
Show file tree
Hide file tree
Showing 17 changed files with 202 additions and 86 deletions.
22 changes: 15 additions & 7 deletions extra/mariabackup/backup_copy.cc
Expand Up @@ -1557,7 +1557,7 @@ bool backup_finish()
return(false);
}

if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO,
if (!write_xtrabackup_info(mysql_connection, MB_INFO,
opt_history != 0, true)) {
return(false);
}
Expand Down Expand Up @@ -1613,10 +1613,14 @@ ibx_copy_incremental_over_full()
const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI",
"MRG", "TRG", "TRN", "ARM", "ARZ", "CSM", "CSV", "opt", "par",
NULL};
const char *sup_files[] = {"xtrabackup_binlog_info",
"xtrabackup_galera_info",
"xtrabackup_slave_info",
"xtrabackup_info",
const char *sup_files[] = {MB_BINLOG_INFO,
MB_GALERA_INFO,
MB_SLAVE_INFO,
MB_INFO,
XTRABACKUP_BINLOG_INFO,
XTRABACKUP_GALERA_INFO,
XTRABACKUP_SLAVE_INFO,
XTRABACKUP_INFO,
"ib_lru_dump",
NULL};
datadir_iter_t *it = NULL;
Expand Down Expand Up @@ -1894,8 +1898,12 @@ copy_back()

while (datadir_iter_next(it, &node)) {
const char *ext_list[] = {"backup-my.cnf",
"xtrabackup_binary", "xtrabackup_binlog_info",
"xtrabackup_checkpoints", ".qp", ".pmap", ".tmp",
"xtrabackup_binary",
MB_BINLOG_INFO,
MB_METADATA_FILENAME,
XTRABACKUP_BINLOG_INFO,
XTRABACKUP_METADATA_FILENAME,
".qp", ".pmap", ".tmp",
NULL};
const char *filename;
char c_tmp;
Expand Down
10 changes: 9 additions & 1 deletion extra/mariabackup/backup_copy.h
Expand Up @@ -6,11 +6,19 @@
#include <mysql.h>
#include "datasink.h"

/* special files */
/* special files, backward compatibility */
#define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info"
#define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info"
#define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_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;

Expand Down
16 changes: 8 additions & 8 deletions extra/mariabackup/backup_mysql.cc
Expand Up @@ -1339,7 +1339,7 @@ write_slave_info(MYSQL *connection)
}

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());
}


Expand All @@ -1362,7 +1362,7 @@ write_galera_info(MYSQL *connection)
};

/* 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
without blocking commits. The state file will be created on the prepare
stage using the WSREP recovery procedure. */
Expand All @@ -1379,7 +1379,7 @@ write_galera_info(MYSQL *connection)
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,
last_committed ? last_committed : last_committed55);
if (result)
Expand Down Expand Up @@ -1513,7 +1513,7 @@ write_binlog_info(MYSQL *connection)
read_mysql_variables(connection, "SHOW VARIABLES", vars, true);

if (filename == NULL || position == NULL) {
/* Do not create xtrabackup_binlog_info if binary
/* Do not create MB_BINLOG_INFO if binary
log is disabled */
result = true;
goto cleanup;
Expand All @@ -1529,14 +1529,14 @@ write_binlog_info(MYSQL *connection)
"filename '%s', position '%s', "
"GTID of the last change '%s'",
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,
gtid);
} else {
ut_a(asprintf(&mysql_binlog_position,
"filename '%s', position '%s'",
filename, position) != -1);
result = backup_file_printf(XTRABACKUP_BINLOG_INFO,
result = backup_file_printf(MB_BINLOG_INFO,
"%s\t%s\n", filename, position);
}

Expand Down Expand Up @@ -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
table containing all the history info particular to the just completed
backup. */
Expand Down Expand Up @@ -1647,7 +1647,7 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
xb_stream_name[xtrabackup_stream_fmt], /* format */
xtrabackup_compress ? "compressed" : "N"); /* compressed */
if (buf_len < 0) {
msg("Error: cannot generate xtrabackup_info");
msg("Error: cannot generate " MB_INFO);
result = false;
goto cleanup;
}
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/backup_wsrep.h
Expand Up @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#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. */
void
xb_write_galera_info(bool incremental_prepare);
Expand Down
8 changes: 4 additions & 4 deletions extra/mariabackup/innobackupex.cc
Expand Up @@ -242,7 +242,7 @@ static struct my_option ibx_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},

{"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 "
"backup of MariaDB Galera Cluster. Has no effect when backup locks "
"are used to create the backup.",
Expand All @@ -252,10 +252,10 @@ static struct my_option ibx_long_options[] =
{"slave-info", OPT_SLAVE_INFO, "This option is useful when backing "
"up a replication slave server. It prints the binary log position "
"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 "
"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,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},

Expand Down Expand Up @@ -518,7 +518,7 @@ static struct my_option ibx_long_options[] =

{"extra-lsndir", OPT_EXTRA_LSNDIR, "This option specifies 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.",
(uchar*) &ibx_xtrabackup_extra_lsndir,
(uchar*) &ibx_xtrabackup_extra_lsndir,
Expand Down
12 changes: 7 additions & 5 deletions extra/mariabackup/wsrep.cc
Expand Up @@ -53,9 +53,10 @@ permission notice:

/*! Name of file where Galera info is stored on recovery */
#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. */
void
xb_write_galera_info(bool incremental_prepare)
Expand All @@ -70,7 +71,8 @@ xb_write_galera_info(bool incremental_prepare)
/* Do not overwrite existing an existing file to be compatible with
servers with older server versions */
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;
}
Expand All @@ -89,11 +91,11 @@ xb_write_galera_info(bool incremental_prepare)
return;
}

fp = fopen(XB_GALERA_INFO_FILENAME, "w");
fp = fopen(MB_GALERA_INFO_FILENAME, "w");
if (fp == NULL) {

die(
"could not create " XB_GALERA_INFO_FILENAME
"could not create " MB_GALERA_INFO_FILENAME
", errno = %d\n",
errno);
exit(EXIT_FAILURE);
Expand All @@ -107,7 +109,7 @@ xb_write_galera_info(bool incremental_prepare)
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {

die(
"could not write to " XB_GALERA_INFO_FILENAME
"could not write to " MB_GALERA_INFO_FILENAME
", errno = %d\n",
errno);;
}
Expand Down

0 comments on commit b314f7b

Please sign in to comment.