version 1.0
[csql.git] / test / cache / Bidirectional / test009.ksh
blob665cd237c03e03bc1dbdb0cd5b5737e644f55797
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 # Update 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 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
21 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1
22 if [ $? -ne 0 ]
23 then
24 echo "DSN is not set for target db"
25 exit 1
28 echo table csql_log_int is created with records in target db
29 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
30 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
31 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
32 isql $DSN < $REL_PATH/trigger.sql >/dev/null
33 isql $DSN < $REL_PATH/trigger1.sql >/dev/null
37 for (( a=1; a<3; a++ ))
39 echo "1:t$a NULL NULL NULL"
40 done >> /tmp/csql/csqltable.conf
42 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
43 pid=$!
44 sleep 5
45 echo "server 1 started"
47 echo "cache node 2"
48 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
49 if [ $? -ne 0 ]
50 then
51 echo "unable to locate cache 1"
52 exit 3
54 mkdir /tmp/csql1 >/dev/null 2>&1
55 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
56 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
58 rm -f /tmp/csql1.conf
59 cp $REL_PATH/conf/csql.conf /tmp/csql1.conf
60 export CSQL_CONFIG_FILE=/tmp/csql1.conf
61 echo DSN=$DSN >>$CSQL_CONFIG_FILE
63 for (( a=1; a<3; a++ ))
65 echo "1:t$a NULL NULL NULL"
66 done >> /tmp/csql1/csqltable.conf
68 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
69 pid1=$!
70 sleep 5
71 echo "server 2 started"
73 echo "cache node 1"
74 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
75 if [ $? -ne 0 ]
76 then
77 kill -2 $pid
78 ipcrm -M 4000 -M 4500
79 echo "unable to locate cache 1"
80 exit 4
82 echo "update some record in target database"
83 isql $DSN < ${REL_PATH}/update.sql > /dev/null 2>&1
84 sleep 15
85 echo "cache node 1"
86 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
87 export CSQL_CONFIG_FILE=/tmp/csql.conf
88 echo "cache node 2"
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
91 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
92 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
93 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
94 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
95 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
96 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
97 isql $DSN < $REL_PATH/mysqldeletelogtable.sql >/dev/null 2>&1
98 kill -2 $pid
99 ipcrm -M 4000 -M 4500
100 kill -2 $pid1
101 ipcrm -M 5000 -M 5500
102 exit 0;