File Removed
[csql.git] / test / tools / Durability / test001.ksh
blob7dbf204e74ca5dc10845d54ea208593c44b7eea6
1 #!/bin/sh
2 # Run this test only under csql/test or on this directory.
3 # Otherwise, it may fail
4 # set DURABILITY to false in csql.conf (Default)
5 # Start csqlserver. Then create a table using CSQL Client.
6 # kill the currently running Server.
7 # Restart the Server in DURABILITY=false.Open CSQL Client.
8 # SHOW TABLES; Statement should not display any table.
9 #
11 CSQL_CONF=${PWD}/tools/Durability/csql.conf
12 REL_PATH=.
13 if [ -s "$CSQL_CONF" ]
14 then
15 REL_PATH=${PWD}/tools/Durability
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 USER_DB_KEY=6666 >>/tmp/csql.conf
25 export CSQL_CONFIG_FILE=/tmp/csql.conf
27 echo "Durablity = FALSE"
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 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/create.sql
37 if [ $? -ne 0 ]
38 then
39 kill -9 $pid
40 ipcrm -M 4444 -M 6666
41 rm -f ${REL_PATH}/create.sql
42 rm -f ${REL_PATH}/drop.sql
43 exit 1;
46 $CSQL_INSTALL_ROOT/bin/csqldump >before.sql
48 kill -9 $pid
49 ipcrm -M 4444 -M 6666
50 echo "Server Killed"
51 echo ""
52 echo "Durablity = FALSE"
53 echo "Checking Durability"
54 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
55 pid=$!
56 echo "Server Started"
57 sleep 2
59 $CSQL_INSTALL_ROOT/bin/csqldump >after.sql
60 echo ""
61 diff before.sql after.sql
63 rm -f ${REL_PATH}/create.sql
64 rm -f ${REL_PATH}/drop.sql
65 rm -f before.sql after.sql
66 kill -9 $pid
67 ipcrm -M 4444 -M 6666
68 exit 0;