Not the answer you need?
Register and ask your own question!

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

asolbergasolberg EntrantInactive User Role Beginner
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;
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.