adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / FailOver / test004b.ksh
blob704fc849f2cf242781ac10cd9a9d2fa4b05cd785
1 #!/bin/sh
3 # 4b. After connect, csql goes down, then all insert operations should go to MySQL directly for cached tables and MySQL tables.
5 #Run this test only under csql/test or on this directory.
6 #Otherwise, it may fail
8 CSQL_CONF=${PWD}/cache/FailOver/csql.conf
9 input=${PWD}/cache/FailOver/csqlinputt3.sql
10 REL_PATH=.
11 if [ -s "$input" -a -s "$CSQL_CONF" ]
12 then
13 REL_PATH=${PWD}/cache/FailOver
15 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
16 echo DSN=$DSN >> $CSQL_CONFIG_FILE
17 isql $DSN < $REL_PATH/mysqlinputtest1.sql >/dev/null 2>&1
18 echo "table t1(to be cached) inserted into target db"
19 # edit /tmp/csql/csqltable.conf
20 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
21 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
22 for (( a=1; a<2; a++ ))
24 echo "1:t$a NULL NULL NULL"
25 done >> /tmp/csql/csqltable.conf
27 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
28 pid=$!
29 sleep 5
30 echo "table t1 cached into csql"
32 isql $DSN < $REL_PATH/mysqlinputtest2.sql >/dev/null 2>&1
33 echo "table t2(not cached) inserted into target db"
34 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputt3.sql >/dev/null 2>&1
35 echo "table t3 inserted into csql db"
37 ${REL_PATH}/insertconncsqldown &
38 bgproc=$!
39 kill -9 $pid
40 ipcrm -M 1199 -M 2277
41 echo -e "csql server is down"
42 wait $bgproc
43 isql $DSN < $REL_PATH/dropall.sql >/dev/null 2>&1
44 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
45 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
46 exit 0;