Remove test-env reset. Fix pt-fifo-split plan.

This commit is contained in:
Daniel Nichter
2012-08-14 17:08:06 -06:00
parent ca96d11473
commit 92a36715c4
7 changed files with 29 additions and 41 deletions

View File

@@ -369,24 +369,6 @@ case $opt in
exit_status=1 exit_status=1
fi fi
;; ;;
reset)
# Several tests reset the bin logs so that queries from prior tests
# don't replicate to new sandbox servers. This makes creating new
# sandbox servers a lot faster. There's no check if this works or
# not, so... yeah.
echo "RESETTING SLAVE. This is DANGEROUS and DOESN'T WORK. FIXME." >&2
/tmp/12347/use -e "STOP SLAVE; FLUSH SLAVE;"
/tmp/12346/use -e "STOP SLAVE; FLUSH SLAVE; FLUSH MASTER;"
/tmp/12345/use -e "FLUSH MASTER"
/tmp/12346/use -e "CHANGE MASTER TO master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=12345, master_log_file='mysql-bin.000001', master_log_pos=0"
/tmp/12346/use -e "START SLAVE"
/tmp/12347/use -e "CHANGE MASTER TO master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=12346, master_log_file='mysql-bin.000001', master_log_pos=0"
/tmp/12347/use -e "START SLAVE"
exit_status=0
;;
version) version)
set_mysql_version set_mysql_version
echo $MYSQL_VERSION echo $MYSQL_VERSION

View File

@@ -738,8 +738,6 @@ $sb->wipe_clean($master_dbh);
diag(`$trunk/sandbox/stop-sandbox 2903 2902 2901 2900`); diag(`$trunk/sandbox/stop-sandbox 2903 2902 2901 2900`);
diag(`/tmp/12346/use -e "set global read_only=1"`); diag(`/tmp/12346/use -e "set global read_only=1"`);
diag(`/tmp/12347/use -e "set global read_only=1"`); diag(`/tmp/12347/use -e "set global read_only=1"`);
$sb->wait_for_slaves();
diag(`$trunk/sandbox/test-env reset`);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing; done_testing;
exit; exit;

View File

@@ -444,7 +444,6 @@ SKIP: {
$d = new RowDiff(dbh => $master_dbh); $d = new RowDiff(dbh => $master_dbh);
diag(`$trunk/sandbox/mk-test-env reset >/dev/null 2>&1`);
$sb->create_dbs($master_dbh, [qw(test)]); $sb->create_dbs($master_dbh, [qw(test)]);
$sb->load_file('master', 't/lib/samples/issue_11.sql'); $sb->load_file('master', 't/lib/samples/issue_11.sql');
PerconaTest::wait_until( PerconaTest::wait_until(

View File

@@ -576,7 +576,6 @@ $dst->{dbh} = $dst_dbh;
# ########################################################################### # ###########################################################################
make_plugins(); make_plugins();
$sb->load_file('master', 't/lib/samples/before-TableSyncGroupBy.sql'); $sb->load_file('master', 't/lib/samples/before-TableSyncGroupBy.sql');
sleep 1;
sync_table( sync_table(
src => "test.test1", src => "test.test1",
@@ -606,7 +605,6 @@ is_deeply(
# ############################################################################# # #############################################################################
make_plugins(); make_plugins();
$sb->load_file('master', 't/lib/samples/issue_96.sql'); $sb->load_file('master', 't/lib/samples/issue_96.sql');
sleep 1;
# Make paranoid-sure that the tables differ. # Make paranoid-sure that the tables differ.
my $r1 = $src_dbh->selectall_arrayref('SELECT from_city FROM issue_96.t WHERE package_id=4'); my $r1 = $src_dbh->selectall_arrayref('SELECT from_city FROM issue_96.t WHERE package_id=4');
@@ -1051,7 +1049,9 @@ my $output = '';
"Retries wait" "Retries wait"
); );
} }
diag(`$trunk/sandbox/test-env reset`); diag(`/tmp/12347/use -e "stop slave"`);
diag(`/tmp/12346/use -e "start slave"`);
diag(`/tmp/12347/use -e "start slave"`);
# ############################################################################# # #############################################################################
# Done. # Done.

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Test::More tests => 4; use Test::More;
if ( !$ENV{SLOW_TESTS} ) { if ( !$ENV{SLOW_TESTS} ) {
plan skip_all => "pt-fifo-split/pt-fifo-split. is a top 5 slowest file; set SLOW_TESTS=1 to enable it."; plan skip_all => "pt-fifo-split/pt-fifo-split. is a top 5 slowest file; set SLOW_TESTS=1 to enable it.";
@@ -63,4 +63,5 @@ unlink '/tmp/pt-script.pid';
# ############################################################################# # #############################################################################
# Done. # Done.
# ############################################################################# # #############################################################################
done_testing;
exit; exit;

View File

@@ -9,15 +9,12 @@ BEGIN {
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Time::HiRes qw(sleep);
use Test::More; use Test::More;
use PerconaTest; use PerconaTest;
use Sandbox; use Sandbox;
require "$trunk/bin/pt-heartbeat"; require "$trunk/bin/pt-heartbeat";
diag(`$trunk/sandbox/test-env reset`);
my $dp = new DSNParser(opts=>$dsn_opts); my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master'); my $master_dbh = $sb->get_dbh_for('master');
@@ -37,10 +34,12 @@ else {
plan tests => 29; plan tests => 29;
} }
diag(`rm -rf /tmp/pt-heartbeat-sentinel >/dev/null 2>&1`);
$sb->create_dbs($master_dbh, ['test']); $sb->create_dbs($master_dbh, ['test']);
$sb->wait_for_slaves();
my $output; my $output;
my $pid_file = "/tmp/__mk-heartbeat-test.pid"; my $pid_file = "/tmp/pt-heartbeat-test.$PID.pid";
# Multi-update mode is the new, hi-res mode that allows a single table to # Multi-update mode is the new, hi-res mode that allows a single table to
# be updated by multiple servers: a slave's master, its master's master, etc. # be updated by multiple servers: a slave's master, its master's master, etc.
@@ -54,8 +53,7 @@ my @ports = qw(12345 12346 12347);
foreach my $port (@ports) { foreach my $port (@ports) {
system("$trunk/bin/pt-heartbeat -h 127.1 -u msandbox -p msandbox -P $port --database test --table heartbeat --create-table --update --interval 0.5 --daemonize --pid $pid_file.$port >/dev/null"); system("$trunk/bin/pt-heartbeat -h 127.1 -u msandbox -p msandbox -P $port --database test --table heartbeat --create-table --update --interval 0.5 --daemonize --pid $pid_file.$port >/dev/null");
sleep 0.2; PerconaTest::wait_for_files("$pid_file.$port");
ok( ok(
-f "$pid_file.$port", -f "$pid_file.$port",
"--update on $port started" "--update on $port started"
@@ -154,7 +152,7 @@ ok(
# ############################################################################ # ############################################################################
# $rows already has slave2 heartbeat info. # $rows already has slave2 heartbeat info.
sleep 1.0; sleep 1;
my $rows2 = $slave2_dbh->selectall_hashref("select * from test.heartbeat", 'server_id'); my $rows2 = $slave2_dbh->selectall_hashref("select * from test.heartbeat", 'server_id');

View File

@@ -13,23 +13,33 @@ use Test::More;
use PerconaTest; use PerconaTest;
use Sandbox; use Sandbox;
require "$trunk/bin/pt-slave-find"; require "$trunk/bin/pt-slave-find";
my $dp = new DSNParser(opts=>$dsn_opts); my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master'); my $slave1_dbh = $sb->get_dbh_for('slave1');
my $slave_dbh = $sb->get_dbh_for('slave1'); my $slave2_dbh = $sb->get_dbh_for('slave2');
my $slave_2_dbh = $sb->get_dbh_for('slave2');
diag(`$trunk/sandbox/test-env reset`); # This test is sensitive to ghost/old slaves created/destroyed by other
# tests. So we stop the slaves, restart the master, and start everything
# again. Hopefully this will return the env to its original state.
$slave2_dbh->do("STOP SLAVE");
$slave1_dbh->do("STOP SLAVE");
diag(`/tmp/12345/stop >/dev/null`);
diag(`/tmp/12345/start >/dev/null`);
$slave1_dbh->do("START SLAVE");
$slave2_dbh->do("START SLAVE");
my $master_dbh = $sb->get_dbh_for('master');
if ( !$master_dbh ) { if ( !$master_dbh ) {
plan skip_all => 'Cannot connect to sandbox master'; plan skip_all => 'Cannot connect to sandbox master';
} }
elsif ( !$slave_dbh ) { elsif ( !$slave1_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave'; plan skip_all => 'Cannot connect to sandbox slave';
} }
elsif ( !$slave_2_dbh ) { elsif ( !$slave2_dbh ) {
plan skip_all => 'Cannot connect to second sandbox slave'; plan skip_all => 'Cannot connect to second sandbox slave';
} }
else { else {
@@ -42,7 +52,7 @@ my $output = `$trunk/bin/pt-slave-find --help`;
like($output, qr/Prompt for a password/, 'It compiles'); like($output, qr/Prompt for a password/, 'It compiles');
# Double check that we're setup correctly. # Double check that we're setup correctly.
my $row = $slave_2_dbh->selectall_arrayref('SHOW SLAVE STATUS', {Slice => {}}); my $row = $slave2_dbh->selectall_arrayref('SHOW SLAVE STATUS', {Slice => {}});
is( is(
$row->[0]->{master_port}, $row->[0]->{master_port},
'12346', '12346',
@@ -108,8 +118,8 @@ my (@innodb_versions) = $result =~ /$innodb_re/g;
$result =~ s/$innodb_re/InnoDB version BUILTIN/g; $result =~ s/$innodb_re/InnoDB version BUILTIN/g;
my $master_version = VersionParser->new($master_dbh); my $master_version = VersionParser->new($master_dbh);
my $slave_version = VersionParser->new($slave_dbh); my $slave_version = VersionParser->new($slave1_dbh);
my $slave2_version = VersionParser->new($slave_2_dbh); my $slave2_version = VersionParser->new($slave2_dbh);
is( is(
$innodb_versions[0], $innodb_versions[0],