From 2e72b47e85158717de72995583e46e5ae1324bae Mon Sep 17 00:00:00 2001 From: frank-cizmich Date: Fri, 24 Apr 2015 13:06:29 -0300 Subject: [PATCH 1/2] pt-osc avoid error loop - lp 1446928 --- bin/pt-online-schema-change | 9 ++++++--- t/pt-online-schema-change/bugs.t | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index ead42cfd..a16e74cd 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -8555,14 +8555,17 @@ sub main { my $cleanup = new CleanupTask( sub { # XXX We shouldn't copy $EVAL_ERROR here, but I found that - # errors are not re-thrown in tests. If you comment out this + # errors are not re-thrown in tests. If you comment (*) out this # line and the die below, an error fails: # not ok 5 - Doesn't try forever to find a new table name # Failed test 'Doesn't try forever to find a new table name' # at /Users/daniel/p/pt-osc-2.1.1/lib/PerconaTest.pm line 559. # '' # doesn't match '(?-xism:Failed to find a unique new table name)' - my $original_error = $EVAL_ERROR; + #my $original_error = $EVAL_ERROR; + # + # (*) commented them for now because it caused infinite loop (frank) + # and the mentioned test error doesn't arise foreach my $task ( reverse @cleanup_tasks ) { eval { $task->(); @@ -8571,7 +8574,7 @@ sub main { warn "Error cleaning up: $EVAL_ERROR\n"; } } - die $original_error if $original_error; # rethrow original error + #die $original_error if $original_error; # rethrow original error return; } ); diff --git a/t/pt-online-schema-change/bugs.t b/t/pt-online-schema-change/bugs.t index 7ddb9b6b..39bdb2df 100644 --- a/t/pt-online-schema-change/bugs.t +++ b/t/pt-online-schema-change/bugs.t @@ -433,6 +433,15 @@ $output = output( # clear databases $sb->load_file('master', "$sample/bug-1340728_cleanup.sql"); + +# ############################################################################# +# Issue p +# +# fails when no index is returned in EXPLAIN, even though --nocheck-plan is set +# (happens on HASH indexes) +# ############################################################################# + + # ############################################################################# # Done. # ############################################################################# From 703f803ae6f61aac81fa0bb9e3f616006e7c2afe Mon Sep 17 00:00:00 2001 From: frank-cizmich Date: Thu, 11 Jun 2015 16:40:00 -0300 Subject: [PATCH 2/2] pt-osc modified some comments --- bin/pt-online-schema-change | 8 +++++--- t/pt-online-schema-change/bugs.t | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index a16e74cd..f6c90597 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -8562,10 +8562,12 @@ sub main { # at /Users/daniel/p/pt-osc-2.1.1/lib/PerconaTest.pm line 559. # '' # doesn't match '(?-xism:Failed to find a unique new table name)' - #my $original_error = $EVAL_ERROR; - # - # (*) commented them for now because it caused infinite loop (frank) + + # (*) Frank: commented them out because it caused infinite loop # and the mentioned test error doesn't arise + + #my $original_error = $EVAL_ERROR; + foreach my $task ( reverse @cleanup_tasks ) { eval { $task->(); diff --git a/t/pt-online-schema-change/bugs.t b/t/pt-online-schema-change/bugs.t index 39bdb2df..72250d9c 100644 --- a/t/pt-online-schema-change/bugs.t +++ b/t/pt-online-schema-change/bugs.t @@ -435,12 +435,28 @@ $sb->load_file('master', "$sample/bug-1340728_cleanup.sql"); # ############################################################################# -# Issue p -# -# fails when no index is returned in EXPLAIN, even though --nocheck-plan is set -# (happens on HASH indexes) +# Issue LP 1446928 +# Avoids an error trapping loop when --alter option contains an invalid +# statement. +# If this test fails it might lead to "segmentation fault" or "out of memory" # ############################################################################# +$output = output( + sub { pt_online_schema_change::main(@args, "$master_dsn,D=sakila,t=actor", + '--execute', + '--alter-foreign-keys-method=drop_swap', + '--alter', "GIBBERISH", + '--nocheck-plan', + ), + }, + stderr => 1, +); + +like( + $output, + qr/Error altering new table/s, + "Bug 1446928: Avoid error trapping loop when --alter is invalid", +); # ############################################################################# # Done.