4
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
10
use warnings FATAL => 'all';
11
use English qw(-no_match_vars);
16
require "$trunk/bin/pt-table-checksum";
18
my $dp = new DSNParser(opts=>$dsn_opts);
19
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
20
my $dbh = $sb->get_dbh_for('master');
23
plan skip_all => 'Cannot connect to sandbox master';
25
elsif ( !@{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')} ) {
26
plan skip_all => 'sakila database is not loaded';
33
my $cnf = '/tmp/12345/my.sandbox.cnf';
34
my $cmd = "$trunk/bin/pt-table-checksum -F $cnf -t sakila.film --chunk-size 100";
36
# #############################################################################
37
# Issue 1182: mk-table-checksum not respecting chunk size
38
# #############################################################################
40
# Unfortunately we don't have a good method for testing that the tool
41
# uses the correct chunks. That's tested directly in TableChunker.t.
42
# So here we make sure that --chunk-range doesn't affect anything; it
43
# should chunk and checksum identically to not using --chunk-range.
45
diag(`rm -rf /tmp/mk-checksum-test-output-?.txt`);
47
`$cmd >/tmp/mk-table-checksum-test-output-1.txt`;
48
`$cmd --chunk-range openclosed >/tmp/mk-table-checksum-test-output-2.txt`;
51
`diff /tmp/mk-table-checksum-test-output-1.txt /tmp/mk-table-checksum-test-output-2.txt`,
53
"--chunk-range does not alter chunks or checksums"
56
# #############################################################################
58
# #############################################################################