windows fixes for test directory
[csql.git] / test / durability / recovery / testMMAP002.ksh
blobabf4a3d7f702f260713ca77a611e942f4a845119
1 #!/bin/ksh
2 # Testing Durability in MMAP architecture
3 # set DURABILITY=true and MMAP=true in csql.conf
4 # Start csqlserver. Then create a table using CSQL Client.
5 # kill the currently running Server.
6 # Again Restart the Server by setting DURABILITY=true and Open CSQL Client.
7 # SHOW TABLES; Statement should display the table.
9 CSQL_CONF=${PWD}/durability/recovery/csql.conf
10 REL_PATH=.
11 if [ -s "$CSQL_CONF" ]
12 then
13 REL_PATH=${PWD}/durability/recovery
16 rm -f /tmp/csql.conf
17 rm -f /tmp/csql/db/*
18 mkdir -p /tmp/csql/db
19 cp -f $REL_PATH/csql.conf /tmp
20 echo SYS_DB_KEY=4444 >>/tmp/csql.conf
21 echo USER_DB_KEY=6666 >>/tmp/csql.conf
22 echo DURABILITY=true >>/tmp/csql.conf
23 echo MMAP=true >>/tmp/csql.conf
24 export CSQL_CONFIG_FILE=/tmp/csql.conf
26 echo "Durablity = TRUE"
27 echo "Server Started"
28 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
29 pid=$!
30 sleep 2
32 echo "CREATE TABLE laks(f1 int);" >${REL_PATH}/create.sql
33 echo "DROP TABLE laks;" >${REL_PATH}/drop.sql
35 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/create.sql
36 if [ $? -ne 0 ]
37 then
38 kill -9 $pid
39 ipcrm -M 4444
40 rm -f ${REL_PATH}/create.sql
41 rm -f ${REL_PATH}/drop.sql
42 exit 1;
45 $CSQL_INSTALL_ROOT/bin/csqldump >before.sql
47 kill -9 $pid
48 ipcrm -M 4444
49 echo "Server Killed"
50 echo ""
51 echo "Durablity = TRUE"
52 echo "Checking Durability"
53 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
54 pid=$!
55 echo "Server Started"
56 sleep 2
58 $CSQL_INSTALL_ROOT/bin/csqldump >after.sql
59 echo ""
60 diff before.sql after.sql
62 rm -f ${REL_PATH}/create.sql
63 rm -f ${REL_PATH}/drop.sql
64 rm -f before.sql after.sql
65 kill -9 $pid
66 ipcrm -M 4444
67 exit 0;