Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ad175936
Commit
ad175936
authored
Oct 23, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ftbench fixes
parent
94457097
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
55 deletions
+99
-55
myisam/ftbench/Ecompare.pl
myisam/ftbench/Ecompare.pl
+2
-2
myisam/ftbench/Ecreate.pl
myisam/ftbench/Ecreate.pl
+44
-0
myisam/ftbench/Ereport.pl
myisam/ftbench/Ereport.pl
+2
-2
myisam/ftbench/README
myisam/ftbench/README
+12
-25
myisam/ftbench/ft-test-run.sh
myisam/ftbench/ft-test-run.sh
+39
-26
No files found.
myisam/ftbench/Ecompare.pl
View file @
ad175936
...
...
@@ -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
{
...
...
myisam/ftbench/Ecreate.pl
0 → 100755
View file @
ad175936
#!/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__
myisam/ftbench/Ereport.pl
View file @
ad175936
...
...
@@ -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
;
...
...
myisam/ftbench/README
View file @
ad175936
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
...
...
myisam/ftbench/ft-test-run.sh
View file @
ad175936
...
...
@@ -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
"
N
o
$prog
"
echo
"
build failed: n
o
$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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment