code reorg
[csql.git] / test / durability / recovery / testMMAP017.ksh
blob020bb729d153850078dcab10aff4a45dd25d9a27
1 #!/bin/ksh
2 # Testing Durability in MMAP Architecture
3 # set DURABILITY to true and MMAP=true in csql.conf
4 # Start csqlserver. Then create a table t1 in CSQL Client.
5 # kill the currently running Server.
6 # Again Restart the Server by setting DURABILITY=true and Open CSQL Client.
7 # Create another table t2 .
8 # Kill the server.
9 # Continue The same for 20 times. Each time tables should be durable
10 # All should work Fine
13 CSQL_CONF=${PWD}/durability/recovery/csql.conf
14 REL_PATH=.
15 if [ -s "$CSQL_CONF" ]
16 then
17 REL_PATH=${PWD}/durability/recovery
20 rm -f /tmp/csql.conf
21 rm -f /tmp/csql/db/*
22 mkdir -p /tmp/csql/db
23 cp -f $REL_PATH/csql.conf /tmp
24 echo SYS_DB_KEY=4444 >>/tmp/csql.conf
25 echo USER_DB_KEY=6666 >>/tmp/csql.conf
26 echo "DURABILITY=true" >>/tmp/csql.conf
27 echo "MMAP=true" >>/tmp/csql.conf
28 export CSQL_CONFIG_FILE=/tmp/csql.conf
30 echo "Durablity = TRUE"
31 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
32 pid=$!
33 echo "Server Started"
34 sleep 2
35 i=1
36 while [[ $i -lt 21 ]];do
37 echo "CREATING TABLE t$i"
38 echo "CREATE TABLE t$i(f1 int,f2 char(100));" >${REL_PATH}/cre_t$i.sql
39 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/cre_t$i.sql >/dev/null 2>&1
40 if [ $? -ne 0 ]
41 then
42 rm -f ${REL_PATH}/cre_t$i.sql
43 kill -9 $pid
44 ipcrm -M 4444
45 exit 1;
48 $CSQL_INSTALL_ROOT/bin/csqldump >before.sql
50 kill -9 $pid
51 ipcrm -M 4444
52 echo "Server Killed"
54 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
55 pid=$!
56 echo "Server Started"
57 sleep 2
58 $CSQL_INSTALL_ROOT/bin/csqldump >after.sql
59 diff before.sql after.sql
60 if [ $? -eq 0 ]
61 then
62 echo Durability Works Fine
64 (( i +=1 ))
65 done
67 rm -f before.sql after.sql
68 i=1
69 while [[ $i -lt 21 ]];do
70 echo "DROP TABLE t$i;" >>${REL_PATH}/dropall.sql
71 rm -f cre_t$i.sql
72 (( i +=1 ))
73 done
74 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropall.sql >/dev/null 2>&1
75 rm -f ${REL_PATH}/dropall.sql
76 kill -9 $pid
77 ipcrm -M 4444
78 exit 0;