Skip to content

Commit 84984b7

Browse files
committed
Revert "MDEV-27524: Incorrect binlogs after Galera SST using rsync and mariabackup"
This reverts commit 17e0f52.
1 parent 2d26f71 commit 84984b7

29 files changed

+492
-1312
lines changed

extra/mariabackup/backup_copy.cc

Lines changed: 30 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ datafile_read(datafile_cur_t *cursor)
582582
Check to see if a file exists.
583583
Takes name of the file to check.
584584
@return true if file exists. */
585+
static
585586
bool
586587
file_exists(const char *filename)
587588
{
@@ -1546,14 +1547,13 @@ bool backup_start(CorruptedPages &corrupted_pages)
15461547
if (!write_galera_info(mysql_connection)) {
15471548
return(false);
15481549
}
1550+
write_current_binlog_file(mysql_connection);
15491551
}
15501552

1551-
bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
1553+
if (opt_binlog_info == BINLOG_INFO_ON) {
15521554

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);
15571557
}
15581558

15591559
if (have_flush_engine_logs && !opt_no_lock) {
@@ -1587,34 +1587,15 @@ void backup_release()
15871587
}
15881588
}
15891589

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-
16111590
/** Finish after backup_start() and backup_release() */
16121591
bool backup_finish()
16131592
{
16141593
/* Copy buffer pool dump or LRU dump */
16151594
if (!opt_rsync) {
16161595
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);
16181599
copy_file(ds_data, buffer_pool_filename, dst_name, 0);
16191600
}
16201601
if (file_exists("ib_lru_dump")) {
@@ -1703,14 +1684,17 @@ ibx_copy_incremental_over_full()
17031684

17041685
/* copy buffer pool dump */
17051686
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);
17071690

17081691
snprintf(path, sizeof(path), "%s/%s",
17091692
xtrabackup_incremental_dir,
17101693
src_name);
17111694

17121695
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);
17141698
}
17151699
}
17161700

@@ -1945,14 +1929,6 @@ copy_back()
19451929

19461930
datadir_node_init(&node);
19471931

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-
19561932
while (datadir_iter_next(it, &node)) {
19571933
const char *ext_list[] = {"backup-my.cnf",
19581934
"xtrabackup_binary", "xtrabackup_binlog_info",
@@ -2015,11 +1991,6 @@ copy_back()
20151991
continue;
20161992
}
20171993

2018-
/* skip buffer pool dump */
2019-
if (!strcmp(filename, src_buffer_pool)) {
2020-
continue;
2021-
}
2022-
20231994
/* skip innodb data files */
20241995
is_ibdata_file = false;
20251996
for (Tablespace::const_iterator iter(srv_sys_space.begin()),
@@ -2042,18 +2013,23 @@ copy_back()
20422013

20432014
/* copy buffer pool dump */
20442015

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);
20572033
}
20582034
}
20592035

extra/mariabackup/backup_copy.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ 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-
4235
/** Start --backup */
4336
bool backup_start(CorruptedPages &corrupted_pages);
4437
/** Release resources after backup_start() */

0 commit comments

Comments
 (0)