Comment 2 for bug 1034717

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote : Re: pt-table-sync errors with varchar primary key

Reproduced as follows:

mysql -e 'create database test1;'
mysql test < reproduce.sql
mysql test1 < reproduce.sql

pt-table-sync --execute h=localhost,P=3306,D=test,t=table1 D=test1

It is failing here: my $highest_power = floor(log($n)/log($base)); when $base=1 the denom. is zero. That may be because the ord of '1001' and '10873' (the first and last column values) is same.

This seems to be fixing it:

=========================

diff -u bin/pt-table-sync /tmp/pt-table-sync
--- bin/pt-table-sync 2012-08-08 11:52:07.869453000 +0530
+++ /tmp/pt-table-sync 2012-08-09 16:51:41.673466697 +0530
@@ -4438,7 +4438,7 @@
    }
    my ($n, $base, $symbols) = @args{@required_args};

- return $symbols->[0] if $n == 0;
+ return $symbols->[0] if $n == 0 || $base == 1;

    my $highest_power = floor(log($n)/log($base));
    if ( $highest_power == 0 ){

=================

Tested with different values.