bug-1593265 Fixed pt-archiver deletes wrong rows

In the case we are trying to migrate a table with no PK nor an unique
key, pt-archiver was failing to select the correct rows for deletion.
This fix implemented here is to add ALL columns in the WHERE clause of
the DELETE command. This way, we are deleting only the exact same row we
just migrated but using columns instead of an index.
This commit is contained in:
Carlos Salguero
2016-06-22 13:17:57 -03:00
parent 4534b731ad
commit 01daf0030e
8 changed files with 83 additions and 6 deletions

View File

@@ -3201,7 +3201,7 @@ sub generate_del_stmt {
my $index = $tp->find_best_index($tbl, $args{index});
die "Cannot find an ascendable index in table" unless $index;
if ( $index ) {
if ( $index && $tbl->{keys}->{$index}->{is_unique}) {
@del_cols = @{$tbl->{keys}->{$index}->{cols}};
}
else {

View File

@@ -3052,7 +3052,7 @@ sub generate_del_stmt {
my $index = $tp->find_best_index($tbl, $args{index});
die "Cannot find an ascendable index in table" unless $index;
if ( $index ) {
if ( $index && $tbl->{keys}->{$index}->{is_unique}) {
@del_cols = @{$tbl->{keys}->{$index}->{cols}};
}
else {

View File

@@ -4901,7 +4901,7 @@ sub generate_del_stmt {
my $index = $tp->find_best_index($tbl, $args{index});
die "Cannot find an ascendable index in table" unless $index;
if ( $index ) {
if ( $index && $tbl->{keys}->{$index}->{is_unique}) {
@del_cols = @{$tbl->{keys}->{$index}->{cols}};
}
else {

View File

@@ -6480,7 +6480,7 @@ sub generate_del_stmt {
my $index = $tp->find_best_index($tbl, $args{index});
die "Cannot find an ascendable index in table" unless $index;
if ( $index ) {
if ( $index && $tbl->{keys}->{$index}->{is_unique}) {
@del_cols = @{$tbl->{keys}->{$index}->{cols}};
}
else {