mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-06 12:27:56 +00:00
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:
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user