2 # Demonstrated that updates depend on file timestamps
4 echo "Testing timings of updates"
6 rm -f idx.log log timeref[12]
7 rm -f records/esdd000[12].grs # these should not be here, will be created later
8 ../../index/zebraidx -l idx.log init || exit 1
9 touch timeref1 # make an early timestamp
11 echo " killing old server (if any)..."
12 test -f zebrasrv.pid && kill -9 `cat zebrasrv.pid`
16 echo " starting server..."
17 ../../index/zebrasrv -S -c zebra2.cfg -l srv.log tcp:@:9901 &
19 test -f zebrasrv.pid || exit 1
20 touch timeref2 # make a later timestamp
23 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
26 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
27 grep "^Result count: 9$" log || exit 1
29 echo "making a test record..."
30 cp records/esdd0006.grs records/esdd0002.grs
31 touch -r timeref1 records/esdd0002.grs
33 echo " indexing it..."
34 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
37 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
38 grep "^Result count: 10$" log || exit 1
40 echo " modifying a test record (xyz)..."
41 sed 's/UTAH/XYZ/g' <records/esdd0002.grs >records/esdd0002x.grs
42 mv records/esdd0002x.grs records/esdd0002.grs
43 touch -r timeref1 records/esdd0002.grs # reset timestamp to 'early'
45 echo " not indexing it..."
46 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
49 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
51 grep "^Result count: 10$" log || exit 1
53 echo " touching its timestamp..."
54 touch -r timeref2 records/esdd0002.grs # set timestamp to 'late'
56 echo " indexing it..."
57 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
60 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
62 grep "^Result count: 9$" log || exit 1
64 echo "stopping server..."
65 test -f zebrasrv.pid || exit 1
66 kill -9 `cat zebrasrv.pid` || exit 1
67 rm -f idx.log log timeref[12]
68 rm -f records/esdd000[12].grs