Skip to content

Commit 6daf8f8

Browse files
committed
Merge 10.5 into 10.6
2 parents 06eaca9 + b791b94 commit 6daf8f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1432
-598
lines changed

extra/mariabackup/backup_copy.cc

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,6 @@ datafile_read(datafile_cur_t *cursor)
580580
Check to see if a file exists.
581581
Takes name of the file to check.
582582
@return true if file exists. */
583-
static
584583
bool
585584
file_exists(const char *filename)
586585
{
@@ -1475,13 +1474,14 @@ bool backup_start(CorruptedPages &corrupted_pages)
14751474
if (!write_galera_info(mysql_connection)) {
14761475
return(false);
14771476
}
1478-
write_current_binlog_file(mysql_connection);
14791477
}
14801478

1481-
if (opt_binlog_info == BINLOG_INFO_ON) {
1479+
bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
14821480

1483-
lock_binlog_maybe(mysql_connection);
1484-
write_binlog_info(mysql_connection);
1481+
if (with_binlogs || opt_galera_info) {
1482+
if (!write_current_binlog_file(mysql_connection, with_binlogs)) {
1483+
return(false);
1484+
}
14851485
}
14861486

14871487
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1515,15 +1515,34 @@ void backup_release()
15151515
}
15161516
}
15171517

1518+
static const char *default_buffer_pool_file = "ib_buffer_pool";
1519+
1520+
static
1521+
const char * get_buffer_pool_filename(size_t *length)
1522+
{
1523+
/* If mariabackup is run for Galera, then the file
1524+
name is changed to the default so that the receiving
1525+
node can find this file and rename it according to its
1526+
settings, otherwise we keep the original file name: */
1527+
size_t dir_length = 0;
1528+
const char *dst_name = default_buffer_pool_file;
1529+
if (!opt_galera_info) {
1530+
dir_length = dirname_length(buffer_pool_filename);
1531+
dst_name = buffer_pool_filename + dir_length;
1532+
}
1533+
if (length) {
1534+
*length=dir_length;
1535+
}
1536+
return dst_name;
1537+
}
1538+
15181539
/** Finish after backup_start() and backup_release() */
15191540
bool backup_finish()
15201541
{
15211542
/* Copy buffer pool dump or LRU dump */
15221543
if (!opt_rsync) {
15231544
if (buffer_pool_filename && file_exists(buffer_pool_filename)) {
1524-
const char *dst_name;
1525-
1526-
dst_name = trim_dotslash(buffer_pool_filename);
1545+
const char *dst_name = get_buffer_pool_filename(NULL);
15271546
copy_file(ds_data, buffer_pool_filename, dst_name, 0);
15281547
}
15291548
if (file_exists("ib_lru_dump")) {
@@ -1612,17 +1631,14 @@ ibx_copy_incremental_over_full()
16121631

16131632
/* copy buffer pool dump */
16141633
if (innobase_buffer_pool_filename) {
1615-
const char *src_name;
1616-
1617-
src_name = trim_dotslash(innobase_buffer_pool_filename);
1634+
const char *src_name = get_buffer_pool_filename(NULL);
16181635

16191636
snprintf(path, sizeof(path), "%s/%s",
16201637
xtrabackup_incremental_dir,
16211638
src_name);
16221639

16231640
if (file_exists(path)) {
1624-
copy_file(ds_data, path,
1625-
innobase_buffer_pool_filename, 0);
1641+
copy_file(ds_data, path, src_name, 0);
16261642
}
16271643
}
16281644

@@ -1869,6 +1885,14 @@ copy_back()
18691885

18701886
datadir_node_init(&node);
18711887

1888+
/* If mariabackup is run for Galera, then the file
1889+
name is changed to the default so that the receiving
1890+
node can find this file and rename it according to its
1891+
settings, otherwise we keep the original file name: */
1892+
size_t dir_length;
1893+
const char *src_buffer_pool;
1894+
src_buffer_pool = get_buffer_pool_filename(&dir_length);
1895+
18721896
while (datadir_iter_next(it, &node)) {
18731897
const char *ext_list[] = {"backup-my.cnf",
18741898
"xtrabackup_binary", "xtrabackup_binlog_info",
@@ -1930,6 +1954,11 @@ copy_back()
19301954
continue;
19311955
}
19321956

1957+
/* skip buffer pool dump */
1958+
if (!strcmp(filename, src_buffer_pool)) {
1959+
continue;
1960+
}
1961+
19331962
/* skip innodb data files */
19341963
for (Tablespace::const_iterator iter(srv_sys_space.begin()),
19351964
end(srv_sys_space.end()); iter != end; ++iter) {
@@ -1948,23 +1977,18 @@ copy_back()
19481977

19491978
/* copy buffer pool dump */
19501979

1951-
if (innobase_buffer_pool_filename) {
1952-
const char *src_name;
1953-
char path[FN_REFLEN];
1954-
1955-
src_name = trim_dotslash(innobase_buffer_pool_filename);
1956-
1957-
snprintf(path, sizeof(path), "%s/%s",
1958-
mysql_data_home,
1959-
src_name);
1960-
1961-
/* could be already copied with other files
1962-
from data directory */
1963-
if (file_exists(src_name) &&
1964-
!file_exists(innobase_buffer_pool_filename)) {
1965-
copy_or_move_file(src_name,
1966-
innobase_buffer_pool_filename,
1967-
mysql_data_home, 0);
1980+
if (file_exists(src_buffer_pool)) {
1981+
char dst_dir[FN_REFLEN];
1982+
while (IS_TRAILING_SLASH(buffer_pool_filename, dir_length)) {
1983+
dir_length--;
1984+
}
1985+
memcpy(dst_dir, buffer_pool_filename, dir_length);
1986+
dst_dir[dir_length] = 0;
1987+
if (!(ret = copy_or_move_file(src_buffer_pool,
1988+
src_buffer_pool,
1989+
dst_dir, 1)))
1990+
{
1991+
goto cleanup;
19681992
}
19691993
}
19701994

extra/mariabackup/backup_copy.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ copy_file(ds_ctxt_t *datasink,
3232
const char *dst_file_path,
3333
uint thread_n);
3434

35+
/************************************************************************
36+
Check to see if a file exists.
37+
Takes name of the file to check.
38+
@return true if file exists. */
39+
bool
40+
file_exists(const char *filename);
41+
3542
/** Start --backup */
3643
bool backup_start(CorruptedPages &corrupted_pages);
3744
/** Release resources after backup_start() */

0 commit comments

Comments
 (0)