separating database engine and cache tests
[csql.git] / test / cache / Bidirectional / test011.ksh
blobc830573cc01ed7f10d8dcb8c7e6dac95a9452d23
1 #!/bin/sh
2 # Test Case
4 # Bi-directional mutiple cache node test
5 # Two Cache Node and t1 and t2 table to be cached
6 # Delete opration in Target database
8 input=${PWD}/cache/Bidirectional/mysqlcreatelogtable.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Bidirectional
16 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1 &
17 echo table csql_log_int is created with records in target db
19 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
20 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
21 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
22 isql $DSN < $REL_PATH/trigger.sql >/dev/null
23 isql $DSN < $REL_PATH/trigger1.sql >/dev/null
26 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
28 for (( a=1; a<3; a++ ))
30 echo "1:t$a NULL"
31 done >> /tmp/csql/csqltable.conf
33 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
34 pid=$!
35 sleep 5
36 echo "server 1 started"
38 echo "cache node 2"
39 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
40 if [ $? -ne 0 ]
41 then
42 echo "unable to locate cache 1"
43 exit 3
45 mkdir /tmp/csql1 >/dev/null 2>&1
46 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
47 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
49 export CSQL_CONFIG_FILE=$REL_PATH/conf/csql.conf
51 for (( a=1; a<3; a++ ))
53 echo "1:t$a NULL"
54 done >> /tmp/csql1/csqltable.conf
56 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
57 pid1=$!
58 sleep 5
59 echo "server 2 started"
61 echo "cache node 1"
62 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
63 if [ $? -ne 0 ]
64 then
65 kill -2 $pid
66 ipcrm -M 4000 -M 4500
67 echo "unable to locate cache 1"
68 exit 4
70 echo "Delete some record in target database"
71 isql $DSN < ${REL_PATH}/delete.sql > /dev/null 2>&1
72 sleep 15
73 echo "cache node 1"
74 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
76 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
77 echo "cache node 2"
78 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
80 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
81 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
82 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
83 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
84 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
85 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
86 isql $DSN < $REL_PATH/mysqldeletelogtable.sql >/dev/null 2>&1
87 kill -2 $pid
88 ipcrm -M 4000 -M 4500
89 kill -2 $pid1
90 ipcrm -M 5000 -M 5500
91 exit 0;