Skip to content

Commit

Permalink
Merge branch '10.3' into 10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Aug 2, 2022
2 parents 1ea5e40 + 5ac528a commit 48e35b8
Show file tree
Hide file tree
Showing 67 changed files with 506 additions and 635 deletions.
83 changes: 18 additions & 65 deletions extra/mariabackup/backup_copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,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)
{
Expand Down Expand Up @@ -1539,14 +1540,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) {
Expand Down Expand Up @@ -1582,33 +1583,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);
Expand Down Expand Up @@ -1658,6 +1639,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
Expand Down Expand Up @@ -1694,19 +1676,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++) {
Expand Down Expand Up @@ -1938,14 +1907,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",
Expand Down Expand Up @@ -2008,10 +1969,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 */
is_ibdata_file = false;
Expand All @@ -2035,19 +1996,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();
Expand Down
7 changes: 0 additions & 7 deletions extra/mariabackup/backup_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ copy_file(ds_ctxt_t *datasink,
const char *dst_file_path,
uint thread_n);

/************************************************************************
Check to see if a file exists.
Takes name of the file to check.
@return true if file exists. */
bool
file_exists(const char *filename);

/** Start --backup */
bool backup_start(CorruptedPages &corrupted_pages);
/** Release resources after backup_start() */
Expand Down
Loading

0 comments on commit 48e35b8

Please sign in to comment.