mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-16 01:00:38 +08:00
Make --explain cummulative. Update char_chunking.t. Reword checksum query comments.
This commit is contained in:
@@ -15,29 +15,30 @@ use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
my $vp = new VersionParser();
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
|
||||
if ( !$dbh ) {
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 3;
|
||||
plan tests => 2;
|
||||
}
|
||||
|
||||
my $output;
|
||||
my $cnf ='/tmp/12345/my.sandbox.cnf';
|
||||
my @args = ("F=$cnf", qw(--lock-wait-timeout 3 --chunk-time 0 --chunk-size-limit 0 --tables test.ascii));
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --lock-wait-timeout=3 else the tool will die.
|
||||
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
||||
my @args = ($master_dsn, qw(--lock-wait-timeout 3));
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
$sb->create_dbs($master_dbh, ['test']);
|
||||
$sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20 --explain)) },
|
||||
qw(--tables test.ascii --chunk-index c --chunk-size 20),
|
||||
qw(--explain --explain)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii-explain.txt",
|
||||
),
|
||||
"Char chunk ascii, explain"
|
||||
@@ -46,23 +47,16 @@ ok(
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20)) },
|
||||
qw(--tables test.ascii --chunk-index c --chunk-size 20),
|
||||
qw(--chunk-time 0)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii.txt",
|
||||
post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $8}\'',
|
||||
),
|
||||
"Char chunk ascii, chunk size 20"
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_table_checksum::main(@args,
|
||||
qw(--chunk-size 20 --chunk-size-limit 3)) },
|
||||
"t/pt-table-checksum/samples/char-chunk-ascii-oversize.txt",
|
||||
),
|
||||
"Char chunk ascii, chunk size 20, with oversize"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
$sb->wipe_clean($master_dbh);
|
||||
exit;
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
test ascii SELECT /*test.ascii:1/8*/ 0 AS chunk_num, COUNT(*) AS cnt, COALESCE(LOWER(CONV(BIT_XOR(CAST(CRC32(CONCAT_WS('#', `i`, `c`)) AS UNSIGNED)), 10, 16)), 0) AS crc FROM `test`.`ascii` FORCE INDEX (`c`) WHERE (`c` < ')')
|
||||
test ascii `c` < ')'
|
||||
test ascii `c` >= ')' AND `c` < '1'
|
||||
test ascii `c` >= '1' AND `c` < '9'
|
||||
test ascii `c` >= '9' AND `c` < 'A'
|
||||
test ascii `c` >= 'A' AND `c` < 'I'
|
||||
test ascii `c` >= 'I' AND `c` < 'Q'
|
||||
test ascii `c` >= 'Q' AND `c` < 'Y'
|
||||
test ascii `c` >= 'Y'
|
||||
--
|
||||
-- test.ascii
|
||||
--
|
||||
|
||||
REPLACE INTO `percona`.`checksums` (db, tbl, chunk, chunk_index, lower_boundary, upper_boundary, this_cnt, this_crc) SELECT ?, ?, ?, ?, ?, ?, COUNT(*) AS cnt, COALESCE(LOWER(CONV(BIT_XOR(CAST(CRC32(CONCAT_WS('#', `i`, `c`)) AS UNSIGNED)), 10, 16)), 0) AS crc FROM `test`.`ascii` FORCE INDEX(`c`) WHERE ((`c` >= ?)) AND ((`c` <= ?)) ORDER BY `c` /*checksum chunk*/
|
||||
|
||||
SELECT /*!40001 SQL_NO_CACHE */ `c` FROM `test`.`ascii` FORCE INDEX(`c`) WHERE ((`c` >= ?)) ORDER BY `c` LIMIT ?, 2 /*next chunk boundary*/
|
||||
|
||||
1 burt
|
||||
2 Cameron Frances
|
||||
3 Fred jane
|
||||
4 jayne kirk
|
||||
5 Kirsten Mr. Rogers
|
||||
6 Natalie Sean
|
||||
7 sidney Zesus!
|
||||
8 Zesus!! ZESUS!!!
|
||||
|
||||
|
||||
@@ -1,9 +1,2 @@
|
||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
||||
test ascii 0 127.1 MyISAM 1 25e3643f 0 0 NULL NULL
|
||||
test ascii 1 127.1 MyISAM 2 1eb24fbb 0 0 NULL NULL
|
||||
test ascii 2 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
||||
test ascii 3 127.1 MyISAM 2 fb3ab74d 0 0 NULL NULL
|
||||
test ascii 4 127.1 MyISAM OVERSIZE NULL NULL NULL NULL NULL
|
||||
test ascii 5 127.1 MyISAM OVERSIZE NULL NULL NULL NULL NULL
|
||||
test ascii 6 127.1 MyISAM 31 77958122 0 0 NULL NULL
|
||||
test ascii 7 127.1 MyISAM 5 3c0ef0c2 0 0 NULL NULL
|
||||
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 142 8 0 test.ascii
|
||||
|
||||
Reference in New Issue
Block a user