mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-14 01:00:23 +08:00
Change mk_tool::main() to pt_tool::main() in all tests.
This commit is contained in:
@@ -35,7 +35,7 @@ $sb->create_dbs($master_dbh, [qw(test)]);
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/before.sql');
|
||||
|
||||
# Test basic functionality with defaults
|
||||
$output = output(sub { mk_table_checksum::main(@args) } );
|
||||
$output = output(sub { pt_table_checksum::main(@args) } );
|
||||
like($output, qr/^DATABASE/m, 'The header row is there');
|
||||
like($output, qr/checksum_test/, 'The results row is there');
|
||||
|
||||
@@ -55,7 +55,7 @@ else {
|
||||
|
||||
# Test that it works with locking
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--lock --slave-lag),
|
||||
sub { pt_table_checksum::main(@args, qw(--lock --slave-lag),
|
||||
qw(--function sha1 --checksum --algorithm ACCUM)) }
|
||||
);
|
||||
like($output, qr/9c1c01dc3ac1445a500251fc34a15d3e75a849df/, 'Locks' );
|
||||
@@ -65,41 +65,41 @@ SKIP: {
|
||||
unless $vp->version_ge($master_dbh, '4.1.0');
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--function CRC32 --checksum --algorithm ACCUM)) }
|
||||
);
|
||||
like($output, qr/00000001E9F5DC8E/, 'CRC32 ACCUM' );
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--function sha1 --checksum --algorithm ACCUM)) }
|
||||
);
|
||||
like($output, qr/9c1c01dc3ac1445a500251fc34a15d3e75a849df/, 'SHA1 ACCUM' );
|
||||
|
||||
# same as sha1(1)
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--function sha1 --checksum --algorithm BIT_XOR)) }
|
||||
);
|
||||
like($output, qr/356a192b7913b04c54574d18c28d46e6395428ab/, 'SHA1 BIT_XOR' );
|
||||
|
||||
# test that I get the same result with --no-optxor
|
||||
$output2 = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--function sha1 --no-optimize-xor --checksum --algorithm BIT_XOR)) }
|
||||
);
|
||||
is($output, $output2, 'Same result with --no-optxor');
|
||||
|
||||
# same as sha1(1)
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--checksum --function MD5 --algorithm BIT_XOR)) }
|
||||
);
|
||||
like($output, qr/c4ca4238a0b923820dcc509a6f75849b/, 'MD5 BIT_XOR' );
|
||||
};
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--checksum --function MD5 --algorithm ACCUM)) }
|
||||
);
|
||||
like($output, qr/28c8edde3d61a0411511d3b1866f0636/, 'MD5 ACCUM' );
|
||||
@@ -112,7 +112,7 @@ like($output, qr/28c8edde3d61a0411511d3b1866f0636/, 'MD5 ACCUM' );
|
||||
# Issue 1256: mk-tabe-checksum: if no rows are found in a chunk, don't perform the sleep
|
||||
my $t0 = time;
|
||||
output(
|
||||
sub { mk_table_checksum::main("F=$cnf",
|
||||
sub { pt_table_checksum::main("F=$cnf",
|
||||
qw(--sleep 5 -t mysql.user --chunk-size 100)) },
|
||||
);
|
||||
ok(
|
||||
|
||||
@@ -36,7 +36,7 @@ $sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20 --explain)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii-explain.txt",
|
||||
),
|
||||
@@ -45,7 +45,7 @@ ok(
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii.txt",
|
||||
),
|
||||
@@ -54,7 +54,7 @@ ok(
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20 --chunk-size-limit 3)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii-oversize.txt",
|
||||
),
|
||||
|
||||
@@ -42,7 +42,7 @@ issue_519 t `i` >= '10'
|
||||
";
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -52,7 +52,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-column batman)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-column batman)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -62,7 +62,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-column t)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-column t)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -72,7 +72,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-column i --chunk-index y)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-column i --chunk-index y)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -82,7 +82,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-column y)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-column y)) },
|
||||
);
|
||||
|
||||
is(
|
||||
|
||||
@@ -42,7 +42,7 @@ issue_519 t `i` >= '10'
|
||||
";
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -52,7 +52,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-index dog)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-index dog)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -62,7 +62,7 @@ is(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-index myidx)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-index myidx)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -78,7 +78,7 @@ issue_519 t `i` >= '10'
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-index y)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-index y)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -96,7 +96,7 @@ issue_519 t `y` >= '2009'
|
||||
# Disabling the index hint with --no-use-index should not affect the
|
||||
# chunks. It should only remove the FORCE INDEX clause from the SQL.
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-index y --no-use-index)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-index y --no-use-index)) },
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -122,7 +122,7 @@ issue_519 t `y` >= '2009'
|
||||
# Given the --where clause, MySQL will prefer the y index.
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, "--where", "y > 2009") },
|
||||
sub { pt_table_checksum::main(@args, "--where", "y > 2009") },
|
||||
);
|
||||
|
||||
is(
|
||||
|
||||
@@ -63,7 +63,7 @@ like(
|
||||
);
|
||||
|
||||
output(
|
||||
sub { mk_table_checksum::main('-F', $cnf,
|
||||
sub { pt_table_checksum::main('-F', $cnf,
|
||||
qw(--create-replicate-table --replicate test.checksum 127.1)) },
|
||||
stderr => 0,
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@ $dbh->do('create table t1 (i int) engine=myisam');
|
||||
$dbh->do('create table t2 (i int) engine=innodb');
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--explain -d test --engines InnoDB)) },
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ is(
|
||||
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--explain -d mysql --tables-regex user)) },
|
||||
);
|
||||
like(
|
||||
@@ -60,7 +60,7 @@ like(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--explain -d mysql --ignore-tables-regex user)) },
|
||||
);
|
||||
unlike(
|
||||
@@ -70,7 +70,7 @@ unlike(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args,
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--explain -d mysql --ignore-databases-regex mysql)) },
|
||||
);
|
||||
is(
|
||||
|
||||
@@ -36,7 +36,7 @@ $sb->load_file('master', 't/pt-table-checksum/samples/checksum_tbl.sql');
|
||||
# #############################################################################
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(--replicate=test.checksum --replicate-check=0)) },
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(--replicate=test.checksum --replicate-check=0)) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ $sb->load_file('master', 't/pt-table-checksum/samples/issue_602.sql');
|
||||
|
||||
$output = output(
|
||||
sub {
|
||||
mk_table_checksum::main("F=$cnf", qw(-t issue_602.t --chunk-size 5)) },
|
||||
pt_table_checksum::main("F=$cnf", qw(-t issue_602.t --chunk-size 5)) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
# #############################################################################
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(-d mysql -t user)) },
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(-d mysql -t user)) },
|
||||
stderr => 1,
|
||||
);
|
||||
like(
|
||||
|
||||
@@ -68,7 +68,7 @@ diag(`/tmp/12345/start >/dev/null`);
|
||||
diag(`/tmp/12346/start >/dev/null`);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
qw(--replicate=test.checksum -d mysql -t user --empty-replicate-table))
|
||||
},
|
||||
stderr => 1,
|
||||
@@ -114,7 +114,7 @@ $master_dbh = $sb->get_dbh_for('master');
|
||||
$slave_dbh = $sb->get_dbh_for('slave1');
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
qw(--replicate=test.checksum -d mysql -t user))
|
||||
},
|
||||
stderr => 1,
|
||||
@@ -142,7 +142,7 @@ ok(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(--no-check-replication-filters),
|
||||
qw(--replicate=test.checksum -d mysql -t user),
|
||||
qw(--replicate-database test))
|
||||
},
|
||||
@@ -181,7 +181,7 @@ sleep 1;
|
||||
my $it = "payment,rental,help_topic,help_keyword,inventory,film_actor";
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf",
|
||||
sub { pt_table_checksum::main("F=$cnf",
|
||||
qw(--replicate=test.checksum), '--ignore-tables', $it, qw(--chunk-size 20k))
|
||||
},
|
||||
stderr => 1,
|
||||
@@ -203,7 +203,7 @@ diag(`$trunk/sandbox/test-env reset`);
|
||||
sleep 1;
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main("F=$cnf", qw(--replicate-database test),
|
||||
sub { pt_table_checksum::main("F=$cnf", qw(--replicate-database test),
|
||||
qw(--replicate=test.checksum), '--ignore-tables', $it, qw(--chunk-size 20k))
|
||||
},
|
||||
stderr => 1,
|
||||
|
||||
@@ -35,7 +35,7 @@ diag(`/tmp/12345/use < $trunk/t/pt-table-checksum/samples/oversize-chunks.sql`);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
"t/pt-table-checksum/samples/oversize-chunks.txt",
|
||||
),
|
||||
"Skip oversize chunk"
|
||||
@@ -43,7 +43,7 @@ ok(
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-size-limit 0)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-size-limit 0)) },
|
||||
"t/pt-table-checksum/samples/oversize-chunks-allowed.txt"
|
||||
),
|
||||
"Allow oversize chunk"
|
||||
|
||||
@@ -81,7 +81,7 @@ system("sleep 3 && /tmp/12347/use -e 'start slave sql_thread' >/dev/null 2>/dev/
|
||||
# should see slave2 come alive in 2 seconds then return before wait_for
|
||||
# dies.
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args); },
|
||||
sub { pt_table_checksum::main(@args); },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ like(
|
||||
# #############################################################################
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--function sha1)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--function sha1)) },
|
||||
);
|
||||
$output2 = `/tmp/12345/use --skip-column-names -e "select this_crc from test.checksum where tbl='checksum_test'"`;
|
||||
my ($cnt, $crc) = $output =~ m/checksum_test *\d+ \S+ \S+ *(\d+|NULL) *(\w+)/;
|
||||
@@ -133,7 +133,7 @@ SKIP: {
|
||||
set_tx_isolation('read committed');
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
);
|
||||
like(
|
||||
|
||||
@@ -40,7 +40,7 @@ diag(`echo "replicate-ignore-db=foo" >> /tmp/12346/my.sandbox.cnf`);
|
||||
diag(`/tmp/12346/start >/dev/null`);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, '--create-replicate-table') },
|
||||
sub { pt_table_checksum::main(@args, '--create-replicate-table') },
|
||||
stderr => 1,
|
||||
);
|
||||
unlike(
|
||||
@@ -60,7 +60,7 @@ like(
|
||||
# when no --replicate
|
||||
# #############################################################################
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main('h=127.1,P=12346,u=msandbox,p=msandbox',
|
||||
sub { pt_table_checksum::main('h=127.1,P=12346,u=msandbox,p=msandbox',
|
||||
qw(-d sakila -t film --schema --no-check-replication-filters)) },
|
||||
);
|
||||
like(
|
||||
|
||||
@@ -46,7 +46,7 @@ my $pid = fork();
|
||||
if ( !$pid ) {
|
||||
# child
|
||||
my $output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
);
|
||||
exit 0;
|
||||
@@ -78,7 +78,7 @@ $pid = fork();
|
||||
if ( !$pid ) {
|
||||
# child
|
||||
my $output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
file => $outfile,
|
||||
);
|
||||
|
||||
@@ -58,7 +58,7 @@ wait_until( # slaves aren't lagging
|
||||
return 1;
|
||||
}, 0.5, 10);
|
||||
|
||||
mk_table_checksum::main(@args);
|
||||
pt_table_checksum::main(@args);
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
is(
|
||||
@@ -85,7 +85,7 @@ is(
|
||||
local *STDERR;
|
||||
open STDERR, ">/dev/null"
|
||||
or die "Cannot redirect STDERR to /dev/null: $OS_ERROR";
|
||||
wait_for(sub { mk_table_checksum::main(@args); }, 2);
|
||||
wait_for(sub { pt_table_checksum::main(@args); }, 2);
|
||||
}
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
@@ -118,7 +118,7 @@ system("sleep 2 && /tmp/12347/use -e 'start slave sql_thread' >/dev/null 2>/dev/
|
||||
# This time we do not need to capture STDERR because mk-table-checksum
|
||||
# should see slave2 come alive in 2 seconds then return before wait_for
|
||||
# dies.
|
||||
wait_for(sub { mk_table_checksum::main(@args); }, 5);
|
||||
wait_for(sub { pt_table_checksum::main(@args); }, 5);
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
is(
|
||||
@@ -147,7 +147,7 @@ is(
|
||||
'Stopped slave SQL thread on slave2'
|
||||
);
|
||||
|
||||
wait_for(sub { mk_table_checksum::main(@args, qw(--check-slave-lag P=12346)); }, 2);
|
||||
wait_for(sub { pt_table_checksum::main(@args, qw(--check-slave-lag P=12346)); }, 2);
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
is(
|
||||
@@ -178,7 +178,7 @@ is(
|
||||
local *STDERR;
|
||||
open STDERR, ">/dev/null"
|
||||
or die "Cannot redirect STDERR to /dev/null: $OS_ERROR";
|
||||
wait_for(sub { mk_table_checksum::main(@args, qw(--check-slave-lag P=12346)); }, 2);
|
||||
wait_for(sub { pt_table_checksum::main(@args, qw(--check-slave-lag P=12346)); }, 2);
|
||||
}
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
@@ -221,7 +221,7 @@ is(
|
||||
);
|
||||
|
||||
# All slaves are stopped at this point.
|
||||
wait_for(sub { mk_table_checksum::main(@args, qw(--throttle-method none)) }, 2);
|
||||
wait_for(sub { pt_table_checksum::main(@args, qw(--throttle-method none)) }, 2);
|
||||
|
||||
$row = $master_dbh->selectall_arrayref('select * from test.checksum');
|
||||
is(
|
||||
|
||||
@@ -36,7 +36,7 @@ $dbh->do('alter table osc.t drop index `i`');
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-size 10)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-size 10)) },
|
||||
"t/pt-table-checksum/samples/unchunkable-table.txt",
|
||||
),
|
||||
"Skip unchunkable table"
|
||||
@@ -44,7 +44,7 @@ ok(
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { mk_table_checksum::main(@args, qw(--chunk-size 1000)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-size 1000)) },
|
||||
"t/pt-table-checksum/samples/unchunkable-table-small.txt",
|
||||
),
|
||||
"Chunk unchunable table if smaller than chunk size"
|
||||
|
||||
@@ -32,7 +32,7 @@ my $cnf='/tmp/12345/my.sandbox.cnf';
|
||||
my @args = ('-F', $cnf, 'h=127.1', qw(-t sakila.actor --explain --chunk-size 100));
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args) },
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
);
|
||||
like(
|
||||
$output,
|
||||
@@ -41,7 +41,7 @@ like(
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { mk_table_checksum::main(@args, qw(--no-zero-chunk)) },
|
||||
sub { pt_table_checksum::main(@args, qw(--no-zero-chunk)) },
|
||||
);
|
||||
unlike(
|
||||
$output,
|
||||
|
||||
Reference in New Issue
Block a user