Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1645

[pt-osc] deal with existing triggers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Priority: Medium
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      MySQL < 8.0 doesn't support multiple triggers per timing+event. If the table to alter already has triggers, pt-osc fails. Maybe keeping this as default behaviour is the best idea, but I think at least 2 approaches are possible to deal with existing triggers:

      • Optionally append code to existing triggers
      • Optionally replace existing triggers with triggers provided by the user

      (this is not a XOR: in most cases option 1 is fine, in special cases user may prefer option 2)

      Of course if we DROP+CREATE triggers, for a short period of time no trigger will exist on the table, BUT:

      • MariaDB 10.1+ supports CREATE OR REPLACE TRIGGER, which is atomic
      • I don't know any safer way to achieve the purpose (except for setting the database in maintenance), so the user should be free to take the risk

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            federico Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist