----------------------------------------------------------------------
[csql.git] / test / durability / redologs / test002.ksh
blob150754c45356656143dbe90cb038ffe3c631837c
1 #!/bin/ksh
2 #Insert 5 stmt, upd 2 stmt, del 1 stmt, select 2 record
3 # check stmt and redo logs. Recover and check logs
4 CSQL_CONF=${PWD}/durability/redologs/csql.conf
5 REL_PATH=.
6 if [ -s "$CSQL_CONF" ]
7 then
8 REL_PATH=${PWD}/durability/redologs
9 fi
11 rm -f /tmp/csql.conf
12 rm -rf /tmp/csql/db/*
13 mkdir -p /tmp/csql/db
14 cp -f $REL_PATH/csql.conf /tmp
15 echo SYS_DB_KEY=4444 >>/tmp/csql.conf
16 echo ID_SHM_KEY=6666 >>/tmp/csql.conf
17 echo DURABILITY=true >>/tmp/csql.conf
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
20 echo "Server Started"
21 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
22 pid=$!
23 sleep 2
25 echo "CREATE TABLE laks(f1 int, f2 int);" >${REL_PATH}/t1.sql
26 echo "INSERT INTO laks values (10, 10);" >>${REL_PATH}/t1.sql
27 echo "INSERT INTO laks values (20, 20);" >>${REL_PATH}/t1.sql
28 echo "INSERT INTO laks values (30, 30);" >>${REL_PATH}/t1.sql
29 echo "INSERT INTO laks values (40, 40);" >>${REL_PATH}/t1.sql
30 echo "INSERT INTO laks values (50, 50);" >>${REL_PATH}/t1.sql
31 echo "UPDATE laks set f2=60 where f1=30;" >>${REL_PATH}/t1.sql
32 echo "UPDATE laks set f2=70 where f1=30;" >>${REL_PATH}/t1.sql
33 echo "DELETE FROM laks where f1=20;" >>${REL_PATH}/t1.sql
34 echo "SELECT * FROM laks where f1 > 30;" >>${REL_PATH}/t1.sql
36 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s ${REL_PATH}/t1.sql
37 if [ $? -ne 0 ]
38 then
39 kill -9 $pid
40 ipcrm -M 4444 -M 6666
41 rm -f ${REL_PATH}/t1.sql
42 exit 1;
44 $CSQL_INSTALL_ROOT/bin/redo -al
46 kill -9 $pid
47 ipcrm -M 4444 -M 6666
48 echo "Server Killed"
49 echo ""
50 echo "Checking Durability"
51 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
52 pid=$!
53 echo "Server Started"
54 sleep 2
56 $CSQL_INSTALL_ROOT/bin/redo -al
58 rm -f ${REL_PATH}/t1.sql
59 kill -9 $pid
60 ipcrm -M 4444 -M 6666
61 exit 0;