Merge pull request #205 from percona/PT-126

PT-126 Recognize comments in ALTER
This commit is contained in:
Carlos Salguero
2017-04-13 22:10:36 +02:00
committed by GitHub
2 changed files with 38 additions and 9 deletions

View File

@@ -10027,7 +10027,7 @@ sub find_renamed_cols {
/x;
my $table_ident = qr/$unquoted_ident|`$quoted_ident`|"$ansi_quotes_ident"/;
my $alter_change_col_re = qr/\bCHANGE \s+ (?:COLUMN \s+)?
my $alter_change_col_re = qr/\bCHANGE \s+ (?:COLUMN \s+)? (?:COMMENT\s+[^\]['"].*?[^\]['"])?
($table_ident) \s+ ($table_ident)/ix;
my %renames;

View File

@@ -602,6 +602,43 @@ is(
$master_dbh->do("DROP DATABASE IF EXISTS test");
$sb->load_file('master', "$sample/bug-1613915.sql");
$output = output(
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=o1",
'--execute',
'--alter', "ADD COLUMN c INT COMMENT 'change plus more than one word'",
'--chunk-size', '10', '--no-check-alter',
),
},
);
like(
$output,
qr/Successfully altered/s,
"recognize comments",
);
$rows = $master_dbh->selectrow_arrayref(
"SELECT COUNT(*) FROM test.o1");
is(
$rows->[0],
100,
"recognize comments fields count"
) or diag(Dumper($rows));
$rows = $master_dbh->selectrow_arrayref("SHOW CREATE TABLE test.o1");
like(
$rows->[1],
qr/COMMENT 'change plus more than one word'/,
"recognize comments",
);
$master_dbh->do("DROP DATABASE IF EXISTS test");
# Test for --skip-check-slave-lag
# Use the same files from previous test because for this test we are going to
# run a nonop so, any file will work
@@ -624,8 +661,6 @@ like(
"--skip-check-slave-lag",
);
$master_dbh->do("DROP DATABASE IF EXISTS test");
# Use the same data than the previous test
$master_dbh->do("DROP DATABASE IF EXISTS test");
@@ -640,12 +675,6 @@ $output = output(
},
);
$output = output(
sub { pt_table_checksum::main(@args,
'--skip-check-slave-lag', "h=127.0.0.1,P=".$sb->port_for('slave1'),
),
},
);
# #############################################################################
# Done.
# #############################################################################