summaryrefslogtreecommitdiff
path: root/extra/mariabackup/backup_copy.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-06-28 09:16:31 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2022-08-01 15:53:13 +0200
commit5197519f4f7b31c61e3abccf75650e5356aecd4c (patch)
tree3efc3394683cff0d41b6faa3edc403fc3a0ae358 /extra/mariabackup/backup_copy.cc
parent6a3fbfdb2d048a0a1b5762f8a56df35ba6986cf0 (diff)
downloadmariadb-git-5197519f4f7b31c61e3abccf75650e5356aecd4c.tar.gz
revert mariabackup part of MDEV-27524, fix the test
Diffstat (limited to 'extra/mariabackup/backup_copy.cc')
-rw-r--r--extra/mariabackup/backup_copy.cc84
1 files changed, 30 insertions, 54 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index c21f85d48b2..be41bffa744 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -581,6 +581,7 @@ datafile_read(datafile_cur_t *cursor)
Check to see if a file exists.
Takes name of the file to check.
@return true if file exists. */
+static
bool
file_exists(const char *filename)
{
@@ -1543,14 +1544,13 @@ bool backup_start(CorruptedPages &corrupted_pages)
if (!write_galera_info(mysql_connection)) {
return(false);
}
+ write_current_binlog_file(mysql_connection);
}
- bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
+ if (opt_binlog_info == BINLOG_INFO_ON) {
- if (with_binlogs || opt_galera_info) {
- if (!write_current_binlog_file(mysql_connection, with_binlogs)) {
- return(false);
- }
+ lock_binlog_maybe(mysql_connection);
+ write_binlog_info(mysql_connection);
}
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1584,34 +1584,15 @@ void backup_release()
}
}
-static const char *default_buffer_pool_file = "ib_buffer_pool";
-
-static
-const char * get_buffer_pool_filename(size_t *length)
-{
- /* If mariabackup is run for Galera, then the file
- name is changed to the default so that the receiving
- node can find this file and rename it according to its
- settings, otherwise we keep the original file name: */
- size_t dir_length = 0;
- const char *dst_name = default_buffer_pool_file;
- if (!opt_galera_info) {
- dir_length = dirname_length(buffer_pool_filename);
- dst_name = buffer_pool_filename + dir_length;
- }
- if (length) {
- *length=dir_length;
- }
- return dst_name;
-}
-
/** Finish after backup_start() and backup_release() */
bool backup_finish()
{
/* Copy buffer pool dump or LRU dump */
if (!opt_rsync) {
if (buffer_pool_filename && file_exists(buffer_pool_filename)) {
- const char *dst_name = get_buffer_pool_filename(NULL);
+ const char *dst_name;
+
+ dst_name = trim_dotslash(buffer_pool_filename);
copy_file(ds_data, buffer_pool_filename, dst_name, 0);
}
if (file_exists("ib_lru_dump")) {
@@ -1700,14 +1681,17 @@ ibx_copy_incremental_over_full()
/* copy buffer pool dump */
if (innobase_buffer_pool_filename) {
- const char *src_name = get_buffer_pool_filename(NULL);
+ const char *src_name;
+
+ src_name = trim_dotslash(innobase_buffer_pool_filename);
snprintf(path, sizeof(path), "%s/%s",
xtrabackup_incremental_dir,
src_name);
if (file_exists(path)) {
- copy_file(ds_data, path, src_name, 0);
+ copy_file(ds_data, path,
+ innobase_buffer_pool_filename, 0);
}
}
@@ -1942,14 +1926,6 @@ copy_back()
datadir_node_init(&node);
- /* If mariabackup is run for Galera, then the file
- name is changed to the default so that the receiving
- node can find this file and rename it according to its
- settings, otherwise we keep the original file name: */
- size_t dir_length;
- const char *src_buffer_pool;
- src_buffer_pool = get_buffer_pool_filename(&dir_length);
-
while (datadir_iter_next(it, &node)) {
const char *ext_list[] = {"backup-my.cnf",
"xtrabackup_binary", "xtrabackup_binlog_info",
@@ -2012,11 +1988,6 @@ copy_back()
continue;
}
- /* skip buffer pool dump */
- if (!strcmp(filename, src_buffer_pool)) {
- continue;
- }
-
/* skip innodb data files */
is_ibdata_file = false;
for (Tablespace::const_iterator iter(srv_sys_space.begin()),
@@ -2039,18 +2010,23 @@ copy_back()
/* copy buffer pool dump */
- if (file_exists(src_buffer_pool)) {
- char dst_dir[FN_REFLEN];
- while (IS_TRAILING_SLASH(buffer_pool_filename, dir_length)) {
- dir_length--;
- }
- memcpy(dst_dir, buffer_pool_filename, dir_length);
- dst_dir[dir_length] = 0;
- if (!(ret = copy_or_move_file(src_buffer_pool,
- src_buffer_pool,
- dst_dir, 1)))
- {
- goto cleanup;
+ if (innobase_buffer_pool_filename) {
+ const char *src_name;
+ char path[FN_REFLEN];
+
+ src_name = trim_dotslash(innobase_buffer_pool_filename);
+
+ snprintf(path, sizeof(path), "%s/%s",
+ mysql_data_home,
+ src_name);
+
+ /* could be already copied with other files
+ from data directory */
+ if (file_exists(src_name) &&
+ !file_exists(innobase_buffer_pool_filename)) {
+ copy_or_move_file(src_name,
+ innobase_buffer_pool_filename,
+ mysql_data_home, 0);
}
}