diff options
5 files changed, 127 insertions, 2 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 162efebbd9f..7cb9d5ac3fe 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -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; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result new file mode 100644 index 00000000000..b2a2005748f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result @@ -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; diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf new file mode 100644 index 00000000000..a09efd2e011 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf @@ -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 diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test new file mode 100644 index 00000000000..d1c30656139 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test @@ -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 diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 85138c3c0be..231cf6e3702 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -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 |