From ef6594511167aa236189ec54657ef135dc860e00 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Mon, 11 Jun 2012 15:48:00 -0400 Subject: [PATCH] Update all modules in all tools. --- bin/pt-archiver | 7 ++++++- bin/pt-table-sync | 7 ++++++- bin/pt-upgrade | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/pt-archiver b/bin/pt-archiver index bb1d18d0..bd3a9a42 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -2146,8 +2146,13 @@ sub generate_asc_stmt { my @asc_cols = @{$tbl_struct->{keys}->{$index}->{cols}}; if ( $args{asc_first} ) { - @asc_cols = $asc_cols[0]; PTDEBUG && _d('Ascending only first column'); + @asc_cols = $asc_cols[0]; + } + elsif ( my $n = $args{n_index_cols} ) { + $n = scalar @asc_cols if $n > @asc_cols; + PTDEBUG && _d('Ascending only first', $n, 'columns'); + @asc_cols = @asc_cols[0..($n-1)]; } PTDEBUG && _d('Will ascend columns', join(', ', @asc_cols)); diff --git a/bin/pt-table-sync b/bin/pt-table-sync index f514bd90..2e4c953c 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -5724,8 +5724,13 @@ sub generate_asc_stmt { my @asc_cols = @{$tbl_struct->{keys}->{$index}->{cols}}; if ( $args{asc_first} ) { - @asc_cols = $asc_cols[0]; PTDEBUG && _d('Ascending only first column'); + @asc_cols = $asc_cols[0]; + } + elsif ( my $n = $args{n_index_cols} ) { + $n = scalar @asc_cols if $n > @asc_cols; + PTDEBUG && _d('Ascending only first', $n, 'columns'); + @asc_cols = @asc_cols[0..($n-1)]; } PTDEBUG && _d('Will ascend columns', join(', ', @asc_cols)); diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 090a8d5d..2d76e0bb 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -5930,8 +5930,13 @@ sub generate_asc_stmt { my @asc_cols = @{$tbl_struct->{keys}->{$index}->{cols}}; if ( $args{asc_first} ) { - @asc_cols = $asc_cols[0]; PTDEBUG && _d('Ascending only first column'); + @asc_cols = $asc_cols[0]; + } + elsif ( my $n = $args{n_index_cols} ) { + $n = scalar @asc_cols if $n > @asc_cols; + PTDEBUG && _d('Ascending only first', $n, 'columns'); + @asc_cols = @asc_cols[0..($n-1)]; } PTDEBUG && _d('Will ascend columns', join(', ', @asc_cols));