Commit 0efe1971 authored by Vlad Lesin's avatar Vlad Lesin

MDEV-19347: Mariabackup does not honor ignore_db_dirs from server

config.

The solution is to read the system variable value on startup and to fill
databases_exclude_hash.

xb_load_list_string() became non-static and was reformatted. The system
variable value is read and processed in get_mysql_vars(), which was also
reformatted.
parent 36bddacf
This diff is collapsed.
......@@ -3632,6 +3632,11 @@ xb_register_exclude_filter_entry(
&tables_exclude_hash);
}
void register_ignore_db_dirs_filter(const char *name)
{
xb_add_filter(name, &databases_exclude_hash);
}
/***********************************************************************
Register new table for the filter. */
static
......@@ -3694,26 +3699,24 @@ xb_register_exclude_regex(
typedef void (*insert_entry_func_t)(const char*);
/***********************************************************************
Scan string and load filter entries from it. */
static
void
xb_load_list_string(
/*================*/
char* list, /*!< in: string representing a list */
const char* delimiters, /*!< in: delimiters of entries */
insert_entry_func_t ins) /*!< in: callback to add entry */
/* Scan string and load filter entries from it.
@param[in] list string representing a list
@param[in] delimiters delimiters of entries
@param[in] ins callback to add entry */
void xb_load_list_string(char *list, const char *delimiters,
insert_entry_func_t ins)
{
char* p;
char* saveptr;
char *p;
char *saveptr;
p = strtok_r(list, delimiters, &saveptr);
while (p) {
p= strtok_r(list, delimiters, &saveptr);
while (p)
{
ins(p);
ins(p);
p = strtok_r(NULL, delimiters, &saveptr);
}
p= strtok_r(NULL, delimiters, &saveptr);
}
}
/***********************************************************************
......
......@@ -194,4 +194,14 @@ void mdl_lock_init();
void mdl_lock_table(ulint space_id);
void mdl_unlock_all();
bool ends_with(const char *str, const char *suffix);
typedef void (*insert_entry_func_t)(const char*);
/* Scan string and load filter entries from it.
@param[in] list string representing a list
@param[in] delimiters delimiters of entries
@param[in] ins callback to add entry */
void xb_load_list_string(char *list, const char *delimiters,
insert_entry_func_t ins);
void register_ignore_db_dirs_filter(const char *name);
#endif /* XB_XTRABACKUP_H */
--ignore-db-dirs=db3
--ignore-db-dirs=db4
select @@ignore_db_dirs;
@@ignore_db_dirs
db3,db4
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(i int) ENGINE INNODB;
......
#--source include/innodb_page_size.inc
# Test --databases-exclude and --tables-exclude feature of xtrabackup 2.3.8
select @@ignore_db_dirs;
let $MYSQLD_DATADIR= `select @@datadir`;
mkdir $MYSQLD_DATADIR/db3;
mkdir $MYSQLD_DATADIR/db4;
mkdir $MYSQLD_DATADIR/db5;
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
......@@ -24,8 +31,19 @@ list_files $targetdir/test *.ibd;
# check that db2 database is not in the backup (excluded)
--error 1
list_files $targetdir/db2 *.ibd;
# check that db3 database is not in the backup (excluded)
--error 1
list_files $targetdir/db3 *.ibd;
# check that db4 database is not in the backup (excluded)
--error 1
list_files $targetdir/db4 *.ibd;
# check that db5 database is in the backup
list_files $targetdir/db5 *.ibd;
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db2;
rmdir $MYSQLD_DATADIR/db3;
rmdir $MYSQLD_DATADIR/db4;
rmdir $MYSQLD_DATADIR/db5;
rmdir $targetdir;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment