mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-21 10:17:18 +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:
@@ -59,7 +59,7 @@ keyring_cmd=""
|
|||||||
|
|
||||||
if [ -z "${DISABLE_KEYRING}" ]; then
|
if [ -z "${DISABLE_KEYRING}" ]; then
|
||||||
if [ -e "${BASEDIR}/lib/mysql/plugin/keyring_file.so" ]; then
|
if [ -e "${BASEDIR}/lib/mysql/plugin/keyring_file.so" ]; then
|
||||||
encryption_plugins="${BASEDIR}/lib/mysql/plugin/keyring_file.so"
|
encryption_plugins="keyring_file.so"
|
||||||
plugins_dir_cmd="--plugin-dir=${BASEDIR}/lib/mysql/plugin/"
|
plugins_dir_cmd="--plugin-dir=${BASEDIR}/lib/mysql/plugin/"
|
||||||
elif [ -e "${BASEDIR}/lib/plugin/keyring_file.so" ]; then
|
elif [ -e "${BASEDIR}/lib/plugin/keyring_file.so" ]; then
|
||||||
encryption_plugins="keyring_file.so"
|
encryption_plugins="keyring_file.so"
|
||||||
|
@@ -19,7 +19,7 @@ my $dp = new DSNParser(opts=>$dsn_opts);
|
|||||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||||
my $dbh = $sb->get_dbh_for('master');
|
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 ) {
|
if ( !$dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
@@ -63,6 +63,8 @@ is_deeply(
|
|||||||
[[1,100],[2,200]],
|
[[1,100],[2,200]],
|
||||||
'Flipped 2nd table'
|
'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.
|
# Done.
|
@@ -24,8 +24,7 @@ if ( !$master_dbh ) {
|
|||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plan skip_all => 'This test is freezing';
|
plan tests => 2;
|
||||||
#plan tests => 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sb->wipe_clean($master_dbh);
|
$sb->wipe_clean($master_dbh);
|
||||||
|
@@ -26,6 +26,9 @@ if ( !$master_dbh ) {
|
|||||||
elsif ( !$slave_dbh ) {
|
elsif ( !$slave_dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox slave';
|
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 {
|
else {
|
||||||
plan tests => 3;
|
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";
|
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.
|
# Re-using this table for this issue. It has 100 pk rows.
|
||||||
@@ -64,7 +67,7 @@ wait_until(
|
|||||||
0.5, 10,
|
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`;
|
$output = `$pt_table_checksum --replicate issue_375.checksums`;
|
||||||
is(
|
is(
|
||||||
PerconaTest::count_checksum_results($output, 'diffs'),
|
PerconaTest::count_checksum_results($output, 'diffs'),
|
||||||
@@ -72,13 +75,18 @@ is(
|
|||||||
"Chunk checksum diff"
|
"Chunk checksum diff"
|
||||||
);
|
);
|
||||||
|
|
||||||
# Run mk-table-sync with the replicate table. Chunk size here is relative
|
diag(`/tmp/12346/use -e "analyze table issue_375.t"`);
|
||||||
# to the mk-table-checksum ranges. So we sub-chunk the 20 row ranges into
|
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.
|
# 4 5-row sub-chunks.
|
||||||
my $file = "/tmp/mts-output.txt";
|
my $file = "/tmp/mts-output.txt";
|
||||||
output(
|
output(
|
||||||
sub { pt_table_sync::main(@args, qw(--chunk-size 5 -v -v)) },
|
sub { pt_table_sync::main(@args, qw(--chunk-size 5 -v -v)) },
|
||||||
file => $file,
|
file => $file,
|
||||||
|
stderr => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
# The output shows that the 20-row range was chunked into 4 5-row sub-chunks.
|
# The output shows that the 20-row range was chunked into 4 5-row sub-chunks.
|
||||||
@@ -98,6 +106,7 @@ is(
|
|||||||
",
|
",
|
||||||
"Chunks within chunk"
|
"Chunks within chunk"
|
||||||
);
|
);
|
||||||
|
diag(`cat $file`);
|
||||||
|
|
||||||
diag(`rm -rf $file >/dev/null`);
|
diag(`rm -rf $file >/dev/null`);
|
||||||
|
|
@@ -29,8 +29,6 @@ if ( !$master_dbh ) {
|
|||||||
}
|
}
|
||||||
elsif ( !$slave_dbh ) {
|
elsif ( !$slave_dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox slave';
|
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 {
|
} else {
|
||||||
plan tests => 3;
|
plan tests => 3;
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,7 @@ require "$trunk/bin/pt-table-sync";
|
|||||||
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);
|
||||||
|
|
||||||
if ($sandbox_version ge '8.0') {
|
plan tests => 4;
|
||||||
plan skip_all => "TODO master master sandbox is failing with MySQL 8.0+. FIX ME !!!!";
|
|
||||||
} else {
|
|
||||||
plan tests => 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Ensure that syncing master-master works OK
|
# Ensure that syncing master-master works OK
|
||||||
|
@@ -19,6 +19,7 @@ use Test::More;
|
|||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
use Sandbox;
|
use Sandbox;
|
||||||
require "$trunk/bin/pt-table-sync";
|
require "$trunk/bin/pt-table-sync";
|
||||||
|
require VersionParser;
|
||||||
|
|
||||||
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);
|
||||||
@@ -49,6 +50,7 @@ $sb->load_file('master', "t/lib/samples/charset.sql");
|
|||||||
|
|
||||||
my $put = encode('UTF-8','абвгд');
|
my $put = encode('UTF-8','абвгд');
|
||||||
my $want = 'абвгд';
|
my $want = 'абвгд';
|
||||||
|
my $row;
|
||||||
|
|
||||||
$master_dbh->do("SET NAMES 'utf8'");
|
$master_dbh->do("SET NAMES 'utf8'");
|
||||||
$slave1_dbh->do("SET NAMES 'utf8'");
|
$slave1_dbh->do("SET NAMES 'utf8'");
|
||||||
@@ -72,21 +74,25 @@ like(
|
|||||||
"PT-1256 Set the correct charset"
|
"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: {
|
||||||
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
|
# 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 = `$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'`;
|
$output = `/tmp/12345/use -e 'show create table test.t2'`;
|
||||||
like($output, qr/COMMENT='test1'/, '--lock-and-rename worked');
|
like($output, qr/COMMENT='test1'/, '--lock-and-rename worked');
|
||||||
|
|
||||||
|
#4
|
||||||
$row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t2 WHERE id = 1");
|
$row = $slave1_dbh->selectrow_hashref("SELECT f2 FROM test.t2 WHERE id = 1");
|
||||||
is(
|
is(
|
||||||
$row->{f2},
|
$row->{f2},
|
||||||
|
@@ -26,8 +26,6 @@ my $master_dbh = $sb->get_dbh_for('master');
|
|||||||
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
||||||
my $slave2_dbh = $sb->get_dbh_for('slave2');
|
my $slave2_dbh = $sb->get_dbh_for('slave2');
|
||||||
|
|
||||||
#plan skip_all => 'Skipping';
|
|
||||||
|
|
||||||
if ( !$master_dbh ) {
|
if ( !$master_dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user