Update modules.

This commit is contained in:
Daniel Nichter
2012-08-27 10:54:21 -06:00
parent 3079f72935
commit a100be3f5f
3 changed files with 39 additions and 31 deletions

View File

@@ -5413,6 +5413,12 @@ sub _chunk_char {
}
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 "
. ($args{where} ? "WHERE $args{where} " : "")
@@ -6982,9 +6988,10 @@ sub lock_and_wait {
my $ms = $self->{MasterSlave};
my $tries = $args{wait_retry_args}->{tries} || 3;
my $wait;
my $sleep = $args{wait_retry_args}->{wait} || 10;
$self->{Retry}->retry(
tries => $tries,
wait => sub { sleep $args{wait_retry_args}->{wait} || 10 },
wait => sub { sleep($sleep) },
try => sub {
my ( %args ) = @_;
@@ -7015,7 +7022,7 @@ sub lock_and_wait {
. "the slave is running.";
}
if ( $tries - $args{tryno} ) {
$msg .= " Sleeping $wait seconds then retrying "
$msg .= " Sleeping $sleep seconds then retrying "
. ($tries - $args{tryno}) . " more times.";
}
warn "$msg\n";
@@ -7067,30 +7074,6 @@ sub lock_and_wait {
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 {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -7625,7 +7608,7 @@ sub __get_boundaries {
if ( $row ) {
my $i = 0;
$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 {
PTDEBUG && _d('No upper boundary');
@@ -7657,7 +7640,7 @@ sub __make_boundary_sql {
my $tmp = $self->{cached_row};
my $i = 0;
$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 .= " ORDER BY " . join(',', map { $q->quote($_) } @{$self->{key_cols}})