Clarify --chunk-index name:n validation.

This commit is contained in:
Daniel Nichter
2012-06-10 13:10:41 -04:00
parent 1f861fa9f5
commit f422dab969
2 changed files with 4 additions and 4 deletions

View File

@@ -5132,12 +5132,12 @@ sub main {
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232 # https://bugs.launchpad.net/percona-toolkit/+bug/1010232
my ($chunk_index, $n_chunk_index_cols) my ($chunk_index, $n_chunk_index_cols)
= split(':', $o->get('chunk-index') || ''); = split(':', $o->get('chunk-index') || '');
if ( defined $chunk_index && !$chunk_index ) { if ( defined $chunk_index && $chunk_index eq '' ) {
$o->save_error('--chunk-index cannot be an empty string'); $o->save_error('--chunk-index cannot be an empty string');
} }
if ( defined $n_chunk_index_cols if ( defined $n_chunk_index_cols
&& (!$n_chunk_index_cols && (!$n_chunk_index_cols
|| $n_chunk_index_cols =~ m/[^\d]/ || $n_chunk_index_cols =~ m/\D/
|| $n_chunk_index_cols < 1) ) { || $n_chunk_index_cols < 1) ) {
$o->save_error('Invalid number of --chunk-index columns: ' $o->save_error('Invalid number of --chunk-index columns: '
. $n_chunk_index_cols); . $n_chunk_index_cols);

View File

@@ -6093,12 +6093,12 @@ sub main {
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232 # https://bugs.launchpad.net/percona-toolkit/+bug/1010232
my ($chunk_index, $n_chunk_index_cols) my ($chunk_index, $n_chunk_index_cols)
= split(':', $o->get('chunk-index') || ''); = split(':', $o->get('chunk-index') || '');
if ( defined $chunk_index && !$chunk_index ) { if ( defined $chunk_index && $chunk_index eq '' ) {
$o->save_error('--chunk-index cannot be an empty string'); $o->save_error('--chunk-index cannot be an empty string');
} }
if ( defined $n_chunk_index_cols if ( defined $n_chunk_index_cols
&& (!$n_chunk_index_cols && (!$n_chunk_index_cols
|| $n_chunk_index_cols =~ m/[^\d]/ || $n_chunk_index_cols =~ m/\D/
|| $n_chunk_index_cols < 1) ) { || $n_chunk_index_cols < 1) ) {
$o->save_error('Invalid number of --chunk-index columns: ' $o->save_error('Invalid number of --chunk-index columns: '
. $n_chunk_index_cols); . $n_chunk_index_cols);