-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-36297: Ability to backup selected partitions only #3891
base: main
Are you sure you want to change the base?
Conversation
IMHO I think that we can improve this command line arguments, maybe we can set one option to tell mysqldump that we will dump using partitions, and we can set a default separator and a optional parameter to set the separator. maybe something like this
./mariadb-dump -umyuser -pmypass -h127.0.0.1 mydatabase _test1@p0,p1 _test2@p0 --dump-using-partitions
./mariadb-dump -umyuser -pmypass -h127.0.0.1 mydatabase _test1$p0,p1 _test2$p0 --dump-using-partitions --partition-separator=$ |
Thank you for the contribution. Looking at the code briefly, it looks ok. I could not find a corresponding MDEV for this feature request so I created a new one, MDEV-36297. If there is one already, please let me know and I will mark this one as dupicate. However, we need to get consensus whether this is the preferred approach for the CLI interface. My other thought is something along the lines of:
This would not require the use of a special string separator. I also am thinking in how this interacts with @vaintroub @vuvova I'd like your opinion on the user experience. Do you think that the proposed approach in the PR is ok? Do you like my suggestion better or do you have an alternative suggestion? Let's get consensus on the UX first, then I can review the code accordingly. |
Another note is that Oracle separates partitions with Perhaps writing tables like so:
|
My preference would be
|
Make sure it works with all possible table names. If you use |
Thank you @vaintroub @vuvova for the comments. I think @vaintroub suggestions make the most sense. I have a preference for So I formalize the spec as:
@slawomir-pryczek Would you like to take a stab at implementing things this way? |
Hi Everyone, thanks for the feedback. @cvicentiu yes, i'll wait untill spec is completed and start implementing it. As for the issues with backing up tables with separator in the name, we could escape colon by using double colon, if colon is picked for separator. That should be simple to use and don't break anything in "normal" mode while everything will work in partition mode. As for doing each partition/table pair separately in command line, that should work. Will have to just backup all partitions at once, and put it in single file because of drop/create table blocks would make this kind of backp unusable and only single partition would be restored (if we have separated files for each partition). If we just backup each selected partition at once and keep it in single place all should be fine. So maybe this way will work if we have colon in the name for partition mode |
@cvicentiu : The ":" separator is fine on the command line . But I still prefer '#' , because it can be used in filenames, and ':' not necessarily . |
Yes that's true, so we can maybe have # as partition separator and ## for escaping "#" char in table names. If that sounds good i'll start implementing it. |
Description
This code adds ability to backup selected partition(s) by mariadb-dump by using --partition-separator=@ and then specifying partition name in table's name, eg. mytable1@p0,p1. There should be no side effects, support for selecting partition(s) is disabled by default.
./mariadb-dump -umyuser -pmypass -h127.0.0.1 mydatabase _test1@p0,p1 _test2@p0 --partition-separator=@
Release Notes
Ability to backup specific partitions with mariadb-dump by using --partition-separator and specifying partition list in table's name
How can this PR be tested?
Won't affect mariadb-server, will try to write test case if that gets accepted.
Basing the PR against the correct MariaDB version
main
branch.PR quality check