Skip to content
Permalink
Browse files
revert mariabackup part of MDEV-27524, fix the test
  • Loading branch information
vuvova authored and sysprg committed Aug 1, 2022
1 parent 6a3fbfd commit 5197519
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 354 deletions.
@@ -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);
}
}

@@ -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() */

0 comments on commit 5197519

Please sign in to comment.