diff options
Diffstat (limited to 'extra/mariabackup/backup_copy.cc')
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 83 |
1 files changed, 18 insertions, 65 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 49dd716f15f..047b47a11c0 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) { @@ -1482,14 +1483,14 @@ bool backup_start(CorruptedPages &corrupted_pages) if (!write_galera_info(mysql_connection)) { return(false); } + // copied from xtrabackup. what is it needed for here? + 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) { @@ -1525,33 +1526,13 @@ 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 (!opt_rsync && opt_galera_info) { if (buffer_pool_filename && file_exists(buffer_pool_filename)) { - const char *dst_name = get_buffer_pool_filename(NULL); - copy_file(ds_data, buffer_pool_filename, dst_name, 0); + copy_file(ds_data, buffer_pool_filename, default_buffer_pool_file, 0); } if (file_exists("ib_lru_dump")) { copy_file(ds_data, "ib_lru_dump", "ib_lru_dump", 0); @@ -1601,6 +1582,7 @@ ibx_copy_incremental_over_full() char path[FN_REFLEN]; int i; + DBUG_ASSERT(!opt_galera_info); datadir_node_init(&node); /* If we were applying an incremental change set, we need to make @@ -1637,19 +1619,6 @@ ibx_copy_incremental_over_full() if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir))) goto cleanup; - /* copy buffer pool dump */ - if (innobase_buffer_pool_filename) { - const char *src_name = get_buffer_pool_filename(NULL); - - snprintf(path, sizeof(path), "%s/%s", - xtrabackup_incremental_dir, - src_name); - - if (file_exists(path)) { - copy_file(ds_data, path, src_name, 0); - } - } - /* copy supplementary files */ for (i = 0; sup_files[i]; i++) { @@ -1878,14 +1847,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", @@ -1947,10 +1908,10 @@ copy_back() continue; } - /* skip buffer pool dump */ - if (!strcmp(filename, src_buffer_pool)) { - continue; - } + /* skip buffer pool dump */ + if (!strcmp(filename, default_buffer_pool_file)) { + continue; + } /* skip innodb data files */ for (Tablespace::const_iterator iter(srv_sys_space.begin()), @@ -1970,19 +1931,11 @@ 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 (file_exists(default_buffer_pool_file) && + innobase_buffer_pool_filename) { + copy_or_move_file(default_buffer_pool_file, + innobase_buffer_pool_filename, + mysql_data_home, 0); } rocksdb_copy_back(); |