Fix for 1009510 and 1039569: pt-table-checksum doesn't check that tables exist on all replicas / shouldn't die if it can't create db/table

This commit is contained in:
Brian Fraser
2012-08-23 03:14:14 -03:00
parent 5ddef54fc8
commit c444384c6c
5 changed files with 334 additions and 44 deletions

View File

@@ -41,9 +41,6 @@ elsif ( !$slave1_dbh ) {
elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) {
plan skip_all => 'sakila database is not loaded';
}
else {
plan tests => 38;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --lock-wait-timeout=3 else the tool will die.
@@ -476,9 +473,48 @@ is(
"Bug 821675 (dot): 0 errors"
);
# #############################################################################
# pt-table-checksum doesn't check that tables exist on all replicas
# https://bugs.launchpad.net/percona-toolkit/+bug/1009510
# #############################################################################
$master_dbh->do("DROP DATABASE IF EXISTS bug_1009510");
$master_dbh->do("CREATE DATABASE bug_1009510");
$sb->wait_for_slaves();
$slave1_dbh->do("CREATE TABLE bug_1009510.bug_1009510 ( i int, b int )");
$master_dbh->do("CREATE TABLE IF NOT EXISTS bug_1009510.bug_1009510 ( i int )");
($output) = full_output(
sub { pt_table_checksum::main(@args,
qw(-t bug_1009510.bug_1009510)) },
);
like(
$output,
qr/has more columns than its master: b/,
"Bug 1009510: ptc warns about extra columns"
);
$slave1_dbh->do("DROP TABLE bug_1009510.bug_1009510");
$slave1_dbh->do("CREATE TABLE bug_1009510.bug_1009510 ( b int )");
($output) = full_output(
sub { $exit_status = pt_table_checksum::main(@args,
qw(-t bug_1009510.bug_1009510)) },
);
like(
$output,
qr/differs from master: Columns i/,
"Bug 1009510: ptc dies if the slave table has missing columns"
);
$sb->wipe_clean($master_dbh);
$sb->wipe_clean($slave1_dbh);
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;
done_testing;