xelabs / go-mydumper

A multi-threaded MySQL backup and restore tool, faster than mysqldump

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow regex to specify databases to dump

fdellwing opened this issue · comments

In short, we need this: https://github.com/maxbube/mydumper#how-to-exclude-or-include-databases

Would be really cool to see it :)

commented

ACK, but there is no planned yet.

I thought some more over it and came to two possible implemantation ways:

a) Use the builtin REGEXP functionality. Sadly this lacks full support some important regexp features (https://linux.die.net/man/7/regex).

So

SHOW DATABASES WHERE `database` REGEXP '(^acc.*|foobar)';

will work but

SHOW DATABASES WHERE `database` REGEXP '^(?!(mysql\.|test\.))';

wont.

b) Filter the databases in go, this will somewhat work like the allTables function, but actually filtering the returned list.

I'm not that good in go, so I'm mostlikely not able to write this myself.

commented

It's simple in go to filter the database using regex rule.
Here the problem is go-mydumer works under one database one time, so we need to change this first.

I'm working on implementing the multi database functionality, but it might take some time.

@BohuTANG I'm currently working on the implementation of regex support and have a small problem.

go does not support full PCRE syntax, so the regex that someone could use are limited. There are other libraries that provide PCRE support, but the are not GPL, so I cannot use them in this project, right?

commented

Yes.