adding test scripts
[csql.git] / test / durability / recovery / testMMAP013.ksh
bloba7bf2c6d09317d98672eb87162cfa744a0f909b3
1 #!/bin/ksh
2 # Testing Durability in MMAP architecture
3 # set DURABILITY = true and MMAP=true in csql.conf
4 # Start csqlserver.
5 # Then create a table t1 in CSQL Client.
6 # create the same table t1 again.
7 # kill the currently running Server.
8 # Restart the server.
9 # csqldump should dump the database with table and index information
11 CSQL_CONF=${PWD}/durability/recovery/csql.conf
12 REL_PATH=.
13 if [ -s "$CSQL_CONF" ]
14 then
15 REL_PATH=${PWD}/durability/recovery
18 rm -f /tmp/csql.conf
19 rm -rf /tmp/csql/db
20 mkdir -p /tmp/csql/db
21 cp -f $REL_PATH/csql.conf /tmp
22 echo SYS_DB_KEY=4444 >>/tmp/csql.conf
23 echo DURABILITY=true >>/tmp/csql.conf
24 echo MMAP=true >>/tmp/csql.conf
25 export CSQL_CONFIG_FILE=/tmp/csql.conf
27 echo "Durablity = TRUE"
28 echo "Server Started"
29 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
30 pid=$!
31 sleep 2
33 echo "CREATE TABLE laks(f1 int);" >${REL_PATH}/create.sql
34 echo "DROP TABLE laks;" >${REL_PATH}/drop.sql
36 echo "CREATE TABLE laks(f1 int);"
37 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/create.sql >/dev/null 2>&1
38 if [ $? -ne 0 ]
39 then
40 kill -9 $pid
41 ipcrm -M 4444
42 rm -f ${REL_PATH}/create.sql
43 rm -f ${REL_PATH}/drop.sql
44 exit 1;
47 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/create.sql >/dev/null 2>&1
48 if [ $? -ne 0 ]
49 then
50 kill -9 $pid
51 ipcrm -M 4444
52 rm -f ${REL_PATH}/create.sql
53 rm -f ${REL_PATH}/drop.sql
54 exit 2;
57 $CSQL_INSTALL_ROOT/bin/csqldump >before.sql
59 kill -9 $pid
60 ipcrm -M 4444
61 echo "Server Killed"
62 echo ""
63 echo DURABILITY=true >>/tmp/csql.conf
64 echo "Checking Durability"
65 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
66 if [ $? -ne 0 ]
67 then
68 echo "Server could not be Started"
69 rm -rf /tmp/csql/db
70 mkdir -p /tmp/csql/db
71 kill -9 $pid
72 ipcrm -M 4444
73 rm -f ${REL_PATH}/create.sql
74 rm -f ${REL_PATH}/drop.sql
75 exit 3;
77 pid=$!
78 echo "Server Started"
79 sleep 2
81 $CSQL_INSTALL_ROOT/bin/csqldump >after.sql
82 echo ""
83 diff before.sql after.sql >/dev/null 2>&1
84 if [ $? -eq 0 ]
85 then
86 echo Durability Works Fine
89 rm -f ${REL_PATH}/create.sql
90 rm -f ${REL_PATH}/drop.sql
91 rm -f before.sql after.sql
92 kill -9 $pid
93 ipcrm -M 4444
94 exit 0;