mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 00:21:56 +00:00
Update modules.
This commit is contained in:
@@ -5434,7 +5434,7 @@ sub __get_boundaries {
|
|||||||
if ( $row ) {
|
if ( $row ) {
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
$ub = $s->{boundaries}->{'<='};
|
$ub = $s->{boundaries}->{'<='};
|
||||||
$ub =~ s/\?/$q->quote_val($row->{$s->{scols}->[$i]}, $self->{tbl_struct}->{is_numeric}->{$s->{scols}->[$i++]} || 0)/eg;
|
$ub =~ s/\?/$q->quote_val($row->{$s->{scols}->[$i++]})/eg;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PTDEBUG && _d('No upper boundary');
|
PTDEBUG && _d('No upper boundary');
|
||||||
@@ -5466,7 +5466,7 @@ sub __make_boundary_sql {
|
|||||||
my $tmp = $self->{cached_row};
|
my $tmp = $self->{cached_row};
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
$lb = $s->{boundaries}->{'>'};
|
$lb = $s->{boundaries}->{'>'};
|
||||||
$lb =~ s/\?/$q->quote_val($tmp->{$s->{scols}->[$i]}, $self->{tbl_struct}->{is_numeric}->{$s->{scols}->[$i++]} || 0)/eg;
|
$lb =~ s/\?/$q->quote_val($tmp->{$s->{scols}->[$i++]})/eg;
|
||||||
$sql .= $args{where} ? " AND $lb" : " WHERE $lb";
|
$sql .= $args{where} ? " AND $lb" : " WHERE $lb";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY " . join(',', map { $q->quote($_) } @{$self->{key_cols}})
|
$sql .= " ORDER BY " . join(',', map { $q->quote($_) } @{$self->{key_cols}})
|
||||||
|
@@ -6,7 +6,32 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
|
||||||
|
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||||
|
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||||
|
# of this so it will not try to load the module from @INC. See the tool's
|
||||||
|
# documentation for a full list of dependencies.
|
||||||
|
BEGIN {
|
||||||
|
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||||
|
DSNParser
|
||||||
|
OptionParser
|
||||||
|
SlowLogParser
|
||||||
|
Transformers
|
||||||
|
QueryRewriter
|
||||||
|
QueryParser
|
||||||
|
FileIterator
|
||||||
|
SQLParser
|
||||||
|
TableUsage
|
||||||
|
Daemon
|
||||||
|
Runtime
|
||||||
|
Progress
|
||||||
|
Pipeline
|
||||||
|
Quoter
|
||||||
|
TableParser
|
||||||
|
MysqldumpParser
|
||||||
|
SchemaQualifier
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# DSNParser package
|
# DSNParser package
|
||||||
|
@@ -5413,6 +5413,12 @@ sub _chunk_char {
|
|||||||
}
|
}
|
||||||
PTDEBUG && _d("Base", $base, "chars:", @chars);
|
PTDEBUG && _d("Base", $base, "chars:", @chars);
|
||||||
|
|
||||||
|
die "Cannot chunk table $db_tbl using the character column "
|
||||||
|
. "$chunk_col, most likely because all values start with the "
|
||||||
|
. "same character. This table must be synced separately by "
|
||||||
|
. "specifying a list of --algorithms without the Chunk algorithm"
|
||||||
|
if $base == 1;
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT MAX(LENGTH($qchunk_col)) FROM $db_tbl "
|
$sql = "SELECT MAX(LENGTH($qchunk_col)) FROM $db_tbl "
|
||||||
. ($args{where} ? "WHERE $args{where} " : "")
|
. ($args{where} ? "WHERE $args{where} " : "")
|
||||||
@@ -6982,9 +6988,10 @@ sub lock_and_wait {
|
|||||||
my $ms = $self->{MasterSlave};
|
my $ms = $self->{MasterSlave};
|
||||||
my $tries = $args{wait_retry_args}->{tries} || 3;
|
my $tries = $args{wait_retry_args}->{tries} || 3;
|
||||||
my $wait;
|
my $wait;
|
||||||
|
my $sleep = $args{wait_retry_args}->{wait} || 10;
|
||||||
$self->{Retry}->retry(
|
$self->{Retry}->retry(
|
||||||
tries => $tries,
|
tries => $tries,
|
||||||
wait => sub { sleep $args{wait_retry_args}->{wait} || 10 },
|
wait => sub { sleep($sleep) },
|
||||||
try => sub {
|
try => sub {
|
||||||
my ( %args ) = @_;
|
my ( %args ) = @_;
|
||||||
|
|
||||||
@@ -7015,7 +7022,7 @@ sub lock_and_wait {
|
|||||||
. "the slave is running.";
|
. "the slave is running.";
|
||||||
}
|
}
|
||||||
if ( $tries - $args{tryno} ) {
|
if ( $tries - $args{tryno} ) {
|
||||||
$msg .= " Sleeping $wait seconds then retrying "
|
$msg .= " Sleeping $sleep seconds then retrying "
|
||||||
. ($tries - $args{tryno}) . " more times.";
|
. ($tries - $args{tryno}) . " more times.";
|
||||||
}
|
}
|
||||||
warn "$msg\n";
|
warn "$msg\n";
|
||||||
@@ -7067,30 +7074,6 @@ sub lock_and_wait {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub have_all_privs {
|
|
||||||
my ( $self, $dbh, $db, $tbl ) = @_;
|
|
||||||
my $db_tbl = $self->{Quoter}->quote($db, $tbl);
|
|
||||||
my $sql = "SHOW FULL COLUMNS FROM $db_tbl";
|
|
||||||
PTDEBUG && _d('Permissions check:', $sql);
|
|
||||||
my $cols = $dbh->selectall_arrayref($sql, {Slice => {}});
|
|
||||||
my ($hdr_name) = grep { m/privileges/i } keys %{$cols->[0]};
|
|
||||||
my $privs = $cols->[0]->{$hdr_name};
|
|
||||||
$sql = "DELETE FROM $db_tbl LIMIT 0"; # FULL COLUMNS doesn't show all privs
|
|
||||||
PTDEBUG && _d('Permissions check:', $sql);
|
|
||||||
eval { $dbh->do($sql); };
|
|
||||||
my $can_delete = $EVAL_ERROR ? 0 : 1;
|
|
||||||
|
|
||||||
PTDEBUG && _d('User privs on', $db_tbl, ':', $privs,
|
|
||||||
($can_delete ? 'delete' : ''));
|
|
||||||
if ( $privs =~ m/select/ && $privs =~ m/insert/ && $privs =~ m/update/
|
|
||||||
&& $can_delete ) {
|
|
||||||
PTDEBUG && _d('User has all privs');
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
PTDEBUG && _d('User does not have all privs');
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub _d {
|
sub _d {
|
||||||
my ($package, undef, $line) = caller 0;
|
my ($package, undef, $line) = caller 0;
|
||||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||||
@@ -7625,7 +7608,7 @@ sub __get_boundaries {
|
|||||||
if ( $row ) {
|
if ( $row ) {
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
$ub = $s->{boundaries}->{'<='};
|
$ub = $s->{boundaries}->{'<='};
|
||||||
$ub =~ s/\?/$q->quote_val($row->{$s->{scols}->[$i]}, $self->{tbl_struct}->{is_numeric}->{$s->{scols}->[$i++]} || 0)/eg;
|
$ub =~ s/\?/$q->quote_val($row->{$s->{scols}->[$i++]})/eg;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PTDEBUG && _d('No upper boundary');
|
PTDEBUG && _d('No upper boundary');
|
||||||
@@ -7657,7 +7640,7 @@ sub __make_boundary_sql {
|
|||||||
my $tmp = $self->{cached_row};
|
my $tmp = $self->{cached_row};
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
$lb = $s->{boundaries}->{'>'};
|
$lb = $s->{boundaries}->{'>'};
|
||||||
$lb =~ s/\?/$q->quote_val($tmp->{$s->{scols}->[$i]}, $self->{tbl_struct}->{is_numeric}->{$s->{scols}->[$i++]} || 0)/eg;
|
$lb =~ s/\?/$q->quote_val($tmp->{$s->{scols}->[$i++]})/eg;
|
||||||
$sql .= $args{where} ? " AND $lb" : " WHERE $lb";
|
$sql .= $args{where} ? " AND $lb" : " WHERE $lb";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY " . join(',', map { $q->quote($_) } @{$self->{key_cols}})
|
$sql .= " ORDER BY " . join(',', map { $q->quote($_) } @{$self->{key_cols}})
|
||||||
|
Reference in New Issue
Block a user