version 1.0
[csql.git] / test / cache / Bidirectional / test012.ksh
blobc726371875b5d4628fb431b292906b81af4bb627
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 operation in one cache node database
8 input=${PWD}/cache/Bidirectional/mysqlcreatelogtable.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Bidirectional
16 rm -f /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
22 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1
23 if [ $? -ne 0 ]
24 then
25 echo "DSN is not set for target db"
26 exit 1
29 echo table csql_log_int is created with records in target db
31 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
32 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
34 isql $DSN < $REL_PATH/trigger.sql >/dev/null
35 isql $DSN < $REL_PATH/trigger1.sql >/dev/null
38 for (( a=1; a<3; a++ ))
40 echo "1:t$a NULL NULL NULL"
41 done >> /tmp/csql/csqltable.conf
43 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
44 pid=$!
45 sleep 5
46 echo "server 1 started"
48 echo "cache node 2"
49 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
50 if [ $? -ne 0 ]
51 then
52 echo "unable to locate cache 1"
53 exit 3
55 mkdir /tmp/csql1 >/dev/null 2>&1
56 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
57 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
59 rm -f /tmp/csql1.conf
60 cp $REL_PATH/conf/csql.conf /tmp/csql1.conf
61 export CSQL_CONFIG_FILE=/tmp/csql1.conf
62 echo DSN=$DSN >>$CSQL_CONFIG_FILE
64 for (( a=1; a<3; a++ ))
66 echo "1:t$a NULL NULL NULL"
67 done >> /tmp/csql1/csqltable.conf
69 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
70 pid1=$!
71 sleep 5
72 echo "server 2 started"
74 echo "cache node 1"
75 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
76 if [ $? -ne 0 ]
77 then
78 kill -2 $pid
79 ipcrm -M 4000 -M 4500
80 echo "unable to locate cache 1"
81 exit 4
83 echo "Delete operation in cache node 1"
84 $CSQL_INSTALL_ROOT/bin/csql -g < ${REL_PATH}/delete.sql > /dev/null 2>&1
85 sleep 15
86 echo "cache node 1"
87 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
89 export CSQL_CONFIG_FILE=/tmp/csql.conf
90 echo "cache node 2"
91 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
93 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
94 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
95 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
96 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
97 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
98 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
99 isql $DSN < $REL_PATH/mysqldeletelogtable.sql >/dev/null 2>&1
100 kill -2 $pid
101 ipcrm -M 4000 -M 4500
102 kill -2 $pid1
103 ipcrm -M 5000 -M 5500
104 exit 0;