1 # h3.sh - studying the "timing" problem
3 # timing1.sh - tests that updates are reflected immediately
4 # in the registers. Repeatedly modifies a record and counts hits.
6 echo "Testing timings of updates"
9 rm -f records/esdd000[12].grs # these should not be here, will be created later
10 ../../index/zebraidx -l idx.log init || exit 1
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 h2.cfg -l srv.log tcp:@:9901 &
20 test -f zebrasrv.pid || exit 1
23 ../../index/zebraidx -l idx.log -c h2.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
32 echo " indexing it..."
33 ../../index/zebraidx -l idx.log -c h2.cfg update records || exit 1
36 ../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
37 grep "^Result count: 10$" log || exit 1
39 echo " 1a: modifying a test record (xyz)..."
40 cat records/esdd0002.grs |
42 sed 's/ESDD0006/ESDD0002/g' |
43 sed 's/EARTHQUAKE/TESTRECORD/g' >/tmp/esdd0002x.grs
44 cat /tmp/esdd0002x.grs >records/esdd0002.grs
46 echo " indexing it..."
47 ../../index/zebraidx -l idx.log -c h2.cfg update records/esdd0002.grs || exit 1
48 #grep XYZ records/esdd0002.grs # shows that indeed have XYZ in the data
51 ../testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
53 grep -q "^Result count: 1$" log || echo "ERROR ---> Result count should have been 1"
55 echo "stopping server..."
56 kill -9 `cat zebrasrv.pid`
59 echo " starting a new server..."
60 ../../index/zebrasrv -S -c h2.cfg -l srv2.log tcp:@:9901 &
62 test -f zebrasrv.pid || exit 1
65 ../testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
67 grep -q "^Result count: 1$" log || echo "ERROR ---> Result count should have been 1"
70 echo "stopping server..."
71 test -f zebrasrv.pid || exit 1
72 kill -9 `cat zebrasrv.pid` || exit 1
74 rm -f records/esdd000[12].grs
77 rm -f /tmp/esdd0002x.grs