adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / Bidirectional / test010.ksh
bloba990e773557280572893bcf3b26553a9b9908e5c
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 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 #cp $CSQL_CONFIG_FILE /tmp/csql.conf
17 #echo DSN=$DSN >>$CSQL_CONFIG_FILE
18 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1 &
19 echo table csql_log_int is created with records in target db
21 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
22 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
23 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
24 isql $DSN < $REL_PATH/trigger.sql >/dev/null
25 isql $DSN < $REL_PATH/trigger1.sql >/dev/null
28 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
29 echo DSN=$DSN >>$CSQL_CONFIG_FILE
31 for (( a=1; a<3; a++ ))
33 echo "1:t$a NULL NULL NULL"
34 done >> /tmp/csql/csqltable.conf
36 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
37 pid=$!
38 sleep 5
39 echo "server 1 started"
41 echo "cache node 2"
42 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
43 if [ $? -ne 0 ]
44 then
45 echo "unable to locate cache 1"
46 # cp /tmp/csql.conf $CSQL_CONFIG_FILE
47 exit 3
49 mkdir /tmp/csql1 >/dev/null 2>&1
50 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
51 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
53 export CSQL_CONFIG_FILE=$REL_PATH/conf/csql.conf
54 echo DSN=$DSN >>$CSQL_CONFIG_FILE
56 for (( a=1; a<3; a++ ))
58 echo "1:t$a NULL NULL NULL"
59 done >> /tmp/csql1/csqltable.conf
61 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
62 pid1=$!
63 sleep 5
64 echo "server 2 started"
66 echo "cache node 1"
67 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
68 if [ $? -ne 0 ]
69 then
70 kill -2 $pid
71 ipcrm -M 4000 -M 4500
72 echo "unable to locate cache 1"
73 # cp /tmp/csql.conf $CSQL_CONFIG_FILE
74 exit 4
76 echo "Update operation in cache node 1"
77 $CSQL_INSTALL_ROOT/bin/csql -g < ${REL_PATH}/update.sql > /dev/null 2>&1
78 sleep 15
79 echo "cache node 1"
80 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
82 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
83 echo DSN=$DSN >>$CSQL_CONFIG_FILE
84 echo "cache node 2"
85 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
87 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
88 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
89 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
90 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
91 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
92 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
93 isql $DSN < $REL_PATH/mysqldeletelogtable.sql >/dev/null 2>&1
94 kill -2 $pid
95 ipcrm -M 4000 -M 4500
96 kill -2 $pid1
97 ipcrm -M 5000 -M 5500
98 # cp /tmp/csql.conf $CSQL_CONFIG_FILE
99 exit 0;