Merge lp:~percona-toolkit-dev/percona-toolkit/validate-load-options-bug-996915 into lp:percona-toolkit/2.1

Proposed by Daniel Nichter
Status: Merged
Merged at revision: 268
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/validate-load-options-bug-996915
Merge into: lp:percona-toolkit/2.1
Diff against target: 612 lines (+315/-89)
6 files modified
bin/pt-online-schema-change (+91/-31)
bin/pt-table-checksum (+88/-30)
lib/MySQLStatusWaiter.pm (+60/-24)
t/lib/MySQLStatusWaiter.t (+49/-2)
t/pt-online-schema-change/option_sanity.t (+15/-1)
t/pt-table-checksum/option_sanity.t (+12/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/validate-load-options-bug-996915
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+107480@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-online-schema-change'
--- bin/pt-online-schema-change 2012-05-25 16:24:32 +0000
+++ bin/pt-online-schema-change 2012-05-25 21:39:18 +0000
@@ -3701,18 +3701,24 @@
3701 }3701 }
37023702
3703 PTDEBUG && _d('Parsing spec for max thresholds');3703 PTDEBUG && _d('Parsing spec for max thresholds');
3704 my $max_val_for = _parse_spec(3704 my $max_val_for = _parse_spec($args{max_spec});
3705 spec => $args{max_spec},3705 if ( $max_val_for ) {
3706 get_status => $args{get_status},3706 _check_and_set_vals(
3707 threshold_factor => 0.2, # +20%3707 vars => $max_val_for,
3708 );3708 get_status => $args{get_status},
3709 threshold_factor => 0.2, # +20%
3710 );
3711 }
37093712
3710 PTDEBUG && _d('Parsing spec for critical thresholds');3713 PTDEBUG && _d('Parsing spec for critical thresholds');
3711 my $critical_val_for = _parse_spec(3714 my $critical_val_for = _parse_spec($args{critical_spec} || []);
3712 spec => $args{critical_spec} || [],3715 if ( $critical_val_for ) {
3713 get_status => $args{get_status},3716 _check_and_set_vals(
3714 threshold_factor => 1.0, # double (x2; +100%)3717 vars => $critical_val_for,
3715 );3718 get_status => $args{get_status},
3719 threshold_factor => 1.0, # double (x2; +100%)
3720 );
3721 }
37163722
3717 my $self = {3723 my $self = {
3718 get_status => $args{get_status},3724 get_status => $args{get_status},
@@ -3726,27 +3732,29 @@
3726}3732}
37273733
3728sub _parse_spec {3734sub _parse_spec {
3729 my ( %args ) = @_;3735 my ($spec) = @_;
3730 my @required_args = qw(spec get_status);
3731 foreach my $arg ( @required_args ) {
3732 die "I need a $arg argument" unless defined $args{$arg};
3733 }
3734 my ($spec, $get_status) = @args{@required_args};
37353736
3736 return unless $spec && scalar @$spec;3737 return unless $spec && scalar @$spec;
3737 my $threshold_factor = $args{threshold_factor} || 0.20;
37383738
3739 my %max_val_for;3739 my %max_val_for;
3740 foreach my $var_val ( @$spec ) {3740 foreach my $var_val ( @$spec ) {
3741 die "Empty or undefined spec\n" unless $var_val;
3742 $var_val =~ s/^\s+//;
3743 $var_val =~ s/\s+$//g;
3744
3741 my ($var, $val) = split /[:=]/, $var_val;3745 my ($var, $val) = split /[:=]/, $var_val;
3742 die "Invalid spec: $var_val" unless $var;3746 die "$var_val does not contain a variable\n" unless $var;
3747 die "$var is not a variable name\n" unless $var =~ m/^[a-zA-Z_]+$/;
3748
3743 if ( !$val ) {3749 if ( !$val ) {
3744 my $init_val = $get_status->($var);3750 PTDEBUG && _d('Will get intial value for', $var, 'later');
3745 PTDEBUG && _d('Initial', $var, 'value:', $init_val);3751 $max_val_for{$var} = undef;
3746 $val = int(($init_val * $threshold_factor) + $init_val);3752 }
3747 }3753 else {
3748 PTDEBUG && _d('Wait if', $var, '>=', $val);3754 die "The value for $var must be a number\n"
3749 $max_val_for{$var} = $val;3755 unless $val =~ m/^[\d\.]+$/;
3756 $max_val_for{$var} = $val;
3757 }
3750 }3758 }
37513759
3752 return \%max_val_for; 3760 return \%max_val_for;
@@ -3826,6 +3834,34 @@
3826 return;3834 return;
3827}3835}
38283836
3837sub _check_and_set_vals {
3838 my (%args) = @_;
3839 my @required_args = qw(vars get_status threshold_factor);
3840 foreach my $arg ( @required_args ) {
3841 die "I need a $arg argument" unless defined $args{$arg};
3842 }
3843 my ($vars, $get_status, $threshold_factor) = @args{@required_args};
3844
3845 PTDEBUG && _d('Checking and setting values');
3846 return unless $vars && scalar %$vars;
3847
3848 foreach my $var ( keys %$vars ) {
3849 my $init_val = $get_status->($var);
3850 die "Variable $var does not exist or its value is undefined\n"
3851 unless defined $init_val;
3852 my $val;
3853 if ( defined $vars->{$var} ) {
3854 $val = $vars->{$var};
3855 }
3856 else {
3857 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
3858 $val = int(($init_val * $threshold_factor) + $init_val);
3859 $vars->{$var} = $val;
3860 }
3861 PTDEBUG && _d('Wait if', $var, '>=', $val);
3862 }
3863}
3864
3829sub _d {3865sub _d {
3830 my ($package, undef, $line) = caller 0;3866 my ($package, undef, $line) = caller 0;
3831 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }3867 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -4979,6 +5015,18 @@
4979 # Explicit --chunk-size disable auto chunk sizing.5015 # Explicit --chunk-size disable auto chunk sizing.
4980 $o->set('chunk-time', 0) if $o->got('chunk-size');5016 $o->set('chunk-time', 0) if $o->got('chunk-size');
49815017
5018 foreach my $opt ( qw(max-load critical-load) ) {
5019 next unless $o->has($opt);
5020 my $spec = $o->get($opt);
5021 eval {
5022 MySQLStatusWaiter::_parse_spec($o->get($opt));
5023 };
5024 if ( $EVAL_ERROR ) {
5025 chomp $EVAL_ERROR;
5026 $o->save_error("Invalid --$opt: $EVAL_ERROR");
5027 }
5028 }
5029
4982 if ( !$o->get('help') ) {5030 if ( !$o->get('help') ) {
4983 if ( @ARGV ) {5031 if ( @ARGV ) {
4984 $o->save_error('Specify only one DSN on the command line');5032 $o->save_error('Specify only one DSN on the command line');
@@ -5226,13 +5274,25 @@
5226 };5274 };
5227 }5275 }
52285276
5229 $sys_load = new MySQLStatusWaiter(5277 eval {
5230 max_spec => $o->get('max-load'),5278 $sys_load = new MySQLStatusWaiter(
5231 critical_spec => $o->get('critical-load'),5279 max_spec => $o->get('max-load'),
5232 get_status => $get_status,5280 critical_spec => $o->get('critical-load'),
5233 oktorun => sub { return $oktorun },5281 get_status => $get_status,
5234 sleep => $sleep,5282 oktorun => sub { return $oktorun },
5235 );5283 sleep => $sleep,
5284 );
5285 };
5286 if ( $EVAL_ERROR ) {
5287 chomp $EVAL_ERROR;
5288 die "Error checking --max-load or --critial-load: $EVAL_ERROR. "
5289 . "Check that the variables specified for --max-load and "
5290 . "--critical-load are spelled correctly and exist in "
5291 . "SHOW GLOBAL STATUS. Current values for these options are:\n"
5292 . " --max-load " . (join(',', @{$o->get('max-load')})) . "\n"
5293 . " --critial-load " . (join(',', @{$o->get('critical-load')}))
5294 . "\n";
5295 }
5236 5296
5237 if ( $o->get('progress') ) {5297 if ( $o->get('progress') ) {
5238 $replica_lag_pr = new Progress(5298 $replica_lag_pr = new Progress(
52395299
=== modified file 'bin/pt-table-checksum'
--- bin/pt-table-checksum 2012-05-24 17:25:20 +0000
+++ bin/pt-table-checksum 2012-05-25 21:39:18 +0000
@@ -5653,18 +5653,24 @@
5653 }5653 }
56545654
5655 PTDEBUG && _d('Parsing spec for max thresholds');5655 PTDEBUG && _d('Parsing spec for max thresholds');
5656 my $max_val_for = _parse_spec(5656 my $max_val_for = _parse_spec($args{max_spec});
5657 spec => $args{max_spec},5657 if ( $max_val_for ) {
5658 get_status => $args{get_status},5658 _check_and_set_vals(
5659 threshold_factor => 0.2, # +20%5659 vars => $max_val_for,
5660 );5660 get_status => $args{get_status},
5661 threshold_factor => 0.2, # +20%
5662 );
5663 }
56615664
5662 PTDEBUG && _d('Parsing spec for critical thresholds');5665 PTDEBUG && _d('Parsing spec for critical thresholds');
5663 my $critical_val_for = _parse_spec(5666 my $critical_val_for = _parse_spec($args{critical_spec} || []);
5664 spec => $args{critical_spec} || [],5667 if ( $critical_val_for ) {
5665 get_status => $args{get_status},5668 _check_and_set_vals(
5666 threshold_factor => 1.0, # double (x2; +100%)5669 vars => $critical_val_for,
5667 );5670 get_status => $args{get_status},
5671 threshold_factor => 1.0, # double (x2; +100%)
5672 );
5673 }
56685674
5669 my $self = {5675 my $self = {
5670 get_status => $args{get_status},5676 get_status => $args{get_status},
@@ -5678,27 +5684,29 @@
5678}5684}
56795685
5680sub _parse_spec {5686sub _parse_spec {
5681 my ( %args ) = @_;5687 my ($spec) = @_;
5682 my @required_args = qw(spec get_status);
5683 foreach my $arg ( @required_args ) {
5684 die "I need a $arg argument" unless defined $args{$arg};
5685 }
5686 my ($spec, $get_status) = @args{@required_args};
56875688
5688 return unless $spec && scalar @$spec;5689 return unless $spec && scalar @$spec;
5689 my $threshold_factor = $args{threshold_factor} || 0.20;
56905690
5691 my %max_val_for;5691 my %max_val_for;
5692 foreach my $var_val ( @$spec ) {5692 foreach my $var_val ( @$spec ) {
5693 die "Empty or undefined spec\n" unless $var_val;
5694 $var_val =~ s/^\s+//;
5695 $var_val =~ s/\s+$//g;
5696
5693 my ($var, $val) = split /[:=]/, $var_val;5697 my ($var, $val) = split /[:=]/, $var_val;
5694 die "Invalid spec: $var_val" unless $var;5698 die "$var_val does not contain a variable\n" unless $var;
5699 die "$var is not a variable name\n" unless $var =~ m/^[a-zA-Z_]+$/;
5700
5695 if ( !$val ) {5701 if ( !$val ) {
5696 my $init_val = $get_status->($var);5702 PTDEBUG && _d('Will get intial value for', $var, 'later');
5697 PTDEBUG && _d('Initial', $var, 'value:', $init_val);5703 $max_val_for{$var} = undef;
5698 $val = int(($init_val * $threshold_factor) + $init_val);5704 }
5699 }5705 else {
5700 PTDEBUG && _d('Wait if', $var, '>=', $val);5706 die "The value for $var must be a number\n"
5701 $max_val_for{$var} = $val;5707 unless $val =~ m/^[\d\.]+$/;
5708 $max_val_for{$var} = $val;
5709 }
5702 }5710 }
57035711
5704 return \%max_val_for; 5712 return \%max_val_for;
@@ -5778,6 +5786,34 @@
5778 return;5786 return;
5779}5787}
57805788
5789sub _check_and_set_vals {
5790 my (%args) = @_;
5791 my @required_args = qw(vars get_status threshold_factor);
5792 foreach my $arg ( @required_args ) {
5793 die "I need a $arg argument" unless defined $args{$arg};
5794 }
5795 my ($vars, $get_status, $threshold_factor) = @args{@required_args};
5796
5797 PTDEBUG && _d('Checking and setting values');
5798 return unless $vars && scalar %$vars;
5799
5800 foreach my $var ( keys %$vars ) {
5801 my $init_val = $get_status->($var);
5802 die "Variable $var does not exist or its value is undefined\n"
5803 unless defined $init_val;
5804 my $val;
5805 if ( defined $vars->{$var} ) {
5806 $val = $vars->{$var};
5807 }
5808 else {
5809 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
5810 $val = int(($init_val * $threshold_factor) + $init_val);
5811 $vars->{$var} = $val;
5812 }
5813 PTDEBUG && _d('Wait if', $var, '>=', $val);
5814 }
5815}
5816
5781sub _d {5817sub _d {
5782 my ($package, undef, $line) = caller 0;5818 my ($package, undef, $line) = caller 0;
5783 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }5819 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
@@ -5940,6 +5976,18 @@
59405976
5941 $o->set('chunk-time', 0) if $o->got('chunk-size');5977 $o->set('chunk-time', 0) if $o->got('chunk-size');
59425978
5979 foreach my $opt ( qw(max-load critical-load) ) {
5980 next unless $o->has($opt);
5981 my $spec = $o->get($opt);
5982 eval {
5983 MySQLStatusWaiter::_parse_spec($o->get($opt));
5984 };
5985 if ( $EVAL_ERROR ) {
5986 chomp $EVAL_ERROR;
5987 $o->save_error("Invalid --$opt: $EVAL_ERROR");
5988 }
5989 }
5990
5943 if ( !$o->get('help') ) {5991 if ( !$o->get('help') ) {
5944 if ( @ARGV > 1 ) {5992 if ( @ARGV > 1 ) {
5945 $o->save_error("More than one host specified; only one allowed");5993 $o->save_error("More than one host specified; only one allowed");
@@ -6299,12 +6347,22 @@
6299 };6347 };
6300 }6348 }
63016349
6302 $sys_load = new MySQLStatusWaiter(6350 eval {
6303 max_spec => $o->get('max-load'),6351 $sys_load = new MySQLStatusWaiter(
6304 get_status => $get_status,6352 max_spec => $o->get('max-load'),
6305 oktorun => sub { return $oktorun },6353 get_status => $get_status,
6306 sleep => $sleep,6354 oktorun => sub { return $oktorun },
6307 );6355 sleep => $sleep,
6356 );
6357 };
6358 if ( $EVAL_ERROR ) {
6359 chomp $EVAL_ERROR;
6360 die "Error checking --max-load: $EVAL_ERROR. "
6361 . "Check that the variables specified for --max-load "
6362 . "are spelled correctly and exist in "
6363 . "SHOW GLOBAL STATUS. Current value for this option is:\n"
6364 . " --max-load " . (join(',', @{$o->get('max-load')})) . "\n";
6365 }
6308 6366
6309 if ( $o->get('progress') ) {6367 if ( $o->get('progress') ) {
6310 $replica_lag_pr = new Progress(6368 $replica_lag_pr = new Progress(
63116369
=== modified file 'lib/MySQLStatusWaiter.pm'
--- lib/MySQLStatusWaiter.pm 2012-03-28 01:17:17 +0000
+++ lib/MySQLStatusWaiter.pm 2012-05-25 21:39:18 +0000
@@ -45,18 +45,24 @@
45 }45 }
4646
47 PTDEBUG && _d('Parsing spec for max thresholds');47 PTDEBUG && _d('Parsing spec for max thresholds');
48 my $max_val_for = _parse_spec(48 my $max_val_for = _parse_spec($args{max_spec});
49 spec => $args{max_spec},49 if ( $max_val_for ) {
50 get_status => $args{get_status},50 _check_and_set_vals(
51 threshold_factor => 0.2, # +20%51 vars => $max_val_for,
52 );52 get_status => $args{get_status},
53 threshold_factor => 0.2, # +20%
54 );
55 }
5356
54 PTDEBUG && _d('Parsing spec for critical thresholds');57 PTDEBUG && _d('Parsing spec for critical thresholds');
55 my $critical_val_for = _parse_spec(58 my $critical_val_for = _parse_spec($args{critical_spec} || []);
56 spec => $args{critical_spec} || [],59 if ( $critical_val_for ) {
57 get_status => $args{get_status},60 _check_and_set_vals(
58 threshold_factor => 1.0, # double (x2; +100%)61 vars => $critical_val_for,
59 );62 get_status => $args{get_status},
63 threshold_factor => 1.0, # double (x2; +100%)
64 );
65 }
6066
61 my $self = {67 my $self = {
62 get_status => $args{get_status},68 get_status => $args{get_status},
@@ -79,27 +85,29 @@
79# Returns:85# Returns:
80# Hashref with each variable's maximum permitted value.86# Hashref with each variable's maximum permitted value.
81sub _parse_spec {87sub _parse_spec {
82 my ( %args ) = @_;88 my ($spec) = @_;
83 my @required_args = qw(spec get_status);
84 foreach my $arg ( @required_args ) {
85 die "I need a $arg argument" unless defined $args{$arg};
86 }
87 my ($spec, $get_status) = @args{@required_args};
8889
89 return unless $spec && scalar @$spec;90 return unless $spec && scalar @$spec;
90 my $threshold_factor = $args{threshold_factor} || 0.20;
9191
92 my %max_val_for;92 my %max_val_for;
93 foreach my $var_val ( @$spec ) {93 foreach my $var_val ( @$spec ) {
94 die "Empty or undefined spec\n" unless $var_val;
95 $var_val =~ s/^\s+//;
96 $var_val =~ s/\s+$//g;
97
94 my ($var, $val) = split /[:=]/, $var_val;98 my ($var, $val) = split /[:=]/, $var_val;
95 die "Invalid spec: $var_val" unless $var;99 die "$var_val does not contain a variable\n" unless $var;
100 die "$var is not a variable name\n" unless $var =~ m/^[a-zA-Z_]+$/;
101
96 if ( !$val ) {102 if ( !$val ) {
97 my $init_val = $get_status->($var);103 PTDEBUG && _d('Will get intial value for', $var, 'later');
98 PTDEBUG && _d('Initial', $var, 'value:', $init_val);104 $max_val_for{$var} = undef;
99 $val = int(($init_val * $threshold_factor) + $init_val);105 }
100 }106 else {
101 PTDEBUG && _d('Wait if', $var, '>=', $val);107 die "The value for $var must be a number\n"
102 $max_val_for{$var} = $val;108 unless $val =~ m/^[\d\.]+$/;
109 $max_val_for{$var} = $val;
110 }
103 }111 }
104112
105 return \%max_val_for; 113 return \%max_val_for;
@@ -192,6 +200,34 @@
192 return;200 return;
193}201}
194202
203sub _check_and_set_vals {
204 my (%args) = @_;
205 my @required_args = qw(vars get_status threshold_factor);
206 foreach my $arg ( @required_args ) {
207 die "I need a $arg argument" unless defined $args{$arg};
208 }
209 my ($vars, $get_status, $threshold_factor) = @args{@required_args};
210
211 PTDEBUG && _d('Checking and setting values');
212 return unless $vars && scalar %$vars;
213
214 foreach my $var ( keys %$vars ) {
215 my $init_val = $get_status->($var);
216 die "Variable $var does not exist or its value is undefined\n"
217 unless defined $init_val;
218 my $val;
219 if ( defined $vars->{$var} ) {
220 $val = $vars->{$var};
221 }
222 else {
223 PTDEBUG && _d('Initial', $var, 'value:', $init_val);
224 $val = int(($init_val * $threshold_factor) + $init_val);
225 $vars->{$var} = $val;
226 }
227 PTDEBUG && _d('Wait if', $var, '>=', $val);
228 }
229}
230
195sub _d {231sub _d {
196 my ($package, undef, $line) = caller 0;232 my ($package, undef, $line) = caller 0;
197 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }233 @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
198234
=== modified file 't/lib/MySQLStatusWaiter.t'
--- t/lib/MySQLStatusWaiter.t 2012-03-28 01:17:17 +0000
+++ t/lib/MySQLStatusWaiter.t 2012-05-25 21:39:18 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 14;12use Test::More tests => 17;
1313
14use MySQLStatusWaiter;14use MySQLStatusWaiter;
15use PerconaTest;15use PerconaTest;
@@ -39,11 +39,48 @@
39 return;39 return;
40}40}
4141
42# #############################################################################
43# _parse_spec()
44# #############################################################################
45
46throws_ok(
47 sub { new MySQLStatusWaiter(
48 max_spec => [qw(100)],
49 get_status => \&get_status,
50 sleep => \&sleep,
51 oktorun => \&oktorun,
52 ) },
53 qr/100 is not a variable name/,
54 "Catch non-variable name"
55);
56
57throws_ok(
58 sub { new MySQLStatusWaiter(
59 max_spec => [qw(foo=bar)],
60 get_status => \&get_status,
61 sleep => \&sleep,
62 oktorun => \&oktorun,
63 ) },
64 qr/value for foo must be a number/,
65 "Catch non-number value"
66);
67
68throws_ok(
69 sub { new MySQLStatusWaiter(
70 max_spec => [qw(foo)],
71 get_status => \&get_status,
72 sleep => \&sleep,
73 oktorun => \&oktorun,
74 ) },
75 qr/foo does not exist/,
76 "Catch non-existent variable"
77);
78
42# ############################################################################79# ############################################################################
43# Use initial vals + 20%.80# Use initial vals + 20%.
44# ############################################################################81# ############################################################################
45@vals = (82@vals = (
46 # initial values83 # initial check for existence
47 { Threads_connected => 10, },84 { Threads_connected => 10, },
48 { Threads_running => 5, },85 { Threads_running => 5, },
4986
@@ -68,6 +105,8 @@
68 { Threads_running => 5, },105 { Threads_running => 5, },
69);106);
70107
108$oktorun = 1;
109
71my $sw = new MySQLStatusWaiter(110my $sw = new MySQLStatusWaiter(
72 oktorun => \&oktorun,111 oktorun => \&oktorun,
73 get_status => \&get_status,112 get_status => \&get_status,
@@ -127,6 +166,10 @@
127# Use static vals.166# Use static vals.
128# ############################################################################167# ############################################################################
129@vals = (168@vals = (
169 # initial check for existence
170 { Threads_connected => 1, },
171 { Threads_running => 1, },
172
130 # first check, no wait173 # first check, no wait
131 { Threads_connected => 1, },174 { Threads_connected => 1, },
132 { Threads_running => 1, },175 { Threads_running => 1, },
@@ -208,6 +251,10 @@
208# Critical thresholds (with static vals).251# Critical thresholds (with static vals).
209# ############################################################################252# ############################################################################
210@vals = (253@vals = (
254 # initial check for existence
255 { Threads_running => 1, },
256 { Threads_running => 9, },
257
211 # first check, no wait258 # first check, no wait
212 { Threads_running => 1, },259 { Threads_running => 1, },
213 { Threads_running => 9, },260 { Threads_running => 9, },
214261
=== modified file 't/pt-online-schema-change/option_sanity.t'
--- t/pt-online-schema-change/option_sanity.t 2012-05-25 16:24:32 +0000
+++ t/pt-online-schema-change/option_sanity.t 2012-05-25 21:39:18 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 6;12use Test::More tests => 8;
1313
14use PerconaTest;14use PerconaTest;
1515
@@ -58,6 +58,20 @@
58 "Cannot --alter-foreign-keys-method=drop_swap with --no-drop-new-table"58 "Cannot --alter-foreign-keys-method=drop_swap with --no-drop-new-table"
59);59);
6060
61$output = `$cmd h=127.1,P=12345,u=msandbox,p=msandbox,D=mysql,t=user --max-load 100 --alter "ENGINE=MyISAM" --dry-run`;
62like(
63 $output,
64 qr/Invalid --max-load/,
65 "Validates --max-load"
66);
67
68$output = `$cmd h=127.1,P=12345,u=msandbox,p=msandbox,D=mysql,t=user --critical-load 100 --alter "ENGINE=MyISAM" --dry-run`;
69like(
70 $output,
71 qr/Invalid --critical-load/,
72 "Validates --critical-load"
73);
74
61# #############################################################################75# #############################################################################
62# Done.76# Done.
63# #############################################################################77# #############################################################################
6478
=== modified file 't/pt-table-checksum/option_sanity.t'
--- t/pt-table-checksum/option_sanity.t 2011-12-27 17:24:35 +0000
+++ t/pt-table-checksum/option_sanity.t 2012-05-25 21:39:18 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 18;12use Test::More tests => 19;
1313
14use PerconaTest;14use PerconaTest;
15shift @INC; # our unshift (above)15shift @INC; # our unshift (above)
@@ -157,6 +157,17 @@
157);157);
158158
159# #############################################################################159# #############################################################################
160# --max-load
161# #############################################################################
162
163$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345 --max-load 100`;
164like(
165 $output,
166 qr/Invalid --max-load/,
167 "Validates --max-load"
168);
169
170# #############################################################################
160# Done.171# Done.
161# #############################################################################172# #############################################################################
162exit;173exit;

Subscribers

People subscribed via source and target branches