PT-143 Fixed key handling

When tehre is a table having a key like:
PRIMARY KEY (`id`,`start`,`end`,`user_id`(13),`interval`),
DBI driver is taking (13) as part of the field name.
Fixed the way pt-archiver composes the key using DBI cols field
instead of the colnames field since the cols field has the correct
field names for the key.
This commit is contained in:
Carlos Salguero
2017-05-18 12:03:02 -03:00
parent 43b50f8a8c
commit a4ecd9678f
3 changed files with 103 additions and 4 deletions

View File

@@ -6294,10 +6294,8 @@ sub main {
# 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};
if ( $sel_stmt->{index} && $src->{info}->{keys}->{$sel_stmt->{index}}->{cols} ) {
$index_cols = join(",",map { "`$_`" } @{$src->{info}->{keys}->{$sel_stmt->{index}}->{cols}});
}
foreach my $thing ( $first_sql, $next_sql ) {