fixed pt-archiver row skipping on partitioned tables - 1376561

This commit is contained in:
Frank Cizmich
2014-10-10 19:20:39 -02:00
parent 4ba15b4887
commit c99f271649
4 changed files with 15 additions and 4 deletions

View File

@@ -5811,7 +5811,18 @@ sub main {
$next_sql .= " AND $sel_stmt->{where}";
}
# Obtain index cols so we can order them when ascending
# this ensures returned sets are disjoint when ran on partitioned tables
# issue 1376561
my $index_cols;
if ( $sel_stmt->{index}
&& $src->{info}->{keys}->{$sel_stmt->{index}}->{cols}
) {
$index_cols = $src->{info}->{keys}->{$sel_stmt->{index}}->{colnames};
}
foreach my $thing ( $first_sql, $next_sql ) {
$thing .= " ORDER BY $index_cols " if $index_cols;
$thing .= " LIMIT $limit";
if ( $o->get('for-update') ) {
$thing .= ' FOR UPDATE';