Skip to content
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

Support triggers [community contribution welcome] #153

Open
shlomi-noach opened this issue Aug 11, 2016 · 6 comments
Open

Support triggers [community contribution welcome] #153

shlomi-noach opened this issue Aug 11, 2016 · 6 comments

Comments

@shlomi-noach
Copy link
Contributor

shlomi-noach commented Aug 11, 2016

Triggers can be supported by gh-ost. This is not on our immediate roadmap, and so it's an ideal opportunity for community contribution.

Some notes:

  • as far as I can see, all sorts of triggers could be supported (before|after, insert|delete|update)
  • throughout the migration process, nothing is really done; the ghost table should NOT have triggers.
  • during the cut-over phase we can copy+paste the triggers from original table to ghost table
  • Preferably the triggers are read at migration start, not at cut-over phase
  • triggers can be applied on the ghost table after the backlog is drained and the tables are in sync (after this.waitForEventsUpToLock())
  • triggers must be removed in any case of rollback, and in such case, before gh-ost resumes writes onto the ghost tables (no problem if original table resumes writes)
  • Note that at this time gh-ost supports two types of cut-over, and both must be supported.

Anyone who is interested to jump on this please let me know beforehand. Thank you!

@allixsenos
Copy link

in the meantime, it might be nice to have a --yes-it-has-triggers-ignore-them option... I'm looking at a 300 GB table which has triggers that I am happy to deal with manually... #152 made gh-ost check and bail on presence of triggers. a method of explicitly overriding that behavior would help greatly

@shlomi-noach
Copy link
Contributor Author

@allixsenos can you please open a new issue for this so we can track it?

@MarkLeith
Copy link

"Preferably the triggers are read at migration start, not at cut-over phase" - why?

Surely reading them at the point you want to recreate them is more correct (what if a trigger is altered during a migration)?

@shlomi-noach
Copy link
Contributor Author

@MarkLeith you are correct. My initial thought was to save time. The cut-over phase is the time where tables are locked, and I am a bit afraid of spending this time on even more operations.

I can also argue that anyone modifying the triggers while migration is running is on the right track to shooting themselves in the foot.

Having said all that the most ultimatest correctest behavior is to read trigger info while cutting over.

@bancer
Copy link

bancer commented Apr 12, 2019

@shlomi-noach Are there any new insights into this issue? I am interested to give it a try.

@shlomi-noach
Copy link
Contributor Author

@bancer no new insights on my side; I haven't given this thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants