From dac073125141738bf19791072cbfba5c48187c09 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Thu, 7 Jun 2012 10:25:44 -0400 Subject: [PATCH] Remove PerconaTest::wait_for_table() after calls to Sandbox::load_file() which now implicitly calls Sandbox::wait_for_slaves(). --- t/lib/CompareResults.t | 2 -- t/lib/CopyRowsInsertSelect.t | 1 - t/lib/NibbleIterator.t | 1 - t/lib/OobNibbleIterator.t | 1 - t/lib/TableParser.t | 1 - t/pt-archiver/check_slave_lag.t | 1 - t/pt-archiver/delete_more.t | 3 --- t/pt-archiver/gt_n.t | 1 - t/pt-archiver/issue_1225.t | 2 -- t/pt-archiver/issue_1229.t | 1 - t/pt-archiver/standard_options.t | 1 - t/pt-online-schema-change/basics.t | 24 ----------------------- t/pt-online-schema-change/privs.t | 1 - t/pt-online-schema-change/sanity_checks.t | 2 -- t/pt-table-checksum/basics.t | 3 --- t/pt-table-checksum/bugs.t | 2 -- t/pt-table-checksum/chunk_index.t | 1 - t/pt-table-checksum/chunk_size.t | 1 - t/pt-table-checksum/ignore_columns.t | 2 -- t/pt-table-sync/basics.t | 16 +++++++-------- t/pt-table-sync/bugs.t | 3 --- t/pt-table-sync/filters.t | 2 -- t/pt-table-sync/issue_1065.t | 1 - t/pt-table-sync/issue_560.t | 7 +------ t/pt-table-sync/issue_634.t | 23 ++++++++++++++++------ t/pt-table-sync/issue_804.t | 3 --- t/pt-table-sync/lock_and_rename.t | 5 +---- t/pt-table-sync/master_master.t | 1 - t/pt-table-sync/triggers.t | 5 ----- 29 files changed, 27 insertions(+), 90 deletions(-) diff --git a/t/lib/CompareResults.t b/t/lib/CompareResults.t index 23ff3d23..3832a69d 100644 --- a/t/lib/CompareResults.t +++ b/t/lib/CompareResults.t @@ -106,7 +106,6 @@ sub get_id { # ############################################################################# $sb->load_file('master', "t/lib/samples/compare-results.sql"); -PerconaTest::wait_for_table($dbh2, "test.t3", "f > 1"); $cr = new CompareResults( method => 'checksum', @@ -313,7 +312,6 @@ my $tmpdir = '/tmp/mk-upgrade-res'; diag(`rm -rf $tmpdir 2>/dev/null; mkdir $tmpdir`); $sb->load_file('master', "t/lib/samples/compare-results.sql"); -PerconaTest::wait_for_table($dbh2, "test.t3", "f > 1"); $cr = new CompareResults( method => 'rows', diff --git a/t/lib/CopyRowsInsertSelect.t b/t/lib/CopyRowsInsertSelect.t index 56e48644..62065af9 100644 --- a/t/lib/CopyRowsInsertSelect.t +++ b/t/lib/CopyRowsInsertSelect.t @@ -58,7 +58,6 @@ sub test_copy_table { my ($tbl, $col, $expect) = @args{qw(tbl col expect)}; $sb->load_file("master", "t/lib/samples/osc/$tbl"); - PerconaTest::wait_for_table($dbh, "osc.t", "id=5"); $dbh->do("USE osc"); $osc->copy( diff --git a/t/lib/NibbleIterator.t b/t/lib/NibbleIterator.t index b822f44e..3f088150 100644 --- a/t/lib/NibbleIterator.t +++ b/t/lib/NibbleIterator.t @@ -812,7 +812,6 @@ is( # Index case-sensitivity. # ############################################################################# $sb->load_file('master', "t/pt-table-checksum/samples/undef-arrayref-bug-995274.sql"); -PerconaTest::wait_for_table($dbh, "test.GroupMembers", "id=493076"); eval { $ni = make_nibble_iter( diff --git a/t/lib/OobNibbleIterator.t b/t/lib/OobNibbleIterator.t index 5987d32e..edc22e59 100644 --- a/t/lib/OobNibbleIterator.t +++ b/t/lib/OobNibbleIterator.t @@ -257,7 +257,6 @@ ok( # https://bugs.launchpad.net/percona-toolkit/+bug/987393 # ############################################################################# $sb->load_file('master', "t/pt-table-checksum/samples/empty-table-bug-987393.sql"); -PerconaTest::wait_for_table($dbh, "test.test_full", "id=1"); $ni = make_nibble_iter( db => 'test', diff --git a/t/lib/TableParser.t b/t/lib/TableParser.t index a335ddcc..ed3d7013 100644 --- a/t/lib/TableParser.t +++ b/t/lib/TableParser.t @@ -51,7 +51,6 @@ SKIP: { # Bug 932442: column with 2 spaces $sb->load_file('master', "t/pt-table-checksum/samples/2-space-col.sql"); - PerconaTest::wait_for_table($dbh, "test.t"); $ddl = $tp->get_create_table($dbh, qw(test t)); like( $ddl, diff --git a/t/pt-archiver/check_slave_lag.t b/t/pt-archiver/check_slave_lag.t index f39a16de..d7157d4f 100644 --- a/t/pt-archiver/check_slave_lag.t +++ b/t/pt-archiver/check_slave_lag.t @@ -42,7 +42,6 @@ my $cmd = "$trunk/bin/pt-archiver"; # Issue 758: Make mk-archiver wait for a slave # ############################################################################# $sb->load_file('master', 't/pt-archiver/samples/issue_758.sql'); -PerconaTest::wait_for_table($dbh2, "issue_758.t"); is_deeply( $dbh->selectall_arrayref('select * from issue_758.t'), diff --git a/t/pt-archiver/delete_more.t b/t/pt-archiver/delete_more.t index d2ce9a49..c632d61f 100644 --- a/t/pt-archiver/delete_more.t +++ b/t/pt-archiver/delete_more.t @@ -36,7 +36,6 @@ my $cmd = "perl -I $trunk/t/pt-archiver/samples $trunk/bin/pt-archiver"; # Bulk delete with limit that results in 2 chunks. # ########################################################################### $sb->load_file('master', "t/pt-archiver/samples/delete_more.sql"); -PerconaTest::wait_for_table($dbh, '`db`.`main_table-123`'); $dbh->do('use dm'); is_deeply( @@ -122,8 +121,6 @@ SKIP: { # Run it again without DSN b so changes should be made on slave. $sb->load_file('master', "t/pt-archiver/samples/delete_more.sql"); - PerconaTest::wait_for_table($slave_dbh, "`dm`.`main_table-123`", 'id=5'); - PerconaTest::wait_for_table($slave_dbh, "`dm`.`other_table-123`", 'id=r6'); is_deeply( $slave_dbh->selectall_arrayref('select * from `main_table-123` order by id'), diff --git a/t/pt-archiver/gt_n.t b/t/pt-archiver/gt_n.t index 5502cfb7..23eff652 100644 --- a/t/pt-archiver/gt_n.t +++ b/t/pt-archiver/gt_n.t @@ -35,7 +35,6 @@ my $cmd = "$trunk/bin/pt-archiver"; # Test the custom plugin gt_n. # ########################################################################### $sb->load_file('master', 't/pt-archiver/samples/gt_n.sql'); -PerconaTest::wait_for_table($dbh, 'gt_n.t1', 'status="ok"'); my $sql = 'select status, count(*) from gt_n.t1 group by status'; is_deeply( $dbh->selectall_arrayref($sql), diff --git a/t/pt-archiver/issue_1225.t b/t/pt-archiver/issue_1225.t index 0c26d165..f99489ec 100644 --- a/t/pt-archiver/issue_1225.t +++ b/t/pt-archiver/issue_1225.t @@ -32,7 +32,6 @@ my $output; # Issue 1152: mk-archiver columns option resulting in null archived table data # ############################################################################# $sb->load_file('master', 't/pt-archiver/samples/issue_1225.sql'); -PerconaTest::wait_for_table($dbh, 'issue_1225.t', "i=3"); $dbh->do('set names "utf8"'); my $original_rows = $dbh->selectall_arrayref('select * from issue_1225.t where i in (1, 2)'); @@ -70,7 +69,6 @@ ok( ); $sb->load_file('master', 't/pt-archiver/samples/issue_1225.sql'); -PerconaTest::wait_for_table($dbh, 'issue_1225.t', "i=3"); $output = output( sub { pt_archiver::main( diff --git a/t/pt-archiver/issue_1229.t b/t/pt-archiver/issue_1229.t index cb47f23c..a292688c 100644 --- a/t/pt-archiver/issue_1229.t +++ b/t/pt-archiver/issue_1229.t @@ -40,7 +40,6 @@ my $file = "/tmp/mk-archiver-file.txt"; # archive to file # ############################################################################# $sb->load_file('master', 't/pt-archiver/samples/issue_1225.sql'); -PerconaTest::wait_for_table($dbh, 'issue_1225.t', "i=2"); $dbh->do('set names "utf8"'); my $original_rows = $dbh->selectall_arrayref('select * from issue_1225.t where i in (1, 2)'); diff --git a/t/pt-archiver/standard_options.t b/t/pt-archiver/standard_options.t index 58f48809..cf3954fb 100644 --- a/t/pt-archiver/standard_options.t +++ b/t/pt-archiver/standard_options.t @@ -85,7 +85,6 @@ SKIP: { # This test will achive rows from dbh:test.table_1 to dbh2:test.table_2. $sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql'); - PerconaTest::wait_for_table($dbh2, 'test.table_2'); # Change passwords so defaults files won't work. $dbh->do('SET PASSWORD FOR msandbox = PASSWORD("foo")'); diff --git a/t/pt-online-schema-change/basics.t b/t/pt-online-schema-change/basics.t index 34bba68c..c2a85162 100644 --- a/t/pt-online-schema-change/basics.t +++ b/t/pt-online-schema-change/basics.t @@ -50,7 +50,6 @@ my $rows; # ############################################################################# $sb->load_file('master', "$sample/basic_no_fks.sql"); -PerconaTest::wait_for_table($slave_dbh, "pt_osc.t", "id=20"); $output = output( sub { $exit = pt_online_schema_change::main(@args, "$dsn,D=pt_osc,t=t", @@ -96,13 +95,6 @@ sub test_alter_table { if ( my $file = $args{file} ) { $sb->load_file('master', "$sample/$file"); - sleep 0.25; - if ( my $wait = $args{wait} ) { - PerconaTest::wait_for_table($slave_dbh, @$wait); - } - else { - PerconaTest::wait_for_table($slave_dbh, $table, "`$pk_col`=$args{max_id}"); - } $master_dbh->do("USE `$db`"); $slave_dbh->do("USE `$db`"); } @@ -366,7 +358,6 @@ test_alter_table( table => "pt_osc.country", pk_col => "country_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "rebuild_constraints", @@ -383,9 +374,6 @@ test_alter_table( name => "Basic FK rebuild --execute", table => "pt_osc.country", pk_col => "country_id", - # The previous test should not have modified the table. - # file => "basic_with_fks.sql", - # wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "rebuild_constraints", @@ -408,7 +396,6 @@ test_alter_table( table => "pt_osc.country", pk_col => "country_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "drop_swap", @@ -425,9 +412,6 @@ test_alter_table( name => "Basic FK drop_swap --execute", table => "pt_osc.country", pk_col => "country_id", - # The previous test should not have modified the table. - # file => "basic_with_fks.sql", - # wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "drop_swap", @@ -451,7 +435,6 @@ test_alter_table( table => "pt_osc.country", pk_col => "country_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "rebuild_constraints", @@ -470,7 +453,6 @@ test_alter_table( table => "pt_osc.address", pk_col => "address_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "new_engine", new_engine => "innodb", cmds => [ @@ -489,7 +471,6 @@ test_alter_table( table => "pt_osc.address", pk_col => "address_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", cmds => [ @@ -508,7 +489,6 @@ test_alter_table( table => "pt_osc.city", pk_col => "city_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "drop_col", drop_col => "last_update", check_fks => "rebuild_constraints", @@ -556,7 +536,6 @@ SKIP: { # ############################################################################# diag('Loading file and waiting for replication...'); $sb->load_file('master', "$sample/basic_with_fks.sql"); -PerconaTest::wait_for_table($slave_dbh, "pt_osc.address", "address_id=5"); # Specify --alter-foreign-keys-method for a table with no child tables. test_alter_table( @@ -564,7 +543,6 @@ test_alter_table( table => "pt_osc.country", pk_col => "country_id", file => "basic_with_fks.sql", - wait => ["pt_osc.address", "address_id=5"], test_type => "new_engine", new_engine => "innodb", cmds => [ @@ -592,8 +570,6 @@ sub test_table { my ($file, $name) = @args{qw(file name)}; $sb->load_file('master', "t/lib/samples/osc/$file"); - PerconaTest::wait_for_table($master_dbh, "osc.t", "id=5"); - PerconaTest::wait_for_table($master_dbh, "osc.__new_t"); $master_dbh->do('use osc'); $master_dbh->do("DROP TABLE IF EXISTS osc.__new_t"); diff --git a/t/pt-online-schema-change/privs.t b/t/pt-online-schema-change/privs.t index 2ff09e58..0a64ac33 100644 --- a/t/pt-online-schema-change/privs.t +++ b/t/pt-online-schema-change/privs.t @@ -55,7 +55,6 @@ diag(`/tmp/12345/use -u root < $trunk/$sample/osc-user.sql`); PerconaTest::wait_for_table($slave1_dbh, "mysql.tables_priv", "user='osc_user'"); $sb->load_file('master', "$sample/basic_no_fks.sql"); -PerconaTest::wait_for_table($slave1_dbh, "pt_osc.t", "id=20"); $output = output( sub { $exit_status = pt_online_schema_change::main(@args, diff --git a/t/pt-online-schema-change/sanity_checks.t b/t/pt-online-schema-change/sanity_checks.t index 91e33dd2..4b40c4c8 100644 --- a/t/pt-online-schema-change/sanity_checks.t +++ b/t/pt-online-schema-change/sanity_checks.t @@ -61,7 +61,6 @@ throws_ok( ); $sb->load_file('master', "$sample/basic_no_fks.sql"); -PerconaTest::wait_for_table($slave_dbh, "pt_osc.t", "id=20"); $master_dbh->do("USE pt_osc"); $slave_dbh->do("USE pt_osc"); @@ -90,7 +89,6 @@ throws_ok( # ############################################################################# $sb->load_file('master', "$sample/basic_no_fks.sql"); -PerconaTest::wait_for_table($slave_dbh, "pt_osc.t", "id=20"); $master_dbh->do("USE pt_osc"); $slave_dbh->do("USE pt_osc"); diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index a94fd479..85ba7836 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -260,7 +260,6 @@ is( # ############################################################################ $master_dbh->do('truncate table percona.checksums'); $sb->load_file('master', "t/pt-table-checksum/samples/3tbl-resume.sql"); -PerconaTest::wait_for_table($slave1_dbh, 'test.t3', "id=26"); $master_dbh->do('set sql_log_bin=0'); $master_dbh->do('truncate table test.t1'); @@ -405,7 +404,6 @@ like( # Bug 932442: column with 2 spaces # ############################################################################# $sb->load_file('master', "t/pt-table-checksum/samples/2-space-col.sql"); -PerconaTest::wait_for_table($master_dbh, "test.t", "id=10"); $output = output( sub { $exit_status = pt_table_checksum::main(@args, @@ -429,7 +427,6 @@ is( # Bug 821675: can't parse column names containing periods # ############################################################################# $sb->load_file('master', "t/pt-table-checksum/samples/dot.sql"); -PerconaTest::wait_for_table($master_dbh, "test.t", "`No.`='ten'"); ok( no_diff( diff --git a/t/pt-table-checksum/bugs.t b/t/pt-table-checksum/bugs.t index 62e428b0..431a9e18 100644 --- a/t/pt-table-checksum/bugs.t +++ b/t/pt-table-checksum/bugs.t @@ -55,7 +55,6 @@ my $sample = "t/pt-table-checksum/samples/"; # line 2206 # ############################################################################ $sb->load_file('master', "$sample/undef-arrayref-bug-995274.sql"); -PerconaTest::wait_for_table($slave_dbh, "test.GroupMembers", "id=493076"); # Must chunk the table so an index is used. $output = output( @@ -84,7 +83,6 @@ cmp_ok( # ############################################################################# $master_dbh->do("DROP DATABASE IF EXISTS percona"); # clear old checksums $sb->load_file('master', "$sample/empty-table-bug-987393.sql"); -PerconaTest::wait_for_table($slave_dbh, "test.test_full", "id=1"); $output = output( sub { $exit_status = pt_table_checksum::main( diff --git a/t/pt-table-checksum/chunk_index.t b/t/pt-table-checksum/chunk_index.t index 824329eb..e15c88ce 100644 --- a/t/pt-table-checksum/chunk_index.t +++ b/t/pt-table-checksum/chunk_index.t @@ -145,7 +145,6 @@ is( # Bug 978432: PK is ignored # ############################################################################# $sb->load_file('master', "t/pt-table-checksum/samples/not-using-pk-bug.sql"); -PerconaTest::wait_for_table($dbh, "test.multi_resource_apt", "apt_id=4 AND res_id=4"); ok( no_diff( diff --git a/t/pt-table-checksum/chunk_size.t b/t/pt-table-checksum/chunk_size.t index 09f19a67..d8250067 100644 --- a/t/pt-table-checksum/chunk_size.t +++ b/t/pt-table-checksum/chunk_size.t @@ -117,7 +117,6 @@ $master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-table-checksum/samples/600c $master_dbh->do("SET SQL_LOG_BIN=0"); $master_dbh->do("DELETE FROM test.t WHERE id > 100"); $master_dbh->do("SET SQL_LOG_BIN=1"); -PerconaTest::wait_for_table($slave_dbh, "test.t", "id=600"); # Now there are 100 rows on the master and 600 on the slave. $output = output( diff --git a/t/pt-table-checksum/ignore_columns.t b/t/pt-table-checksum/ignore_columns.t index 01d40a2c..56e4f8c0 100644 --- a/t/pt-table-checksum/ignore_columns.t +++ b/t/pt-table-checksum/ignore_columns.t @@ -41,8 +41,6 @@ my $output; $sb->create_dbs($master_dbh, [qw(test)]); $sb->load_file('master', 't/pt-table-checksum/samples/issue_94.sql'); - -PerconaTest::wait_for_table($slave_dbh, 'test.issue_94', 'a=11'); $slave_dbh->do("update test.issue_94 set c=''"); $output = output( diff --git a/t/pt-table-sync/basics.t b/t/pt-table-sync/basics.t index 089d48ac..c3623a26 100644 --- a/t/pt-table-sync/basics.t +++ b/t/pt-table-sync/basics.t @@ -31,8 +31,6 @@ else { plan tests => 22; } -$sb->wipe_clean($master_dbh); -$sb->wipe_clean($slave_dbh); $sb->create_dbs($master_dbh, [qw(test)]); sub query_slave { @@ -171,11 +169,14 @@ $ENV{PTDEBUG} = $dbg || 0; # ########################################################################### # Fix bug 911996. # ########################################################################### + +# pt-table-checksum waits for all checksums to replicate to all slaves, +# so no need to call $sb->wait_for_slaves() after this. `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --max-load '' --lock-wait 3 --chunk-size 50 --chunk-index idx_actor_last_name -t sakila.actor --quiet`; -PerconaTest::wait_for_table($slave_dbh, "percona.checksums", "db='sakila' and tbl='actor' and chunk=7"); $slave_dbh->do("update percona.checksums set this_crc='' where db='sakila' and tbl='actor' and chunk=3"); $slave_dbh->do("update sakila.actor set last_name='' where actor_id=30"); +$sb->wait_for_slaves(); # wait for those ^ updates to replicate to slave2 (!2347) $output = output( sub { @@ -200,14 +201,12 @@ is( # Fix bug 927771. $sb->load_file('master', 't/pt-table-sync/samples/bug_927771.sql'); -PerconaTest::wait_for_table($slave_dbh, "test.t", "c='j'"); - $slave_dbh->do("update test.t set c='z' where id>8"); +# pt-table-checksum waits for all checksums to replicate to all slaves, +# so no need to call $sb->wait_for_slaves() after this. `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --max-load '' --lock-wait 3 --chunk-size 2 -t test.t --quiet`; -PerconaTest::wait_for_table($slave_dbh, "percona.checksums", "db='test' and tbl='t' and chunk=4"); - $output = output( sub { pt_table_sync::main('h=127.1,P=12345,u=msandbox,p=msandbox', @@ -217,13 +216,14 @@ $output = output( stderr => 1, ); +$sb->wait_for_slaves(); # wait for sync to replicate + like( $output, qr/REPLACE INTO `test`.`t`\(`id`, `c`\) VALUES \('9', 'i'\)/, "--replicate with uc index (bug 927771)" ); -PerconaTest::wait_for_table($slave_dbh, "test.t", "id=10 AND c='j'"); my $rows = $slave_dbh->selectall_arrayref("select id, c from test.t where id>8 order by id"); is_deeply( $rows, diff --git a/t/pt-table-sync/bugs.t b/t/pt-table-sync/bugs.t index f33882ad..f1a6e2a0 100644 --- a/t/pt-table-sync/bugs.t +++ b/t/pt-table-sync/bugs.t @@ -41,7 +41,6 @@ my $slave_dsn = "h=127.1,P=12346,u=msandbox,p=msandbox"; # ############################################################################# $sb->load_file('master', "$sample/wrong-tbl-struct-bug-1003014.sql"); -PerconaTest::wait_for_table($slave_dbh, "test.zzz", "id=111"); # Make a diff in each table. $slave_dbh->do("DELETE FROM test.aaa WHERE STOP_ARCHIVE IN (5,6,7)"); @@ -107,9 +106,7 @@ is_deeply( # ######################################################################### $sb->wipe_clean($master_dbh); - $sb->load_file('master', "$sample/wrong-tbl-struct-bug-1003014.sql"); -PerconaTest::wait_for_table($slave_dbh, "test.zzz", "id=111"); $slave_dbh->do("DELETE FROM test.aaa WHERE STOP_ARCHIVE IN (5,6,7)"); $slave_dbh->do("UPDATE test.zzz SET c='x' WHERE id IN (44,45,46)"); diff --git a/t/pt-table-sync/filters.t b/t/pt-table-sync/filters.t index 5d7d6f45..9c2d432a 100644 --- a/t/pt-table-sync/filters.t +++ b/t/pt-table-sync/filters.t @@ -110,9 +110,7 @@ is( # https://bugs.launchpad.net/percona-toolkit/+bug/1002365 # ############################################################################# $sb->wipe_clean($master_dbh); - $sb->load_file("master", "t/pt-table-sync/samples/simple-tbls.sql"); -PerconaTest::wait_for_table($slave_dbh, "test.mt1", "id=10"); # Create a checksum diff in a table that we're going to ignore # when we sync. diff --git a/t/pt-table-sync/issue_1065.t b/t/pt-table-sync/issue_1065.t index ea61787f..166e0495 100644 --- a/t/pt-table-sync/issue_1065.t +++ b/t/pt-table-sync/issue_1065.t @@ -42,7 +42,6 @@ my @args = ('--sync-to-master', 'h=127.1,P=12346,u=msandbox,p=msandbox', # Issue 1065: mk-table-sync --algorithm seems to be case-sensitive # ############################################################################# $sb->load_file('master', "t/pt-table-sync/samples/simple-tbls.sql"); -PerconaTest::wait_for_table($slave1_dbh, "test.it1", "id=10"); $slave1_dbh->do("delete from test.it1 where id=1 limit 1"); diff --git a/t/pt-table-sync/issue_560.t b/t/pt-table-sync/issue_560.t index 59f77282..1183b67e 100644 --- a/t/pt-table-sync/issue_560.t +++ b/t/pt-table-sync/issue_560.t @@ -31,15 +31,10 @@ else { plan tests => 3; } -$sb->wipe_clean($master_dbh); -$sb->wipe_clean($slave_dbh); -$sb->create_dbs($master_dbh, [qw(test)]); - # ############################################################################# # Issue 560: mk-table-sync generates impossible WHERE # ############################################################################# -diag(`/tmp/12345/use < $trunk/t/pt-table-sync/samples/issue_560.sql`); -PerconaTest::wait_for_table($slave_dbh, "issue_560.buddy_list", "player_id=353"); +$sb->load_file("master", "t/pt-table-sync/samples/issue_560.sql"); # Make slave differ. $slave_dbh->do('UPDATE issue_560.buddy_list SET buddy_id=0 WHERE player_id IN (333,334)'); diff --git a/t/pt-table-sync/issue_634.t b/t/pt-table-sync/issue_634.t index 328a6637..b4b9e270 100644 --- a/t/pt-table-sync/issue_634.t +++ b/t/pt-table-sync/issue_634.t @@ -28,7 +28,7 @@ elsif ( !$slave_dbh ) { plan skip_all => 'Cannot connect to sandbox slave'; } else { - plan tests => 3; + plan tests => 4; } $sb->wipe_clean($master_dbh); @@ -37,16 +37,28 @@ $sb->create_dbs($master_dbh, [qw(test)]); # ############################################################################# # Issue 634: Cannot nibble table because MySQL chose no index # ############################################################################# -diag(`/tmp/12345/use < $trunk/t/pt-table-sync/samples/issue_634.sql`); -PerconaTest::wait_for_table($slave_dbh, 'issue_634.t', '1=1' ); +$sb->load_file('master', "t/pt-table-sync/samples/issue_634.sql"); $slave_dbh->do('insert into issue_634.t values (1)'); -$output = `$trunk/bin/pt-table-sync --sync-to-master h=127.1,P=12346,u=msandbox,p=msandbox -d issue_634 --execute --algorithms Nibble 2>&1`; + +$output = output( + sub { pt_table_sync::main("h=127.1,P=12346,u=msandbox,p=msandbox", + qw(--sync-to-master -d issue_634 --print --execute --algorithms Nibble)) + }, + stderr => 1, +); + +like( + $output, + qr/DELETE FROM `issue_634`.`t` WHERE `i`='1' LIMIT 1/, + "DELETE statement (issue 634)" +); + unlike( $output, qr/Cannot nibble/, "Doesn't say it can't nibble the 1-row table (issue 634)" ); -$sb->wait_for_slaves(); + is_deeply( $slave_dbh->selectall_arrayref('select * from issue_634.t'), [], @@ -57,6 +69,5 @@ is_deeply( # Done. # ############################################################################# $sb->wipe_clean($master_dbh); -$sb->wipe_clean($slave_dbh); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); exit; diff --git a/t/pt-table-sync/issue_804.t b/t/pt-table-sync/issue_804.t index 0db264d8..d9dc3d8e 100644 --- a/t/pt-table-sync/issue_804.t +++ b/t/pt-table-sync/issue_804.t @@ -31,10 +31,7 @@ else { plan tests => 2; } -$sb->wipe_clean($master_dbh); -$sb->wipe_clean($slave_dbh); $sb->load_file('master', 't/lib/samples/issue_804.sql'); -PerconaTest::wait_for_table($slave_dbh, "issue_804.t", "accountId=100"); # ############################################################################# # Issue 804: mk-table-sync: can't nibble because index name isn't lower case? diff --git a/t/pt-table-sync/lock_and_rename.t b/t/pt-table-sync/lock_and_rename.t index a83d6ffd..24b47cca 100644 --- a/t/pt-table-sync/lock_and_rename.t +++ b/t/pt-table-sync/lock_and_rename.t @@ -35,14 +35,11 @@ else { plan tests => 3; } -$sb->wipe_clean($master_dbh); -$sb->create_dbs($master_dbh, [qw(test)]); - # ############################################################################# # Issue 363: lock and rename. # ############################################################################# +$sb->create_dbs($master_dbh, [qw(test)]); $sb->load_file('master', 't/pt-table-sync/samples/before.sql'); -PerconaTest::wait_for_table($slave_dbh, "test.test2"); $output = `$trunk/bin/pt-table-sync --lock-and-rename h=127.1,P=12345 P=12346 2>&1`; like($output, qr/requires exactly two/, diff --git a/t/pt-table-sync/master_master.t b/t/pt-table-sync/master_master.t index 059a8d2b..3f1720e2 100644 --- a/t/pt-table-sync/master_master.t +++ b/t/pt-table-sync/master_master.t @@ -31,7 +31,6 @@ my $master2_dbh = $sb->get_dbh_for('master2'); # Load some tables and data (on both, since they're master-master). $master1_dbh->do("CREATE DATABASE test"); $sb->load_file("master1", "t/pt-table-sync/samples/before.sql"); -PerconaTest::wait_for_table($master2_dbh, "test.test1", "a=2"); # Make master2 different from master1. So master2 has the _correct_ data, # and the sync below will make master1 have that data too. diff --git a/t/pt-table-sync/triggers.t b/t/pt-table-sync/triggers.t index 38a14aaf..33ecfe97 100644 --- a/t/pt-table-sync/triggers.t +++ b/t/pt-table-sync/triggers.t @@ -98,11 +98,6 @@ like( diag('Loading file and waiting for replication'); $sb->load_file('master', 't/pt-table-sync/samples/issue_367.sql'); -PerconaTest::wait_for_table( - $slave_dbh, - "$_.t1", - "id > 4" -) for qw( db1 db2 ); # Make slave db1.t1 and db2.t1 differ from master. $slave_dbh->do('INSERT INTO db1.t1 VALUES (9)');