summaryrefslogtreecommitdiff
path: root/myisam/ftbench
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2003-10-23 23:33:06 +0200
committerunknown <serg@serg.mylan>2003-10-23 23:33:06 +0200
commit4f6f05694b94f621b14c11459a4f321d93f25f76 (patch)
treea49c053f04a6ac04e2f84d09adaef67bd83bedc9 /myisam/ftbench
parent454ddc1709277cc89d54bfcd07a5dfc2d562d47c (diff)
downloadmariadb-git-4f6f05694b94f621b14c11459a4f321d93f25f76.tar.gz
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
Diffstat (limited to 'myisam/ftbench')
-rwxr-xr-xmyisam/ftbench/Ecompare.pl4
-rwxr-xr-xmyisam/ftbench/Ecreate.pl44
-rwxr-xr-xmyisam/ftbench/Ereport.pl4
-rw-r--r--myisam/ftbench/README37
-rwxr-xr-xmyisam/ftbench/ft-test-run.sh65
5 files changed, 99 insertions, 55 deletions
diff --git a/myisam/ftbench/Ecompare.pl b/myisam/ftbench/Ecompare.pl
index 4bcee1fb588..265534e704d 100755
--- a/myisam/ftbench/Ecompare.pl
+++ b/myisam/ftbench/Ecompare.pl
@@ -73,14 +73,14 @@ for $file (split) {
for (0..$#l1) {
$pp[$_]+=$p[$_]; $mm[$_]+=$m[$_];
- $total.=rep($file, ($#l1 ? $_ : undef), $p[$_], $m[$_]);
+ $total[$_].=rep($file, ($#l1 ? $_ : undef), $p[$_], $m[$_]);
}
close OUT1;
close OUT2;
}
for (0..$#l1) {
- rep($total, ($#l1 ? $_ : undef), $pp[$_], $mm[$_]);
+ rep($total[$_], ($#l1 ? $_ : undef), $pp[$_], $mm[$_]);
}
sub rep {
diff --git a/myisam/ftbench/Ecreate.pl b/myisam/ftbench/Ecreate.pl
new file mode 100755
index 00000000000..d90a6f7a0ad
--- /dev/null
+++ b/myisam/ftbench/Ecreate.pl
@@ -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__
+
+
diff --git a/myisam/ftbench/Ereport.pl b/myisam/ftbench/Ereport.pl
index 761c707fcda..5969304da09 100755
--- a/myisam/ftbench/Ereport.pl
+++ b/myisam/ftbench/Ereport.pl
@@ -29,7 +29,7 @@ sub Favg { my $a=shift; $Pavg*$Ravg ? 1/($a/$Pavg+(1-$a)/$Ravg) : 0; }
# F0 : a=0 -- ignore precision
# F5 : a=0.5
# F1 : a=1 -- ignore recall
- while($eout_str =~ /^$qid\s+(\d+)\s+(\d+\.\d+)/) {
+ while($eout_str =~ /^$qid\s+(\d+)\s+(\d+(?:\.\d+)?)/) {
$B++;
$AB++ if $dq{$1+0};
$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;
$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;
diff --git a/myisam/ftbench/README b/myisam/ftbench/README
index 649d06d86bb..b1f8b66b15f 100644
--- a/myisam/ftbench/README
+++ b/myisam/ftbench/README
@@ -1,31 +1,17 @@
1. should be run from myisam/ftbench/
2. myisam/ftdefs.h should NOT be locked (bk get, not bk edit!)
3. there should be ./data/ subdir with test collections, files:
- test1.test
- test1.relj
- test2.test
- test2.relj
+ test1.d
+ test1.q
+ test1.r
+ test2.d
+ test2.q
+ test2.r
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...'),...
-...
-
-SELECT COUNT(*) FROM ft;
-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:
+
+ *.[dq] files contain documents/queries one item per line.
+
+ *.r files have the structure:
1 16 .....blablabla
1 09 .....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.
- 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!
delete them to re-test
diff --git a/myisam/ftbench/ft-test-run.sh b/myisam/ftbench/ft-test-run.sh
index 2c04d24a185..ceba818fa5c 100755
--- a/myisam/ftbench/ft-test-run.sh
+++ b/myisam/ftbench/ft-test-run.sh
@@ -15,12 +15,7 @@ SOCK=$DATA/mysql.sock
PID=$DATA/mysql.pid
H=../ftdefs.h
OPTS="--no-defaults --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
-
-# --ft_min_word_len=#
-# --ft_max_word_len=#
-# --ft_max_word_len_for_sort=#
-# --ft_stopword_file=name
-# --key_buffer_size=#
+DELAY=10
stop_myslqd()
{
@@ -38,48 +33,66 @@ if [ -w $H ] ; then
exit 1
fi
-for batch in t/BEST t/* ; do
- A=`ls $batch/*.out`
- [ ! -d $batch -o -n "$A" ] && continue
+stop_myslqd
+rm -rf var > /dev/null 2>&1
+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
- ln -s $BASE/$batch/ftdefs.h $H
- touch $H
+ if [ -f $BASE/$batch/ftdefs.h ] ; then
+ 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"
stop_myslqd
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
if [ ! -x $prog ] ; then
- echo "No $prog"
+ echo "build failed: no $prog"
exit 1
fi
done
- rm -rf var 2>&1 >/dev/null
- mkdir var
- mkdir var/test
-
+ echo "=====================================" >> var/ft_test.log
$MYSQLD $OPTS --basedir=$BASE --skip-bdb --pid-file=$PID \
--language=$ROOT/sql/share/english \
--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
if [ $? != 0 ] ; then
echo "$MYSQLD refused to start"
exit 1
fi
- for test in `cd data; echo *.test|sed "s/\.test//g"` ; do
- echo "test $batch/$test"
- $MYSQL $OPTS --skip-column-names test <data/$test.test >var/$test.eval
- echo "report $batch/$test"
- ./Ereport.pl var/$test.eval data/$test.relj > $batch/$test.out || exit
+ for test in `cd data; echo *.r|sed "s/\.r//g"` ; do
+ if [ -f $batch/$test.out ] ; then
+ echo "skipping $batch/$test.out"
+ continue
+ 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
stop_myslqd
rm -f $H
- echo "compare $batch"
- [ $batch -ef t/BEST ] || ./Ecompare.pl t/BEST $batch >> t/BEST/report.txt
+ bk get -q $H
+ if [ ! $batch -ef t/BEST ] ; then
+ echo "comparing $batch"
+ ./Ecompare.pl t/BEST $batch >> t/BEST/report.txt
+ fi
done