randgen team mailing list archive
-
randgen team
-
Mailing list archive
-
Message #00259
Narrow horizons for binary search in Reporter.pm
Hi all,
Whoever feels being in charge for the main tree, please consider
including the following patch or any modifications of it.
Story:
Modern versions have a "normal-style" basedirs, while findMySQLD in
Reporter.pm favors the old MTRv1 style. In some circumstances, depending
on the directory structure and system caches, it can cause major slow
down and/or wrong search results.
E.g. if you have something like
/data/5.1
/data/5.1.70
/data/5.5
/data/5.5.30
/data/5.5.35
/data/5.6
/data/5.6.10
/data/5.6.15
/data/5.7
and you are running tests on /data/5.6, findMySQLD will go through
/data/5.6 and /data/ to search for mysqld, so it can take minutes to
initialize the reporter, see the timestamps:
# 2014-03-24T04:03:01 Creating MySQL table DD, size 100 rows, engine .
# 2014-03-24T04:03:02 Reporters: ErrorLog, Backtrace
# 2014-03-24T04:08:03 Validators: ErrorMessageCorruption
# 2014-03-24T04:08:03 Caching schema metadata for ...
It can be changed fairly easily, with something like
####################################
=== modified file 'lib/GenTest/Reporter.pm'
--- lib/GenTest/Reporter.pm 2012-11-06 11:50:40 +0000
+++ lib/GenTest/Reporter.pm 2014-03-23 23:34:26 +0000
@@ -244,8 +244,11 @@
sub findMySQLD {
my ($reporter,$binname)=@_;
my $bindir;
+ my @basedirs=($reporter->serverVariable('basedir'));
# Handling general basedirs and MTRv1 style basedir.
- my
@basedirs=($reporter->serverVariable('basedir'),File::Spec->catfile($reporter->serverVariable('basedir'),'..'));
+ if ($reporter->serverVariable('basedir') =~ m{mysql-test[\/\\]?}) {
+ push @basedirs,
File::Spec->catfile($reporter->serverVariable('basedir'),'..');
+ }
find(sub {
$bindir=$File::Find::dir if $_ eq $binname;
}, @basedirs);
####################################
or, trying to be a bit more smart and/or cautious,
####################################
=== modified file 'lib/GenTest/Reporter.pm'
--- lib/GenTest/Reporter.pm 2012-11-06 11:50:40 +0000
+++ lib/GenTest/Reporter.pm 2013-12-30 14:36:35 +0000
@@ -244,8 +244,13 @@
sub findMySQLD {
my ($reporter,$binname)=@_;
my $bindir;
- # Handling general basedirs and MTRv1 style basedir.
- my
@basedirs=($reporter->serverVariable('basedir'),File::Spec->catfile($reporter->serverVariable('basedir'),'..'));
+ # Handling general basedirs and MTRv1 style basedir,
+ # but trying not to search the entire universe just for the sake of it
+ my @basedirs = ($reporter->serverVariable('basedir'));
+ if (! -e
File::Spec->catfile($reporter->serverVariable('basedir'),'mysql-test')
and -e File::Spec->catfile($reporter->serverVariable('basedir'),'t')) {
+ # Assuming it's the MTRv1 style basedir
+
@basedirs=(File::Spec->catfile($reporter->serverVariable('basedir'),'..'));
+ }
find(sub {
$bindir=$File::Find::dir if $_ eq $binname;
}, @basedirs);
####################################
Or in any other similar way.
I've had the latter in my branch for some time now, but I don't want to
force everyone who I work with to switch to it, so it would be nice to
have it fixed in the trunk as well.
Regards,
Elena