Skip to content
Permalink
Browse files
MDEV-21951: mariabackup SST fail if data-directory have lost+found di…
…rectory

To fix this, it is necessary to add an option to exclude the
database with the name "lost+found" from processing (the database
name will be checked by the check_if_skip_database_by_path() or
by the check_if_skip_database() function, and as a result
"lost+found" will be skipped).

In addition, it is necessary to slightly modify the verification
logic in the check_if_skip_database() function.

Also added a new test galera_sst_mariabackup_lost_found.test
  • Loading branch information
sysprg committed Oct 20, 2020
1 parent 692a44b commit 888010d
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 2 deletions.
@@ -2371,7 +2371,7 @@ check_if_skip_database(
if (databases_exclude_hash &&
find_filter_in_hashtable(name, databases_exclude_hash,
&database) &&
!database->has_tables) {
(!database->has_tables || !databases_include_hash)) {
/* Database is found and there are no tables specified,
skip entire db. */
return DATABASE_SKIP;
@@ -0,0 +1,37 @@
connection node_1;
connection node_2;
connection node_2;
Shutting down server ...
connection node_1;
CREATE DATABASE `lost+found`;
USE `lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `lost+found`.t1;
id
1
2
CREATE DATABASE `#mysql50#not_lost+found`;
USE `#mysql50#not_lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `#mysql50#not_lost+found`.t1;
id
1
2
Cleaning var directory ...
connection node_2;
Starting server ...
SELECT * FROM `lost+found`.t1;
id
1
2
SELECT * FROM `#mysql50#not_lost+found`.t1;
id
1
2
connection node_1;
DROP DATABASE `lost+found`;
DROP DATABASE `#mysql50#not_lost+found`;
disconnect node_2;
disconnect node_1;
@@ -0,0 +1,15 @@
!include ../galera_2nodes.cnf

[mysqld]
wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"

[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'

[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'

[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
streamfmt=xbstream
@@ -0,0 +1,71 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc

# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc

--connection node_2

#--connection node_2
#--source suite/galera/include/galera_unload_provider.inc

--echo Shutting down server ...
--source include/shutdown_mysqld.inc

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

CREATE DATABASE `lost+found`;
USE `lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `lost+found`.t1;

CREATE DATABASE `#mysql50#not_lost+found`;
USE `#mysql50#not_lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `#mysql50#not_lost+found`.t1;

#
# Force SST
#
--echo Cleaning var directory ...
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data

--connection node_2

--echo Starting server ...
let $restart_noprint=2;
--source include/start_mysqld.inc

--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc

SELECT * FROM `lost+found`.t1;
SELECT * FROM `#mysql50#not_lost+found`.t1;

--connection node_1

DROP DATABASE `lost+found`;
DROP DATABASE `#mysql50#not_lost+found`;

# rmdir $MYSQLD_DATADIR/lost+found;
# rmdir $MYSQLD_DATADIR/not_lost+found;

# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc

--source include/galera_end.inc
@@ -712,9 +712,11 @@ if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; t
disver="--no-version-check"
fi

iopts+=" --databases-exclude=\"lost+found\""

if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL"
iopts+=" --no-backup-locks "
iopts+=" --no-backup-locks"
fi

INNOEXTRA=$WSREP_SST_OPT_MYSQLD

0 comments on commit 888010d

Please sign in to comment.