mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-07 04:49:48 +00:00
Revert "Merge pull request #380 from percona/PT-1114"
This reverts commitbcbc175d0c
, reversing changes made tocf5c661d46
.
This commit is contained in:
@@ -6669,13 +6669,6 @@ sub index_length {
|
||||
n_index_cols => $n_index_cols,
|
||||
);
|
||||
|
||||
if (!$vals) {
|
||||
my @row = $cxn->dbh()->selectrow_array('SELECT COUNT(*) FROM '.$args{tbl}->{name});
|
||||
if ($row[0] == 0) {
|
||||
PTDEBUG && _d('Table '.$args{tbl}->{name}.' is empty');
|
||||
return undef, undef;
|
||||
}
|
||||
}
|
||||
my $sql = $self->_make_range_query(
|
||||
%args,
|
||||
n_index_cols => $n_index_cols,
|
||||
|
@@ -9621,13 +9621,6 @@ sub index_length {
|
||||
n_index_cols => $n_index_cols,
|
||||
);
|
||||
|
||||
if (!$vals) {
|
||||
my @row = $cxn->dbh()->selectrow_array('SELECT COUNT(*) FROM '.$args{tbl}->{name});
|
||||
if ($row[0] == 0) {
|
||||
PTDEBUG && _d('Table '.$args{tbl}->{name}.' is empty');
|
||||
return undef, undef;
|
||||
}
|
||||
}
|
||||
my $sql = $self->_make_range_query(
|
||||
%args,
|
||||
n_index_cols => $n_index_cols,
|
||||
@@ -11031,27 +11024,23 @@ sub main {
|
||||
index => $nibble_iter->nibble_index(),
|
||||
n_index_cols => $o->get('chunk-index-columns'),
|
||||
);
|
||||
if ($key) {
|
||||
if ( !$key || lc($key) ne lc($nibble_iter->nibble_index()) ) {
|
||||
die "Cannot determine the key_len of the chunk index "
|
||||
. "because MySQL chose "
|
||||
. ($key ? "the $key" : "no") . " index "
|
||||
. "instead of the " . $nibble_iter->nibble_index()
|
||||
. " index for the first lower boundary statement. "
|
||||
. "See --[no]check-plan in the documentation for more "
|
||||
. "information.";
|
||||
} elsif ( $key_len) {
|
||||
$tbl->{key_len} = $key_len;
|
||||
}
|
||||
if ( !$key || lc($key) ne lc($nibble_iter->nibble_index()) ) {
|
||||
die "Cannot determine the key_len of the chunk index "
|
||||
. "because MySQL chose "
|
||||
. ($key ? "the $key" : "no") . " index "
|
||||
. "instead of the " . $nibble_iter->nibble_index()
|
||||
. " index for the first lower boundary statement. "
|
||||
. "See --[no]check-plan in the documentation for more "
|
||||
. "information.";
|
||||
}
|
||||
# If there is no key probably the table is empty
|
||||
# elsif ( !$key_len ) {
|
||||
# die "The key_len of the $key index is "
|
||||
# . (defined $key_len ? "zero" : "NULL")
|
||||
# . ", but this should not be possible. "
|
||||
# . "See --[no]check-plan in the documentation for more "
|
||||
# . "information.";
|
||||
# }
|
||||
elsif ( !$key_len ) {
|
||||
die "The key_len of the $key index is "
|
||||
. (defined $key_len ? "zero" : "NULL")
|
||||
. ", but this should not be possible. "
|
||||
. "See --[no]check-plan in the documentation for more "
|
||||
. "information.";
|
||||
}
|
||||
$tbl->{key_len} = $key_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -75,14 +75,6 @@ sub index_length {
|
||||
n_index_cols => $n_index_cols,
|
||||
);
|
||||
|
||||
if (!$vals) {
|
||||
# Maybe the table is empty ...
|
||||
my @row = $cxn->dbh()->selectrow_array('SELECT COUNT(*) FROM '.$args{tbl}->{name});
|
||||
if ($row[0] == 0) {
|
||||
PTDEBUG && _d('Table '.$args{tbl}->{name}.' is empty');
|
||||
return undef, undef;
|
||||
}
|
||||
}
|
||||
# Make an EXPLAIN query to scan the range and execute it.
|
||||
my $sql = $self->_make_range_query(
|
||||
%args,
|
||||
|
@@ -1,72 +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;
|
||||
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
use SqlModes;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dsn = $sb->dsn_for('master');
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 3;
|
||||
}
|
||||
|
||||
diag("loading samples");
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/pt-1114.sql');
|
||||
|
||||
my $master_port = $sb->port_for('master');
|
||||
my $num_rows = 40000;
|
||||
|
||||
diag(`util/mysql_random_data_load --host=127.0.0.1 --port=$master_port --user=msandbox --password=msandbox test t1 $num_rows`);
|
||||
|
||||
$dbh->do('set global innodb_stats_persistent=0;');
|
||||
$dbh->do('DELETE FROM test.t1');
|
||||
|
||||
my @args = ($dsn);
|
||||
my $output;
|
||||
my $exit_status;
|
||||
|
||||
# Test #1
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
is(
|
||||
$exit_status,
|
||||
0,
|
||||
"Exit status OK",
|
||||
);
|
||||
diag($output);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/0\s+0\s+0\s+0\s+1\s+0\s+\d+\.\d+\s+test\.t1/,
|
||||
"Checksumed test.t1 even when it is empty",
|
||||
);
|
||||
|
||||
$dbh->do('SET GLOBAL binlog_format="STATEMENT"');
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
@@ -1,49 +0,0 @@
|
||||
-- MySQL dump 10.13 Distrib 5.6.26-74.0, for Linux (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: test
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.6.25-73.1-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t1`
|
||||
--
|
||||
|
||||
DROP DATABASE IF EXISTS test;
|
||||
CREATE DATABASE test;
|
||||
USE test;
|
||||
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`a`),
|
||||
KEY `b` (`b`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2016-04-26 14:38:53
|
Reference in New Issue
Block a user