mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
ftbench fixes
myisam/ftbench/Ecompare.pl: bug in multi-column comparison fixed myisam/ftbench/Ereport.pl: bug fixed report at 0, 0.5, 1 myisam/ftbench/README: updated myisam/ftbench/ft-test-run.sh: various fixes
This commit is contained in:
parent
08236417fe
commit
21f9a3a8ac
5 changed files with 99 additions and 55 deletions
|
|
@ -73,14 +73,14 @@ for $file (split) {
|
||||||
|
|
||||||
for (0..$#l1) {
|
for (0..$#l1) {
|
||||||
$pp[$_]+=$p[$_]; $mm[$_]+=$m[$_];
|
$pp[$_]+=$p[$_]; $mm[$_]+=$m[$_];
|
||||||
$total.=rep($file, ($#l1 ? $_ : undef), $p[$_], $m[$_]);
|
$total[$_].=rep($file, ($#l1 ? $_ : undef), $p[$_], $m[$_]);
|
||||||
}
|
}
|
||||||
close OUT1;
|
close OUT1;
|
||||||
close OUT2;
|
close OUT2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (0..$#l1) {
|
for (0..$#l1) {
|
||||||
rep($total, ($#l1 ? $_ : undef), $pp[$_], $mm[$_]);
|
rep($total[$_], ($#l1 ? $_ : undef), $pp[$_], $mm[$_]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rep {
|
sub rep {
|
||||||
|
|
|
||||||
44
myisam/ftbench/Ecreate.pl
Executable file
44
myisam/ftbench/Ecreate.pl
Executable file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
$test=shift || die "Usage $0 testname [option]";
|
||||||
|
$option=shift;
|
||||||
|
|
||||||
|
open(D, "<data/$test.d") || die "Cannot open(<data/$test.d): $!";
|
||||||
|
open(Q, "<data/$test.q") || die "Cannot open(<data/$test.q): $!";
|
||||||
|
|
||||||
|
$N=0;
|
||||||
|
|
||||||
|
print <<__HEADER__;
|
||||||
|
DROP TABLE IF EXISTS $test;
|
||||||
|
CREATE TABLE $test (
|
||||||
|
id int(10) unsigned NOT NULL,
|
||||||
|
text text NOT NULL,
|
||||||
|
FULLTEXT KEY text (text)
|
||||||
|
) TYPE=MyISAM CHARSET=latin1;
|
||||||
|
|
||||||
|
ALTER TABLE $test DISABLE KEYS;
|
||||||
|
__HEADER__
|
||||||
|
|
||||||
|
while (<D>) { chomp;
|
||||||
|
s/'/\\'/g; ++$N;
|
||||||
|
print "INSERT $test VALUES ($N, '$_');\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<__PREP__;
|
||||||
|
ALTER TABLE $test ENABLE KEYS;
|
||||||
|
SELECT $N;
|
||||||
|
__PREP__
|
||||||
|
|
||||||
|
$N=0;
|
||||||
|
|
||||||
|
while (<Q>) { chomp;
|
||||||
|
s/'/\\'/g; ++$N;
|
||||||
|
$_="MATCH text AGAINST ('$_' $option)";
|
||||||
|
print "SELECT $N, id, $_ FROM $test WHERE $_;\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<__FOOTER__;
|
||||||
|
DROP TABLE $test;
|
||||||
|
__FOOTER__
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ sub Favg { my $a=shift; $Pavg*$Ravg ? 1/($a/$Pavg+(1-$a)/$Ravg) : 0; }
|
||||||
# F0 : a=0 -- ignore precision
|
# F0 : a=0 -- ignore precision
|
||||||
# F5 : a=0.5
|
# F5 : a=0.5
|
||||||
# F1 : a=1 -- ignore recall
|
# F1 : a=1 -- ignore recall
|
||||||
while($eout_str =~ /^$qid\s+(\d+)\s+(\d+\.\d+)/) {
|
while($eout_str =~ /^$qid\s+(\d+)\s+(\d+(?:\.\d+)?)/) {
|
||||||
$B++;
|
$B++;
|
||||||
$AB++ if $dq{$1+0};
|
$AB++ if $dq{$1+0};
|
||||||
$Ravg+=$AB;
|
$Ravg+=$AB;
|
||||||
|
|
@ -41,7 +41,7 @@ sub Favg { my $a=shift; $Pavg*$Ravg ? 1/($a/$Pavg+(1-$a)/$Ravg) : 0; }
|
||||||
$Ravg/=$B*$A if $B;
|
$Ravg/=$B*$A if $B;
|
||||||
$Pavg/=$B if $B;
|
$Pavg/=$B if $B;
|
||||||
|
|
||||||
printf "%5d %1.12f\n", $qid, Favg(0.5);
|
printf "%5d %1.12f %1.12f %1.12f\n", $qid, Favg(0),Favg(0.5),Favg(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,17 @@
|
||||||
1. should be run from myisam/ftbench/
|
1. should be run from myisam/ftbench/
|
||||||
2. myisam/ftdefs.h should NOT be locked (bk get, not bk edit!)
|
2. myisam/ftdefs.h should NOT be locked (bk get, not bk edit!)
|
||||||
3. there should be ./data/ subdir with test collections, files:
|
3. there should be ./data/ subdir with test collections, files:
|
||||||
test1.test
|
test1.d
|
||||||
test1.relj
|
test1.q
|
||||||
test2.test
|
test1.r
|
||||||
test2.relj
|
test2.d
|
||||||
|
test2.q
|
||||||
|
test2.r
|
||||||
where test1, test2, etc - are arbitrary test names
|
where test1, test2, etc - are arbitrary test names
|
||||||
|
|
||||||
*.test are SQL files of the structure:
|
|
||||||
=====
|
|
||||||
DROP TABLE IF EXISTS ft;
|
|
||||||
CREATE TABLE ft (
|
|
||||||
id int(10) unsigned NOT NULL,
|
|
||||||
text text NOT NULL,
|
|
||||||
FULLTEXT KEY text (text)
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO ft VALUES (1, 'doc1...'),(2, 'doc2...'),...
|
*.[dq] files contain documents/queries one item per line.
|
||||||
...
|
|
||||||
|
|
||||||
SELECT COUNT(*) FROM ft;
|
*.r files have the structure:
|
||||||
SELECT 1, id, MATCH text AGAINST ('query1') FROM ft WHERE MATCH text AGAINST ('query1');
|
|
||||||
SELECT 2, id, MATCH text AGAINST ('query2') FROM ft WHERE MATCH text AGAINST ('query2');
|
|
||||||
...
|
|
||||||
=====
|
|
||||||
|
|
||||||
*.relj files have the structure:
|
|
||||||
1 16 .....blablabla
|
1 16 .....blablabla
|
||||||
1 09 .....blablabla
|
1 09 .....blablabla
|
||||||
2 116 .....blablabla
|
2 116 .....blablabla
|
||||||
|
|
@ -47,7 +33,8 @@ SELECT 2, id, MATCH text AGAINST ('query2') FROM ft WHERE MATCH text AGAINST ('q
|
||||||
|
|
||||||
all test results are compared with BEST results.
|
all test results are compared with BEST results.
|
||||||
|
|
||||||
test directories *must* contain ftdefs.h, and *may* contain my.cnf
|
test directories may contain ftdefs.h, my.cnf, ft_mode
|
||||||
|
(the last one is used as in ... MATCH ... AGAINST ("..." $ft_mode) ...)
|
||||||
NOTE: all *.out files in test directories will NOT be overwritten!
|
NOTE: all *.out files in test directories will NOT be overwritten!
|
||||||
delete them to re-test
|
delete them to re-test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,7 @@ SOCK=$DATA/mysql.sock
|
||||||
PID=$DATA/mysql.pid
|
PID=$DATA/mysql.pid
|
||||||
H=../ftdefs.h
|
H=../ftdefs.h
|
||||||
OPTS="--no-defaults --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
|
OPTS="--no-defaults --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
|
||||||
|
DELAY=10
|
||||||
# --ft_min_word_len=#
|
|
||||||
# --ft_max_word_len=#
|
|
||||||
# --ft_max_word_len_for_sort=#
|
|
||||||
# --ft_stopword_file=name
|
|
||||||
# --key_buffer_size=#
|
|
||||||
|
|
||||||
stop_myslqd()
|
stop_myslqd()
|
||||||
{
|
{
|
||||||
|
|
@ -38,48 +33,66 @@ if [ -w $H ] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for batch in t/BEST t/* ; do
|
stop_myslqd
|
||||||
A=`ls $batch/*.out`
|
rm -rf var > /dev/null 2>&1
|
||||||
[ ! -d $batch -o -n "$A" ] && continue
|
mkdir var
|
||||||
|
mkdir var/test
|
||||||
|
|
||||||
|
for batch in t/* ; do
|
||||||
|
[ ! -d $batch ] && continue
|
||||||
|
[ $batch -ef t/BEST -a $batch != t/BEST ] && continue
|
||||||
|
|
||||||
|
rm -rf var/test/* > /dev/null 2>&1
|
||||||
rm -f $H
|
rm -f $H
|
||||||
ln -s $BASE/$batch/ftdefs.h $H
|
if [ -f $BASE/$batch/ftdefs.h ] ; then
|
||||||
touch $H
|
cat $BASE/$batch/ftdefs.h > $H
|
||||||
|
chmod a-wx $H
|
||||||
|
else
|
||||||
|
bk get -q $H
|
||||||
|
fi
|
||||||
OPTS="--defaults-file=$BASE/$batch/my.cnf --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
|
OPTS="--defaults-file=$BASE/$batch/my.cnf --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
|
||||||
stop_myslqd
|
stop_myslqd
|
||||||
rm -f $MYSQLD
|
rm -f $MYSQLD
|
||||||
(cd $ROOT; gmake)
|
echo "building $batch"
|
||||||
|
echo "============== $batch ===============" >> var/ft_test.log
|
||||||
|
(cd $ROOT; gmake) >> var/ft_test.log 2>&1
|
||||||
|
|
||||||
for prog in $MYSQLD $MYSQL $MYSQLADMIN ; do
|
for prog in $MYSQLD $MYSQL $MYSQLADMIN ; do
|
||||||
if [ ! -x $prog ] ; then
|
if [ ! -x $prog ] ; then
|
||||||
echo "No $prog"
|
echo "build failed: no $prog"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -rf var 2>&1 >/dev/null
|
echo "=====================================" >> var/ft_test.log
|
||||||
mkdir var
|
|
||||||
mkdir var/test
|
|
||||||
|
|
||||||
$MYSQLD $OPTS --basedir=$BASE --skip-bdb --pid-file=$PID \
|
$MYSQLD $OPTS --basedir=$BASE --skip-bdb --pid-file=$PID \
|
||||||
--language=$ROOT/sql/share/english \
|
--language=$ROOT/sql/share/english \
|
||||||
--skip-grant-tables --skip-innodb \
|
--skip-grant-tables --skip-innodb \
|
||||||
--skip-networking --tmpdir=$DATA &
|
--skip-networking --tmpdir=$DATA >> var/ft_test.log 2>&1 &
|
||||||
|
|
||||||
sleep 60
|
sleep $DELAY
|
||||||
$MYSQLADMIN $OPTS ping
|
$MYSQLADMIN $OPTS ping
|
||||||
if [ $? != 0 ] ; then
|
if [ $? != 0 ] ; then
|
||||||
echo "$MYSQLD refused to start"
|
echo "$MYSQLD refused to start"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
for test in `cd data; echo *.test|sed "s/\.test//g"` ; do
|
for test in `cd data; echo *.r|sed "s/\.r//g"` ; do
|
||||||
echo "test $batch/$test"
|
if [ -f $batch/$test.out ] ; then
|
||||||
$MYSQL $OPTS --skip-column-names test <data/$test.test >var/$test.eval
|
echo "skipping $batch/$test.out"
|
||||||
echo "report $batch/$test"
|
continue
|
||||||
./Ereport.pl var/$test.eval data/$test.relj > $batch/$test.out || exit
|
fi
|
||||||
|
echo "testing $batch/$test"
|
||||||
|
FT_MODE=`cat $batch/ft_mode 2>/dev/null`
|
||||||
|
./Ecreate.pl $test "$FT_MODE" | $MYSQL $OPTS --skip-column-names test >var/$test.eval
|
||||||
|
echo "reporting $batch/$test"
|
||||||
|
./Ereport.pl var/$test.eval data/$test.r > $batch/$test.out || exit
|
||||||
done
|
done
|
||||||
stop_myslqd
|
stop_myslqd
|
||||||
rm -f $H
|
rm -f $H
|
||||||
echo "compare $batch"
|
bk get -q $H
|
||||||
[ $batch -ef t/BEST ] || ./Ecompare.pl t/BEST $batch >> t/BEST/report.txt
|
if [ ! $batch -ef t/BEST ] ; then
|
||||||
|
echo "comparing $batch"
|
||||||
|
./Ecompare.pl t/BEST $batch >> t/BEST/report.txt
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue