mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
Test and fix bug 911996.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
Changelog for Percona Toolkit
|
Changelog for Percona Toolkit
|
||||||
|
|
||||||
|
* Fixed bug 911996: pt-table-sync --replicate causes "Unknown column" error
|
||||||
|
|
||||||
v2.0.1 released 2011-12-30
|
v2.0.1 released 2011-12-30
|
||||||
|
|
||||||
* Completely redesigned pt-table-checksum
|
* Completely redesigned pt-table-checksum
|
||||||
|
|||||||
@@ -8892,13 +8892,13 @@ sub diff_where {
|
|||||||
my $lb_sql = $asc->{boundaries}->{'>='};
|
my $lb_sql = $asc->{boundaries}->{'>='};
|
||||||
foreach my $val ( $q->deserialize_list($diff->{lower_boundary}) ) {
|
foreach my $val ( $q->deserialize_list($diff->{lower_boundary}) ) {
|
||||||
my $quoted_val = $q->quote_val($val);
|
my $quoted_val = $q->quote_val($val);
|
||||||
$lb_sql =~ s/\?/$val/;
|
$lb_sql =~ s/\?/$quoted_val/;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $ub_sql = $asc->{boundaries}->{'<='};
|
my $ub_sql = $asc->{boundaries}->{'<='};
|
||||||
foreach my $val ( $q->deserialize_list($diff->{upper_boundary}) ) {
|
foreach my $val ( $q->deserialize_list($diff->{upper_boundary}) ) {
|
||||||
my $quoted_val = $q->quote_val($val);
|
my $quoted_val = $q->quote_val($val);
|
||||||
$ub_sql =~ s/\?/$val/;
|
$ub_sql =~ s/\?/$quoted_val/;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$lb_sql AND $ub_sql";
|
return "$lb_sql AND $ub_sql";
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ elsif ( !$slave_dbh ) {
|
|||||||
plan skip_all => 'Cannot connect to sandbox slave';
|
plan skip_all => 'Cannot connect to sandbox slave';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plan tests => 17;
|
plan tests => 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sb->wipe_clean($master_dbh);
|
$sb->wipe_clean($master_dbh);
|
||||||
@@ -168,6 +168,35 @@ ok($output, 'Synced with Nibble and data-size chunksize');
|
|||||||
# Restore PTDEBUG env.
|
# Restore PTDEBUG env.
|
||||||
$ENV{PTDEBUG} = $dbg || 0;
|
$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.
|
# Done.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ test_diff_where(
|
|||||||
this_crc => '4a57d814',
|
this_crc => '4a57d814',
|
||||||
upper_boundary => '9'
|
upper_boundary => '9'
|
||||||
},
|
},
|
||||||
where => "((`id` >= 7)) AND ((`id` <= 9))",
|
where => "((`id` >= '7')) AND ((`id` <= '9'))",
|
||||||
);
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user