@@ -582,6 +582,7 @@ datafile_read(datafile_cur_t *cursor)
582
582
Check to see if a file exists.
583
583
Takes name of the file to check.
584
584
@return true if file exists. */
585
+ static
585
586
bool
586
587
file_exists (const char *filename)
587
588
{
@@ -1546,14 +1547,13 @@ bool backup_start(CorruptedPages &corrupted_pages)
1546
1547
if (!write_galera_info (mysql_connection)) {
1547
1548
return (false );
1548
1549
}
1550
+ write_current_binlog_file (mysql_connection);
1549
1551
}
1550
1552
1551
- bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
1553
+ if ( opt_binlog_info == BINLOG_INFO_ON) {
1552
1554
1553
- if (with_binlogs || opt_galera_info) {
1554
- if (!write_current_binlog_file (mysql_connection, with_binlogs)) {
1555
- return (false );
1556
- }
1555
+ lock_binlog_maybe (mysql_connection);
1556
+ write_binlog_info (mysql_connection);
1557
1557
}
1558
1558
1559
1559
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1587,34 +1587,15 @@ void backup_release()
1587
1587
}
1588
1588
}
1589
1589
1590
- static const char *default_buffer_pool_file = " ib_buffer_pool" ;
1591
-
1592
- static
1593
- const char * get_buffer_pool_filename (size_t *length)
1594
- {
1595
- /* If mariabackup is run for Galera, then the file
1596
- name is changed to the default so that the receiving
1597
- node can find this file and rename it according to its
1598
- settings, otherwise we keep the original file name: */
1599
- size_t dir_length = 0 ;
1600
- const char *dst_name = default_buffer_pool_file;
1601
- if (!opt_galera_info) {
1602
- dir_length = dirname_length (buffer_pool_filename);
1603
- dst_name = buffer_pool_filename + dir_length;
1604
- }
1605
- if (length) {
1606
- *length=dir_length;
1607
- }
1608
- return dst_name;
1609
- }
1610
-
1611
1590
/* * Finish after backup_start() and backup_release() */
1612
1591
bool backup_finish ()
1613
1592
{
1614
1593
/* Copy buffer pool dump or LRU dump */
1615
1594
if (!opt_rsync) {
1616
1595
if (buffer_pool_filename && file_exists (buffer_pool_filename)) {
1617
- const char *dst_name = get_buffer_pool_filename (NULL );
1596
+ const char *dst_name;
1597
+
1598
+ dst_name = trim_dotslash (buffer_pool_filename);
1618
1599
copy_file (ds_data, buffer_pool_filename, dst_name, 0 );
1619
1600
}
1620
1601
if (file_exists (" ib_lru_dump" )) {
@@ -1703,14 +1684,17 @@ ibx_copy_incremental_over_full()
1703
1684
1704
1685
/* copy buffer pool dump */
1705
1686
if (innobase_buffer_pool_filename) {
1706
- const char *src_name = get_buffer_pool_filename (NULL );
1687
+ const char *src_name;
1688
+
1689
+ src_name = trim_dotslash (innobase_buffer_pool_filename);
1707
1690
1708
1691
snprintf (path, sizeof (path), " %s/%s" ,
1709
1692
xtrabackup_incremental_dir,
1710
1693
src_name);
1711
1694
1712
1695
if (file_exists (path)) {
1713
- copy_file (ds_data, path, src_name, 0 );
1696
+ copy_file (ds_data, path,
1697
+ innobase_buffer_pool_filename, 0 );
1714
1698
}
1715
1699
}
1716
1700
@@ -1945,14 +1929,6 @@ copy_back()
1945
1929
1946
1930
datadir_node_init (&node);
1947
1931
1948
- /* If mariabackup is run for Galera, then the file
1949
- name is changed to the default so that the receiving
1950
- node can find this file and rename it according to its
1951
- settings, otherwise we keep the original file name: */
1952
- size_t dir_length;
1953
- const char *src_buffer_pool;
1954
- src_buffer_pool = get_buffer_pool_filename (&dir_length);
1955
-
1956
1932
while (datadir_iter_next (it, &node)) {
1957
1933
const char *ext_list[] = {" backup-my.cnf" ,
1958
1934
" xtrabackup_binary" , " xtrabackup_binlog_info" ,
@@ -2015,11 +1991,6 @@ copy_back()
2015
1991
continue ;
2016
1992
}
2017
1993
2018
- /* skip buffer pool dump */
2019
- if (!strcmp (filename, src_buffer_pool)) {
2020
- continue ;
2021
- }
2022
-
2023
1994
/* skip innodb data files */
2024
1995
is_ibdata_file = false ;
2025
1996
for (Tablespace::const_iterator iter (srv_sys_space.begin ()),
@@ -2042,18 +2013,23 @@ copy_back()
2042
2013
2043
2014
/* copy buffer pool dump */
2044
2015
2045
- if (file_exists (src_buffer_pool)) {
2046
- char dst_dir[FN_REFLEN];
2047
- while (IS_TRAILING_SLASH (buffer_pool_filename, dir_length)) {
2048
- dir_length--;
2049
- }
2050
- memcpy (dst_dir, buffer_pool_filename, dir_length);
2051
- dst_dir[dir_length] = 0 ;
2052
- if (!(ret = copy_or_move_file (src_buffer_pool,
2053
- src_buffer_pool,
2054
- dst_dir, 1 )))
2055
- {
2056
- goto cleanup;
2016
+ if (innobase_buffer_pool_filename) {
2017
+ const char *src_name;
2018
+ char path[FN_REFLEN];
2019
+
2020
+ src_name = trim_dotslash (innobase_buffer_pool_filename);
2021
+
2022
+ snprintf (path, sizeof (path), " %s/%s" ,
2023
+ mysql_data_home,
2024
+ src_name);
2025
+
2026
+ /* could be already copied with other files
2027
+ from data directory */
2028
+ if (file_exists (src_name) &&
2029
+ !file_exists (innobase_buffer_pool_filename)) {
2030
+ copy_or_move_file (src_name,
2031
+ innobase_buffer_pool_filename,
2032
+ mysql_data_home, 0 );
2057
2033
}
2058
2034
}
2059
2035
0 commit comments