GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

A plugin to pause at the swap table stage while new codebase is deployed

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

  • A plugin to pause at the swap table stage while new codebase is deployed

    Like the subject says - we're trying to use percona to help in our major migrations that happen every now and again (we use MySql 5.5, so it has use fast indexing but altering columns still requires locking the table). The problem is the database schema *has* to match the current code base. So I'm thinking I could create a plugin to have percona pause at the swap table stage so we could throw up a maintenance window, do the code deploy, then proceed with the swap before removing maintenance. That could turn a potentially 2 hour downtime into 5 minutes.

    But my script doesn't seem to be working - anyone have any advice? It doesn't throw any syntax errors but it doesn't stop at the swap stage as I expected. I'm currently using a text file as a mutex:

    {
    package pt_online_schema_change_plugin;

    sub new {
    open HANDLE, ">>pause_please.txt" or die "$!";
    close HANDLE;
    return True;
    }

    sub before_swap_tables {
    print "Pausing until you rm pause_please.txt...\n";
    while (-f "pause_please.txt") {
    sleep(1);
    }
    return True;
    }
    }
    1;
Working...
X