-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
DropSources: change table rename logic #7230
DropSources: change table rename logic #7230
Conversation
@shlomi-noach, in go/vt/schema/online_ddl.go:35, the regexp used for tables renamed by ptosc is |
@rohit-nayak-ps there's always a and then at: say your table is |
Another note, I'm not sure what's that https://github.com/CxOrg/mysql-sync repo. Official code is in https://github.com/percona/percona-toolkit/blob/3.x/bin/pt-online-schema-change |
ok, so the prefix is applied separately as well. Thanks for the clarification. References in blogs like https://www.percona.com/doc/percona-toolkit/3.0/pt-online-schema-change.html (grep for staff_old) confused me, so thought I would confirm. |
c625e35
to
bc2e461
Compare
That documentation baffles me. I think it's a doc bug. In all my experience and experiments (just checked again, there's a |
@tomkrouper, wanted to check that this change doesn't break anything for you, since you had implemented this originally. |
I mean, I totally think it should use the In all seriousness, this will not break anything on my side. All that matters in our environment is the |
A Related to that |
@rohit-nayak-ps if you want the old tables to be automatically "garbage collected", then you should rename them into a different name. Right now, these old tables will just stay in the schema forever, until some DBA will notice their volume and actively drop them. What the garbage collection (aka table lifecycle) mechanism offers you is:
See this code from Online DDL, which renamed the old migration tables: vitess/go/vt/vttablet/onlineddl/executor.go Lines 1232 to 1242 in bf57b8c
The above actually renames the table directly into the |
The current renaming logic is intended to leave the table around with a recognizable name and be manually removed. I simply updated the naming convention to make use of vreplication feature implemented in #7159. But your suggestion is a good one. Maybe, by default, we can just rename the tables to use the automatic garbage collection feature instead of deleting them immediately. This will be an orthogonal feature to the existing one since GC will purge automatically after the fixed time whereas the DBA might want to keep it around longer. Will plan to implement this in a future PR. |
@rohit-nayak-ps sounds good |
…flow Signed-off-by: Rohit Nayak <rohit@planetscale.com>
bc2e461
to
88997a7
Compare
Description
DropSources (achieved via the Complete subcommand in the v2 MoveTables command) supports a rename flag for MoveTables workflows. Tables are renamed as _<table_name> (see PR #6383) . This change uses a similar logic to that used by pt-osc when it drops tables using the rename template _<table_name>_old.
Reasons:
Checklist
Docs for PR #7230 website#655
Impacted Areas in Vitess