Test and fix bug 911996.

This commit is contained in:
Daniel Nichter
2012-01-05 11:46:38 -07:00
parent b966f63971
commit f4362cb2e7
4 changed files with 35 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
Changelog for Percona Toolkit
* Fixed bug 911996: pt-table-sync --replicate causes "Unknown column" error
v2.0.1 released 2011-12-30
* Completely redesigned pt-table-checksum

View File

@@ -8892,13 +8892,13 @@ sub diff_where {
my $lb_sql = $asc->{boundaries}->{'>='};
foreach my $val ( $q->deserialize_list($diff->{lower_boundary}) ) {
my $quoted_val = $q->quote_val($val);
$lb_sql =~ s/\?/$val/;
$lb_sql =~ s/\?/$quoted_val/;
}
my $ub_sql = $asc->{boundaries}->{'<='};
foreach my $val ( $q->deserialize_list($diff->{upper_boundary}) ) {
my $quoted_val = $q->quote_val($val);
$ub_sql =~ s/\?/$val/;
$ub_sql =~ s/\?/$quoted_val/;
}
return "$lb_sql AND $ub_sql";

View File

@@ -28,7 +28,7 @@ elsif ( !$slave_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave';
}
else {
plan tests => 17;
plan tests => 19;
}
$sb->wipe_clean($master_dbh);
@@ -168,6 +168,35 @@ ok($output, 'Synced with Nibble and data-size chunksize');
# Restore PTDEBUG env.
$ENV{PTDEBUG} = $dbg || 0;
# ###########################################################################
# Fix bug 911996.
# ###########################################################################
`$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --max-load '' --lock-wait 3 --chunk-size 50 --chunk-index idx_actor_last_name -t sakila.actor --quiet`;
PerconaTest::wait_for_table($slave_dbh, "percona.checksums", "db='sakila' and tbl='actor' and chunk=7");
$slave_dbh->do("update percona.checksums set this_crc='' where db='sakila' and tbl='actor' and chunk=3");
$slave_dbh->do("update sakila.actor set last_name='' where actor_id=30");
$output = output(
sub {
pt_table_sync::main('h=127.1,P=12345,u=msandbox,p=msandbox',
qw(--print --execute --replicate percona.checksums),
qw(--no-foreign-key-checks))
}
);
like(
$output,
qr/^REPLACE INTO `sakila`.`actor`\(`actor_id`, `first_name`, `last_name`, `last_update`\) VALUES \('30', 'SANDRA', 'PECK', '2006-02-15 04:34:33'\)/,
"--replicate with char index col (bug 911996)"
);
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --max-load '' --lock-wait 3 --chunk-size 50 --chunk-index idx_actor_last_name -t sakila.actor`;
is(
PerconaTest::count_checksum_results($output, 'diffs'),
0,
"Synced diff (bug 911996)"
);
# #############################################################################
# Done.

View File

@@ -54,7 +54,7 @@ test_diff_where(
this_crc => '4a57d814',
upper_boundary => '9'
},
where => "((`id` >= 7)) AND ((`id` <= 9))",
where => "((`id` >= '7')) AND ((`id` <= '9'))",
);
# #############################################################################