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