2 # $Id: timing2.sh,v 1.4 2003-05-06 17:39:01 adam Exp $
3 # Demonstrated that updates depend on file timestamps
5 echo "Testing timings of updates"
7 rm -f idx.log log timeref[12]
8 rm -f records/esdd000[12].grs # these should not be here, will be created later
9 ../../index/zebraidx -c zebra2.cfg -l idx.log init || exit 1
10 touch timeref1 # make an early timestamp
12 echo " killing old server (if any)..."
13 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
17 echo " starting server..."
18 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
20 test -f zebrasrv.pid || exit 1
21 touch timeref2 # make a later timestamp
24 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
27 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
28 grep "^Result count: 9$" log || exit 1
30 echo "making a test record..."
31 cp records/esdd0006.grs records/esdd0002.grs
32 touch -r timeref1 records/esdd0002.grs
34 echo " indexing it..."
35 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
38 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
39 grep "^Result count: 10$" log || exit 1
41 echo " modifying a test record (xyz)..."
42 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
43 mv records/esdd0002x.grs records/esdd0002.grs
44 touch -r timeref1 records/esdd0002.grs # reset timestamp to 'early'
46 echo " not indexing it..."
47 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
50 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
52 grep "^Result count: 10$" log || exit 1
54 echo " touching its timestamp..."
55 touch -r timeref2 records/esdd0002.grs # set timestamp to 'late'
57 echo " indexing it..."
58 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
61 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
63 grep "^Result count: 9$" log || exit 1
65 echo "stopping server..."
66 test -f zebrasrv.pid || exit 1
67 kill -9 `cat zebrasrv.pid` || exit 1
68 rm -f idx.log log timeref[12]
69 rm -f records/esdd000[12].grs