PT-2389 Fix unconditional ALTER on new table with resume

When running with --resume option the ALTER runs on the new table
even if the new table exists and has already been altered.

This causes a deterministic failure every time the --resume option
is used.  This fix tests if --resume is given and does not run
ALTER on the new table.  If pt-osc did not successfully alter
the new table during the previous invocation, this could cause the
ALTER to not be applied.

The right fix would be to compare the DDL of the _new table to
the proposed DDL generated by pt-osc and only run ALTER if they
do not match.
This commit is contained in:
Perry Harrington
2025-01-28 10:47:47 -08:00
parent d82723f272
commit dc77289d60

View File

@@ -9912,7 +9912,7 @@ sub main {
);
}
if ( my $alter = $o->get('alter') ) {
if ( (my $alter = $o->get('alter')) && !$o->get('resume') ) {
print "Altering new table...\n";
my $sql = "ALTER TABLE $new_tbl->{name} $alter";
print $sql, "\n" if $o->get('print');