mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-23 12:47:56 +00:00
Move oversize_chunks.t tests into basics.t and remove oversize_chunks.t. Remove unused sample files.
This commit is contained in:
@@ -37,7 +37,7 @@ elsif ( !@{$master_dbh->selectall_arrayref('show databases like "sakila"')} ) {
|
|||||||
plan skip_all => 'sakila database is not loaded';
|
plan skip_all => 'sakila database is not loaded';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plan tests => 9;
|
plan tests => 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||||
@@ -198,6 +198,52 @@ ok(
|
|||||||
"--no-recheck (just --replicate-check)"
|
"--no-recheck (just --replicate-check)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# ############################################################################
|
||||||
|
# Detect infinite loop.
|
||||||
|
# ############################################################################
|
||||||
|
$sb->load_file('master', "t/pt-table-checksum/samples/oversize-chunks.sql");
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { pt_table_checksum::main(@args, qw(-t osc.t --chunk-size 10)) },
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
like(
|
||||||
|
$output,
|
||||||
|
qr/infinite loop detected/,
|
||||||
|
"Detects infinite loop"
|
||||||
|
);
|
||||||
|
|
||||||
|
# ############################################################################
|
||||||
|
# Oversize chunk.
|
||||||
|
# ############################################################################
|
||||||
|
ok(
|
||||||
|
no_diff(
|
||||||
|
sub { pt_table_checksum::main(@args,
|
||||||
|
qw(-t osc.t2 --chunk-size 8 --explain --explain)) },
|
||||||
|
"$sample/oversize-chunks.txt",
|
||||||
|
),
|
||||||
|
"Upper boundary same as next lower boundary"
|
||||||
|
);
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { pt_table_checksum::main(@args,
|
||||||
|
qw(-t osc.t2 --chunk-time 0 --chunk-size 8 --chunk-size-limit 1)) },
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'skipped'),
|
||||||
|
2,
|
||||||
|
"Skipped oversize chunks"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'errors'),
|
||||||
|
0,
|
||||||
|
"Oversize chunks are not errors"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
@@ -1,70 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
|
||||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
|
||||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
|
||||||
};
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings FATAL => 'all';
|
|
||||||
use English qw(-no_match_vars);
|
|
||||||
use Test::More skip_all => 'Finish updating oversize_chunks.t';
|
|
||||||
|
|
||||||
use PerconaTest;
|
|
||||||
use Sandbox;
|
|
||||||
require "$trunk/bin/pt-table-checksum";
|
|
||||||
|
|
||||||
|
|
||||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
|
||||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
|
||||||
my $master_dbh = $sb->get_dbh_for('master');
|
|
||||||
|
|
||||||
if ( !$master_dbh ) {
|
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plan tests => 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
# And --max-load "" prevents waiting for status variables.
|
|
||||||
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
|
||||||
my @args = ($master_dsn, qw(--lock-wait-timeout 3), '--max-load', '');
|
|
||||||
my $row;
|
|
||||||
my $output;
|
|
||||||
|
|
||||||
$sb->load_file('master', "t/pt-table-checksum/samples/oversize-chunks.sql");
|
|
||||||
|
|
||||||
# pt-table-checksum 2.0 isn't fooled as easily as 1.0 was. This
|
|
||||||
# test results in:
|
|
||||||
# Error checksumming table osc.t: Possible infinite loop detected!
|
|
||||||
# The lower boundary for chunk 2 is <13, 13> and the lower boundary
|
|
||||||
# for chunk 3 is also <13, 13>. This usually happens when using a
|
|
||||||
# non-unique single column index. The current chunk index for table
|
|
||||||
# osc.t is i which is not unique and covers 1 column.
|
|
||||||
|
|
||||||
ok(
|
|
||||||
no_diff(
|
|
||||||
sub { pt_table_checksum::main(@args,
|
|
||||||
qw(-t osc.t --chunk-size 10)) },
|
|
||||||
"t/pt-table-checksum/samples/oversize-chunks.txt",
|
|
||||||
),
|
|
||||||
"Skip oversize chunk"
|
|
||||||
);
|
|
||||||
|
|
||||||
ok(
|
|
||||||
no_diff(
|
|
||||||
sub { pt_table_checksum::main(@args,
|
|
||||||
qw(-t osc.t --chunk-size 10 --chunk-size-limit 0)) },
|
|
||||||
"t/pt-table-checksum/samples/oversize-chunks-allowed.txt"
|
|
||||||
),
|
|
||||||
"Allow oversize chunk"
|
|
||||||
);
|
|
||||||
|
|
||||||
# #############################################################################
|
|
||||||
# Done.
|
|
||||||
# #############################################################################
|
|
||||||
$sb->wipe_clean($master_dbh);
|
|
||||||
exit;
|
|
@@ -1,14 +0,0 @@
|
|||||||
USE test;
|
|
||||||
DROP TABLE IF EXISTS checksum;
|
|
||||||
CREATE TABLE checksum (
|
|
||||||
db char(64) NOT NULL,
|
|
||||||
tbl char(64) NOT NULL,
|
|
||||||
chunk int NOT NULL,
|
|
||||||
boundaries char(100) NOT NULL,
|
|
||||||
this_crc char(40) NOT NULL,
|
|
||||||
this_cnt int NOT NULL,
|
|
||||||
master_crc char(40) NULL,
|
|
||||||
master_cnt int NULL,
|
|
||||||
ts timestamp NOT NULL,
|
|
||||||
PRIMARY KEY (db, tbl, chunk)
|
|
||||||
) ENGINE=InnoDB;
|
|
@@ -1,6 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
osc t 0 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
osc t 1 127.1 MyISAM 23 54a0c224 0 0 NULL NULL
|
|
||||||
osc t 2 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
osc t 3 127.1 MyISAM 3 16533cd7 0 0 NULL NULL
|
|
||||||
osc t 4 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
@@ -7,6 +7,27 @@ create table t (
|
|||||||
);
|
);
|
||||||
|
|
||||||
insert into t values
|
insert into t values
|
||||||
(1),(2),(3),
|
(1),
|
||||||
(10),(11),(12),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(24),
|
(2),
|
||||||
(101),(102),(103);
|
(3),
|
||||||
|
(10),
|
||||||
|
(11),
|
||||||
|
(12),
|
||||||
|
|
||||||
|
-- 15 dupes
|
||||||
|
(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),(13),
|
||||||
|
|
||||||
|
(24),
|
||||||
|
(101),
|
||||||
|
(102),
|
||||||
|
(103);
|
||||||
|
|
||||||
|
create table t2 (
|
||||||
|
c char,
|
||||||
|
index (c)
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into t2 values
|
||||||
|
('a'), ('a'), ('a'), ('a'), ('a'), ('a'), ('a'), ('b'), ('b'), ('b'), ('c'),
|
||||||
|
('c'), ('d'), ('d'), ('d'), ('d'),
|
||||||
|
('e'), ('f'), ('g');
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
--
|
||||||
osc t 0 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
-- osc.t2
|
||||||
osc t 1 127.1 MyISAM OVERSIZE NULL NULL NULL NULL NULL
|
--
|
||||||
osc t 2 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
osc t 3 127.1 MyISAM 3 16533cd7 0 0 NULL NULL
|
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('#', `c`, CONCAT(ISNULL(`c`)))) AS UNSIGNED)), 10, 16)), 0) AS crc FROM `osc`.`t2` FORCE INDEX(`c`) WHERE (((? IS NULL OR `c` >= ?))) AND (((? IS NULL OR `c` <= ?))) ORDER BY `c` /*checksum chunk*/
|
||||||
osc t 4 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
|
SELECT /*!40001 SQL_NO_CACHE */ `c`, `c` FROM `osc`.`t2` FORCE INDEX(`c`) WHERE (((? IS NULL OR `c` >= ?))) ORDER BY `c` LIMIT ?, 2 /*next chunk boundary*/
|
||||||
|
|
||||||
|
1 a,a b,b
|
||||||
|
2 b,b d,d
|
||||||
|
3 d,d g,g
|
||||||
|
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test resume 0 127.0.0.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 0 127.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 1 127.0.0.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 1 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 2 127.0.0.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 2 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 3 127.0.0.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
||||||
test resume 3 127.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
@@ -1,5 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test resume 0 127.0.0.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 0 127.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 1 127.0.0.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 1 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
@@ -1,3 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test resume 0 127.0.0.1 InnoDB NULL 2465609721 0 0 NULL NULL
|
|
||||||
test resume 0 127.1 InnoDB NULL 2465609721 0 0 NULL NULL
|
|
@@ -1,2 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test resume 0 127.0.0.1 InnoDB NULL 2465609721 0 0 NULL NULL
|
|
@@ -1,5 +0,0 @@
|
|||||||
use test;
|
|
||||||
create table resume (
|
|
||||||
i int not null unique key
|
|
||||||
) engine=innodb;
|
|
||||||
insert into test.resume values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
|
@@ -1,17 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test2 resume2 0 127.0.0.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
test2 resume2 0 127.1 MyISAM 0 NULL 0 0 NULL NULL
|
|
||||||
test2 resume2 1 127.0.0.1 MyISAM 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test2 resume2 1 127.1 MyISAM 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test2 resume2 2 127.0.0.1 MyISAM 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test2 resume2 2 127.1 MyISAM 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test2 resume2 3 127.0.0.1 MyISAM 4 bce55ff5 0 0 NULL NULL
|
|
||||||
test2 resume2 3 127.1 MyISAM 4 bce55ff5 0 0 NULL NULL
|
|
||||||
test resume 0 127.0.0.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 0 127.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 1 127.0.0.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 1 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 2 127.0.0.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
||||||
test resume 2 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 3 127.0.0.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
||||||
test resume 3 127.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
@@ -1,6 +0,0 @@
|
|||||||
DATABASE TABLE CHUNK HOST ENGINE COUNT CHECKSUM TIME WAIT STAT LAG
|
|
||||||
test resume 0 127.0.0.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 0 127.1 InnoDB 3 f4dbdf21 0 0 NULL NULL
|
|
||||||
test resume 1 127.0.0.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 1 127.1 InnoDB 3 6abf4a82 0 0 NULL NULL
|
|
||||||
test resume 2 127.0.0.1 InnoDB 4 bce55ff5 0 0 NULL NULL
|
|
@@ -1,7 +0,0 @@
|
|||||||
drop database if exists test2;
|
|
||||||
create database test2;
|
|
||||||
use test2;
|
|
||||||
create table resume2 (
|
|
||||||
i int not null unique key
|
|
||||||
);
|
|
||||||
insert into test2.resume2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
|
Reference in New Issue
Block a user