2 # $Id: timing2.sh,v 1.9 2004-06-15 09:43:30 adam Exp $
3 # Demonstrated that updates depend on file timestamps
11 echo " init..." >>$LOG
13 rm -f $pp/records/esdd000[12].grs # these should not be here, will be created later
14 ../../index/zebraidx -c $pp/zebra2.cfg -l $LOG init || exit 1
15 touch timeref1 # make an early timestamp
17 echo " killing old server (if any)..." >>$LOG
18 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
20 echo " starting server..." >>$LOG
21 ../../index/zebrasrv -S -c $pp/zebra2.cfg -l $LOG tcp:@:9901 &
23 test -f zebrasrv.pid || exit 1
24 touch timeref2 # make a later timestamp
26 echo " update 1..." >>$LOG
27 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
29 echo " search 1..." >>$LOG
30 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
31 grep "^Result count: 9$" log >/dev/null || exit 1
33 echo "making a test record..." >>$LOG
34 cp $pp/records/esdd0006.grs $pp/records/esdd0002.grs
35 touch -r timeref1 $pp/records/esdd0002.grs
37 echo " indexing it..." >>$LOG
38 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
40 echo " search 2..." >>$LOG
41 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
42 grep "^Result count: 10$" log >/dev/null || exit 1
44 echo " modifying a test record (xyz)..." >>$LOG
45 sed 's/UTAH/XYZ/g' <$pp/records/esdd0002.grs >$pp/records/esdd0002x.grs
46 mv $pp/records/esdd0002x.grs $pp/records/esdd0002.grs
47 touch -r timeref1 $pp/records/esdd0002.grs # reset timestamp to 'early'
49 echo " not indexing it..." >>$LOG
50 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
52 echo " search 3..." >>$LOG
53 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
54 echo " checking..." >>$LOG
55 grep "^Result count: 10$" log >/dev/null || exit 1
57 echo " touching its timestamp..." >>$LOG
58 touch -r timeref2 $pp/records/esdd0002.grs # set timestamp to 'late'
60 echo " indexing it..." >>$LOG
61 ../../index/zebraidx -l $LOG -c $pp/zebra2.cfg update $pp/records || exit 1
63 echo " search 4..." >>$LOG
64 ../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
65 echo " checking..." >>$LOG
66 grep "^Result count: 9$" log >/dev/null || exit 1
68 echo "stopping server..." >>$LOG
69 test -f zebrasrv.pid || exit 1
70 kill `cat zebrasrv.pid` || exit 1
72 rm -f $pp/records/esdd000[12].grs