mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
PT-2154 - Fix tests for pt-table-sync
- Removed junk comment from t/pt-table-sync/pt-2309.t - Re-enabled t/pt-table-sync/issue_96.t in 8.0+ - Re-enabled tests in t/pt-table-sync/pt-1256.t in 8.0.14+ - Re-enabled t/pt-table-sync/master_master.t in 8.0+ - Re-enabled t/pt-table-sync/lock_and_rename.t in 8.0+ - Re-enabled t/pt-table-sync/issue_965.t - Added proper disable comments into t/pt-table-sync/issue_920.t and t/pt-table-sync/issue_996.t
This commit is contained in:
@@ -19,7 +19,7 @@ my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
|
||||
plan skip_all => 'Pending solution';
|
||||
plan skip_all => 'Pending solution: waiting for the PT-2338 fix';
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -63,6 +63,8 @@ is_deeply(
|
||||
[[1,100],[2,200]],
|
||||
'Flipped 2nd table'
|
||||
);
|
||||
diag(`/tmp/12345/use -e "select * from issue_920.PK_UK_test order by id"`);
|
||||
diag(`/tmp/12345/use -e "select * from issue_920.PK_UK_test_2 order by id"`);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
@@ -24,8 +24,7 @@ if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan skip_all => 'This test is freezing';
|
||||
#plan tests => 2;
|
||||
plan tests => 2;
|
||||
}
|
||||
|
||||
$sb->wipe_clean($master_dbh);
|
||||
|
@@ -26,6 +26,9 @@ if ( !$master_dbh ) {
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
elsif ( $sandbox_version ge '8.0' ) {
|
||||
plan skip_all => 'Test fails due to https://bugs.mysql.com/bug.php?id=115017';
|
||||
}
|
||||
else {
|
||||
plan tests => 3;
|
||||
}
|
||||
@@ -36,7 +39,7 @@ my @args = ('--sync-to-master', 'h=127.1,P=12346,u=msandbox,p=msandbox',
|
||||
my $pt_table_checksum = "$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox -d issue_375 --chunk-size 20 --chunk-size-limit 0 --set-vars innodb_lock_wait_timeout=3";
|
||||
|
||||
# #############################################################################
|
||||
# Issue 996: might not chunk inside of mk-table-checksum's boundaries
|
||||
# Issue 996: might not chunk inside of pt-table-checksum's boundaries
|
||||
# #############################################################################
|
||||
|
||||
# Re-using this table for this issue. It has 100 pk rows.
|
||||
@@ -64,7 +67,7 @@ wait_until(
|
||||
0.5, 10,
|
||||
);
|
||||
|
||||
# mk-table-checksum the table with 5 chunks of 20 rows.
|
||||
# pt-table-checksum the table with 5 chunks of 20 rows.
|
||||
$output = `$pt_table_checksum --replicate issue_375.checksums`;
|
||||
is(
|
||||
PerconaTest::count_checksum_results($output, 'diffs'),
|
||||
@@ -72,13 +75,18 @@ is(
|
||||
"Chunk checksum diff"
|
||||
);
|
||||
|
||||
# Run mk-table-sync with the replicate table. Chunk size here is relative
|
||||
# to the mk-table-checksum ranges. So we sub-chunk the 20 row ranges into
|
||||
diag(`/tmp/12346/use -e "analyze table issue_375.t"`);
|
||||
diag(`/tmp/12345/use -e "EXPLAIN SELECT * FROM issue_375.t FORCE INDEX (PRIMARY) WHERE ((id >= '21')) AND ((id <= '40'))"`);
|
||||
diag(`/tmp/12345/use -e "SELECT * FROM issue_375.t FORCE INDEX (PRIMARY) WHERE ((id >= '21')) AND ((id <= '40'))"`);
|
||||
diag(`/tmp/12345/use -e "EXPLAIN ANALYZE SELECT * FROM issue_375.t FORCE INDEX (PRIMARY) WHERE ((id >= '21')) AND ((id <= '40'))"`);
|
||||
# Run pt-table-sync with the replicate table. Chunk size here is relative
|
||||
# to the pt-table-checksum ranges. So we sub-chunk the 20 row ranges into
|
||||
# 4 5-row sub-chunks.
|
||||
my $file = "/tmp/mts-output.txt";
|
||||
output(
|
||||
sub { pt_table_sync::main(@args, qw(--chunk-size 5 -v -v)) },
|
||||
file => $file,
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
# The output shows that the 20-row range was chunked into 4 5-row sub-chunks.
|
||||
@@ -98,6 +106,7 @@ is(
|
||||
",
|
||||
"Chunks within chunk"
|
||||
);
|
||||
diag(`cat $file`);
|
||||
|
||||
diag(`rm -rf $file >/dev/null`);
|
||||
|
@@ -29,8 +29,6 @@ if ( !$master_dbh ) {
|
||||
}
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
} elsif ($sandbox_version ge '8.0') {
|
||||
plan skip_all => "Skipped due to an error in MySQL 8.0.4-rc";
|
||||
} else {
|
||||
plan tests => 3;
|
||||
}
|
||||
|
@@ -18,11 +18,7 @@ require "$trunk/bin/pt-table-sync";
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
|
||||
if ($sandbox_version ge '8.0') {
|
||||
plan skip_all => "TODO master master sandbox is failing with MySQL 8.0+. FIX ME !!!!";
|
||||
} else {
|
||||
plan tests => 4;
|
||||
}
|
||||
plan tests => 4;
|
||||
|
||||
# #############################################################################
|
||||
# Ensure that syncing master-master works OK
|
||||
|
@@ -19,6 +19,7 @@ use Test::More;
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-table-sync";
|
||||
require VersionParser;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
@@ -49,6 +50,7 @@ $sb->load_file('master', "t/lib/samples/charset.sql");
|
||||
|
||||
my $put = encode('UTF-8','абвгд');
|
||||
my $want = 'абвгд';
|
||||
my $row;
|
||||
|
||||
$master_dbh->do("SET NAMES 'utf8'");
|
||||
$slave1_dbh->do("SET NAMES 'utf8'");
|
||||
@@ -72,21 +74,25 @@ like(
|
||||
"PT-1256 Set the correct charset"
|
||||
);
|
||||
|
||||
# 2
|
||||
my $row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t1 WHERE id = 1");
|
||||
is(
|
||||
$row->{f2},
|
||||
$want,
|
||||
"Character set is correct",
|
||||
) or diag("Want '".($want||"")."', got '".($row->{f2}||"")."'");
|
||||
|
||||
SKIP: {
|
||||
skip "Skipping in MySQL 8.0.4-rc since there is an error in the server itself", 2 if ($sandbox_version ge '8.0');
|
||||
my $vp = VersionParser->new($master_dbh);
|
||||
if ($vp->cmp('8.0') > -1 && $vp->cmp('8.0.14') < 0 && $vp->flavor() !~ m/maria/i) {
|
||||
skip "Skipping in MySQL 8.0.4-rc - 8.0.13 since there is an error in the server itself", 3;
|
||||
}
|
||||
# 2
|
||||
$row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t1 WHERE id = 1");
|
||||
is(
|
||||
$row->{f2},
|
||||
$want,
|
||||
"Character set is correct",
|
||||
) or diag("Want '".($want||"")."', got '".($row->{f2}||"")."'");
|
||||
|
||||
# 3
|
||||
$output = `$trunk/bin/pt-table-sync --execute --lock-and-rename h=127.1,P=12345,u=msandbox,p=msandbox,D=test,t=t1 t=t2 2>&1`;
|
||||
$output = `/tmp/12345/use -e 'show create table test.t2'`;
|
||||
like($output, qr/COMMENT='test1'/, '--lock-and-rename worked');
|
||||
|
||||
#4
|
||||
$row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t2 WHERE id = 1");
|
||||
is(
|
||||
$row->{f2},
|
||||
|
@@ -26,8 +26,6 @@ my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
||||
my $slave2_dbh = $sb->get_dbh_for('slave2');
|
||||
|
||||
#plan skip_all => 'Skipping';
|
||||
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
Reference in New Issue
Block a user