From: Bjorn Munch Date: November 3 2010 1:20pm Subject: bzr commit into mysql-5.1-mtr branch (bjorn.munch:2948) Bug#57840 List-Archive: http://lists.mysql.com/commits/122679 X-Bug: 57840 Message-Id: <201011031320.oA3DKBbU018293@khepri15.norway.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1359508448==" --===============1359508448== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/bm136801/my/ordpar-51/ based on revid:bjorn.munch@stripped 2948 Bjorn Munch 2010-11-03 Bug #57840 MTR: parallel execution breaks with smart ordering of test cases Improvements from first patch Got rid of sort_criteria hash, put it into the test case itself This also simplifies tagging similar tests during execution This is a new complete patch, not an addendum modified: mysql-test/lib/mtr_cases.pm mysql-test/mysql-test-run.pl === modified file 'mysql-test/lib/mtr_cases.pm' --- a/mysql-test/lib/mtr_cases.pm 2010-08-30 09:25:10 +0000 +++ b/mysql-test/lib/mtr_cases.pm 2010-11-03 13:17:14 +0000 @@ -170,8 +170,6 @@ sub collect_test_cases ($$$) { if ( $opt_reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run - my %sort_criteria; - # Make a mapping of test name to a string that represents how that test # should be sorted among the other tests. Put the most important criterion # first, then a sub-criterion, then sub-sub-criterion, etc. @@ -183,24 +181,29 @@ sub collect_test_cases ($$$) { # Append the criteria for sorting, in order of importance. # push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B")); + push(@criteria, $tinfo->{template_path}); # Group test with equal options together. # Ending with "~" makes empty sort later than filled my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; push(@criteria, join("!", sort @{$opts}) . "~"); + # Add slave opts if any + if ($tinfo->{'slave_opt'}) + { + push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}})); + } - $sort_criteria{$tinfo->{name}} = join(" ", @criteria); + $tinfo->{criteria}= join(" ", @criteria); } - @$cases = sort { - $sort_criteria{$a->{'name'}} . $a->{'name'} cmp - $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases; + @$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases; # For debugging the sort-order # foreach my $tinfo (@$cases) # { - # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n"); + # my $tname= $tinfo->{name} . ' ' . $tinfo->{combination}; + # my $crit= $tinfo->{criteria}; + # print("$tname\n\t$crit\n"); # } - } if (defined $print_testcases){ === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2010-10-19 12:01:14 +0000 +++ b/mysql-test/mysql-test-run.pl 2010-11-03 13:17:14 +0000 @@ -662,22 +662,37 @@ sub run_test_server ($$$) { next; } - # Prefer same configuration, or just use next if --noreorder - if (!$opt_reorder or (defined $result and - $result->{template_path} eq $t->{template_path})) - { - #mtr_report("Test uses same config => good match"); - # Test uses same config => good match - $next= splice(@$tests, $i, 1); - last; - } - # Second best choice is the first that does not fulfill # any of the above conditions if (!defined $second_best){ #mtr_report("Setting second_best to $i"); $second_best= $i; } + + # Smart allocation of next test within this thread. + + if ($opt_reorder and $opt_parallel > 1 and defined $result) + { + my $wid= $result->{worker}; + # Reserved for other thread, try next + next if (defined $t->{reserved} and $t->{reserved} != $wid); + if (! defined $t->{reserved}) + { + # Reserve similar tests for this worker, but not too many + my $maxres= (@$tests - $i) / $opt_parallel + 1; + for (my $j= $i+1; $j <= $i + $maxres; $j++) + { + my $tt= $tests->[$j]; + last unless defined $tt; + last if $tt->{criteria} ne $t->{criteria}; + $tt->{reserved}= $wid; + } + } + } + + # At this point we have found next suitable test + $next= splice(@$tests, $i, 1); + last; } # Use second best choice if no other test has been found @@ -689,7 +704,8 @@ sub run_test_server ($$$) { } if ($next) { - #$next->print_test(); + # We don't need this any more + delete $next->{criteria}; $next->write_test($sock, 'TESTCASE'); $running{$next->key()}= $next; $num_ndb_tests++ if ($next->{ndb_test}); @@ -4575,17 +4591,6 @@ sub server_need_restart { } } - # Temporary re-enable the "always restart slave" hack - # this should be removed asap, but will require that each rpl - # testcase cleanup better after itself - ie. stop and reset - # replication - # Use the "#!use-slave-opt" marker to detect that this is a "slave" - # server - if ( $server->option("#!use-slave-opt") ){ - mtr_verbose_restart($server, "Always restart slave(s)"); - return 1; - } - my $is_mysqld= grep ($server eq $_, mysqlds()); if ($is_mysqld) { --===============1359508448== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/bjorn.munch@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: bjorn.munch@stripped # target_branch: file:///home/bm136801/my/ordpar-51/ # testament_sha1: 4e681296cb2adccbc48edf53335910ec16f59c2b # timestamp: 2010-11-03 14:20:11 +0100 # base_revision_id: bjorn.munch@stripped\ # fltvohh2z890zgsd # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWVHPvB0AA2ffgFAwfO///3Ki HI6////6YAeZ0c7vgByPcz303WCVz3uNPVwkkQaTIApvTJM0IxRsmmp5TJpoyNDQyDUyCaZMjU9U eo0PRMj1NGgBoBoAADTSYhKnp6SbNJqep6NM0p6nkhkAGRphND1AxEkyI0NpN6iNB6jQ2p6mQ9Ro NANNAA2lVPCmynqbII00MmBGTJoADQAYIJIQQAQI0JtIR5T0myEaZGjQAHqMgQMAEYA503kHwt/0 m3ssDLP6SZ6UOfj5tGsUgoF7urm7RrESOrAcRwsqXiUffx/HfcBlKCuCyQAtdHBsZ6bAUkJcJJJY 4UiEkkkklQWJcoRoc3tN7JSduUNtOmu78ijKi6iKzzOrAvudGOXx7v1ondpyDvHSCCQASBqqE5NP PFvpulsvnfV9ZUpusWfLwQwerCwViJM0iQLGnDeG3Jx5OHi2CmNQJqynzTwZnisxH90dM79SnNYe LO1nzexPwcXkqgzJV9jOOkxUJNet86VzVKCtUaKglVkXLQtrK3YaJRJr2hSYB4DnKisNS4gZFAyz 6HJO7hL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