@@ -580,7 +580,6 @@ datafile_read(datafile_cur_t *cursor)
580
580
Check to see if a file exists.
581
581
Takes name of the file to check.
582
582
@return true if file exists. */
583
- static
584
583
bool
585
584
file_exists (const char *filename)
586
585
{
@@ -1475,13 +1474,14 @@ bool backup_start(CorruptedPages &corrupted_pages)
1475
1474
if (!write_galera_info (mysql_connection)) {
1476
1475
return (false );
1477
1476
}
1478
- write_current_binlog_file (mysql_connection);
1479
1477
}
1480
1478
1481
- if ( opt_binlog_info == BINLOG_INFO_ON) {
1479
+ bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
1482
1480
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
+ }
1485
1485
}
1486
1486
1487
1487
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1515,15 +1515,34 @@ void backup_release()
1515
1515
}
1516
1516
}
1517
1517
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
+
1518
1539
/* * Finish after backup_start() and backup_release() */
1519
1540
bool backup_finish ()
1520
1541
{
1521
1542
/* Copy buffer pool dump or LRU dump */
1522
1543
if (!opt_rsync) {
1523
1544
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 );
1527
1546
copy_file (ds_data, buffer_pool_filename, dst_name, 0 );
1528
1547
}
1529
1548
if (file_exists (" ib_lru_dump" )) {
@@ -1612,17 +1631,14 @@ ibx_copy_incremental_over_full()
1612
1631
1613
1632
/* copy buffer pool dump */
1614
1633
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 );
1618
1635
1619
1636
snprintf (path, sizeof (path), " %s/%s" ,
1620
1637
xtrabackup_incremental_dir,
1621
1638
src_name);
1622
1639
1623
1640
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 );
1626
1642
}
1627
1643
}
1628
1644
@@ -1869,6 +1885,14 @@ copy_back()
1869
1885
1870
1886
datadir_node_init (&node);
1871
1887
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
+
1872
1896
while (datadir_iter_next (it, &node)) {
1873
1897
const char *ext_list[] = {" backup-my.cnf" ,
1874
1898
" xtrabackup_binary" , " xtrabackup_binlog_info" ,
@@ -1930,6 +1954,11 @@ copy_back()
1930
1954
continue ;
1931
1955
}
1932
1956
1957
+ /* skip buffer pool dump */
1958
+ if (!strcmp (filename, src_buffer_pool)) {
1959
+ continue ;
1960
+ }
1961
+
1933
1962
/* skip innodb data files */
1934
1963
for (Tablespace::const_iterator iter (srv_sys_space.begin ()),
1935
1964
end (srv_sys_space.end ()); iter != end; ++iter) {
@@ -1948,23 +1977,18 @@ copy_back()
1948
1977
1949
1978
/* copy buffer pool dump */
1950
1979
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;
1968
1992
}
1969
1993
}
1970
1994
0 commit comments