Fix Sandbox::leftover_servers(). Temporarily disable very slow test in pt-table-checksum/chunk_size.t. Debugging pt-table-checksum/replication_filters.t.

This commit is contained in:
Daniel Nichter
2012-06-04 08:24:30 -04:00
parent bb481b7470
commit 7f51c42493
3 changed files with 37 additions and 28 deletions
+9 -5
View File
@@ -34,6 +34,8 @@ use English qw(-no_match_vars);
use Time::HiRes qw(sleep);
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Quotekeys = 0;
$Data::Dumper::Sortkeys = 1;
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
my $trunk = $ENV{PERCONA_TOOLKIT_BRANCH};
@@ -192,6 +194,8 @@ sub master_is_ok {
sub slave_is_ok {
my ($self, $slave, $master, $ro) = @_;
PTDEBUG && _d('Checking if slave', $slave, $port_for{$slave},
'to', $master, $port_for{$master}, 'is ok');
my $slave_dbh = $self->get_dbh_for($slave);
if ( !$slave_dbh ) {
@@ -232,11 +236,11 @@ sub slave_is_ok {
}
}
if ( ($status->[0]->{seconds_behind_master} || 0) > 0 ) {
my $sleep_t = 0.25;
my $total_t = 0;
while ( defined $status->[0]->{seconds_behind_master}
&& $status->[0]->{seconds_behind_master} > 0 ) {
PTDEBUG && _d('Slave lag:', $status->[0]->{seconds_behind_master});
sleep $sleep_t;
$total_t += $sleep_t;
$status = $slave_dbh->selectall_arrayref(
@@ -246,20 +250,20 @@ sub slave_is_ok {
. " to catch up...");
}
}
}
PTDEBUG && _d('Slave', $slave, $port_for{$slave}, 'is ok');
$slave_dbh->disconnect();
return 1;
}
sub leftover_servers {
my ($self);
return 0;
my ($self) = @_;
PTDEBUG && _d('Checking for leftover servers');
my $leftovers = 0;
foreach my $serverno ( 1..6 ) {
my $server = "master$serverno";
my $dbh = $self->get_dbh_for($server);
if ( !$dbh ) {
if ( $dbh ) {
warn "Sandbox $server " . $port_for{$server} . " was left up\n";
$dbh->disconnect();
$leftovers = 1;
+3 -2
View File
@@ -94,7 +94,8 @@ is_deeply(
# ############################################################################
# Sub-second chunk-time.
# ############################################################################
SKIP: {
skip "Too slow", 1;
$output = output(
sub { pt_table_checksum::main(@args,
qw(--quiet --chunk-time .001 -d mysql)) },
@@ -106,7 +107,7 @@ unlike(
qr/Cannot checksum table/,
"Very small --chunk-time doesn't cause zero --chunk-size"
);
}
# #############################################################################
# Bug 921700: pt-table-checksum doesn't add --where to chunk-oversize test
# on replicas
+13 -9
View File
@@ -61,12 +61,13 @@ for my $port ( qw(12346 12347) ) {
}
$slave1_dbh = $sb->get_dbh_for('slave1');
$slave2_dbh = $sb->get_dbh_for('slave2');
$sb->ok() or BAIL_OUT("Sandbox is broken");
my $pos = PerconaTest::get_master_binlog_pos($master_dbh);
$output = output(
sub { pt_table_checksum::main(@args, qw(-t sakila.country)) },
stderr => 1,
#stderr => 1,
);
is(
@@ -91,7 +92,7 @@ like(
$output = output(
sub { pt_table_checksum::main(@args, qw(-t sakila.country),
qw(--no-check-replication-filters)) },
stderr => 1,
#stderr => 1,
);
like(
@@ -133,6 +134,7 @@ diag(`/tmp/12345/start >/dev/null`);
diag(`/tmp/12346/start >/dev/null`);
$master_dbh = $sb->get_dbh_for('master');
$slave1_dbh = $sb->get_dbh_for('slave1');
$sb->ok() or BAIL_OUT("Sandbox is broken");
# Checksum the tables again in 1 chunk. Since db percona isn't being
# ignored, deleting old results in the repl table should replicate.
@@ -180,12 +182,13 @@ diag(`/tmp/12346/start >/dev/null`);
$master_dbh = $sb->get_dbh_for('master');
$slave1_dbh = $sb->get_dbh_for('slave1');
$sb->ok() or BAIL_OUT("Sandbox is broken");
$output = output(
sub { pt_table_checksum::main(@args, qw(--no-check-replication-filters),
qw(-d mysql -t user))
},
stderr => 1,
#stderr => 1,
);
# Because we did not use --replicate-database, pt-table-checksum should
@@ -245,6 +248,7 @@ diag(`$trunk/sandbox/test-env reset`);
$master_dbh = $sb->get_dbh_for('master');
$slave1_dbh = $sb->get_dbh_for('slave1');
$sb->ok() or BAIL_OUT("Sandbox is broken");
pt_table_checksum::main(@args, qw(--quiet));
@@ -275,12 +279,12 @@ is(
# #############################################################################
# Stop and start slaves to avoid sandbox breakage caused by restarting servers.
# #############################################################################
$slave1_dbh = $sb->get_dbh_for('slave1');
$slave2_dbh = $sb->get_dbh_for('slave2');
$slave1_dbh->do('STOP SLAVE');
$slave2_dbh->do('STOP SLAVE');
$slave1_dbh->do('START SLAVE');
$slave2_dbh->do('START SLAVE');
#$slave1_dbh = $sb->get_dbh_for('slave1');
#$slave2_dbh = $sb->get_dbh_for('slave2');
#$slave1_dbh->do('STOP SLAVE');
#$slave2_dbh->do('STOP SLAVE');
#$slave1_dbh->do('START SLAVE');
#$slave2_dbh->do('START SLAVE');
# #############################################################################
# Done.