Announcement

Announcement Module
Collapse
No announcement yet.

pt-online-schema-change UUID-based constraint name patch

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • pt-online-schema-change UUID-based constraint name patch

    Hi,

    I hit a problem today which prevented pt-online-schema-change from being able to modify one of my tables. pt-online-schema-change works by creating a duplicate of the table to be modified first, but it renames the constraints by prefixing them with an underscore (to avoid collisions; constraint names are unique across a database).

    In my case I had a very long constraint name, and prefixing it with an underscore made it longer than the allowed 64 characters causing pt-online-schema-change to fail.

    When i dived into the code, i noticed there was a TODO regarding this issue, and the suggestion was to possibly use UUID-based constraint names instead, as this is a better collision-avoidance strategy. This approach would also solve my problem, so I implemented a patch to do this, and added a cli-option "--uuid-constraints" to toggle it (default is off, to leave the old behaviour).

    If anybody is interested I am happy to contribute this code back, just let me know the preferred format (a patch against the 2.1.4 shipped Perl code doesn't look useful since it appears to be built using some kind of build process)

    Regards,
    Morgan

    PS: Meta-discussion: Which should I be using - this forum or the Google Group? I posted this topic also there but it has yet to appear. Sorry for cross-posting.
Working...
X