config file changed
[csql/przemoc.git] / test / cache / Recovery / test006.ksh
blob3e49518c5a95f038493f434b46b1d838869c1b50
1 #!/bin/sh
2 # Table recovery with more than one Composite index
3 # a.start mysqlserver and create table in mysql t1(f1 int , f2 int,f3 int,f4 char(10),primary key(f1,f2) ), create index idx2 on t1 (f2,f4),create index idx3 on t1(f3,f1)
4 # b.edit csqltable.conf file and add entry for t1 table.
5 # c.csqlserver -c
6 # verify that it recovers the table with both the index information and all the records using the csqldump tool.
7 #Run this test only under csql/test or on this directory.
8 #Otherwise, it may fail
9 CSQL_CONF=${PWD}/cache/Recovery/csql.conf
10 input=${PWD}/cache/Recovery/createt1.sql
11 REL_PATH=.
12 if [ -s "$input" -a -s "$CSQL_CONF" ]
13 then
14 REL_PATH=${PWD}/cache/Recovery
16 echo "create table t1(f1 int , f2 int,f3 int,f4 char(10),primary key(f1,f2));">$REL_PATH/t1.sql
17 echo "create index ix2 on t1(f3,f4);">>$REL_PATH/t1.sql
19 rm /tmp/csql.conf
20 cp $CSQL_CONFIG_FILE /tmp/csql.conf
21 export CSQL_CONFIG_FILE=/tmp/csql.conf
22 echo DSN=$DSN >> $CSQL_CONFIG_FILE
23 echo CACHE_TABLE=true >> $CSQL_CONFIG_FILE
24 isql $DSN < $REL_PATH/t1.sql > /dev/null 2>&1
25 if [ $? -ne 0 ]
26 then
27 mv /tmp/csql.conf $CSQL_CONFIG_FILE
28 rm -f $REL_PATH/t1.sql
29 exit 1;
32 # edit /tmp/csql/csqltable.conf
33 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
34 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
35 for (( a=1; a<2; a++ ))
37 echo "1:t$a NULL NULL NULL"
38 done >> /tmp/csql/csqltable.conf
40 $CSQL_INSTALL_ROOT/bin/csqlserver -c > /dev/null 2>&1 &
41 pid=$!
42 sleep 5
44 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
45 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
46 echo "drop table t1;">>$REL_PATH/drt1.sql
48 $CSQL_INSTALL_ROOT/bin/csqldump
49 if [ $? -ne 0 ]
50 then
51 mv /tmp/csql.conf $CSQL_CONFIG_FILE
52 rm -f $REL_PATH/t1.sql
53 isql $DSN < $REL_PATH/drt1.sql > /dev/null 2>&1
54 rm -f $REL_PATH/drt1.sql
55 exit 2;
58 kill $pid > /dev/null 2>&1
59 isql $DSN < $REL_PATH/drt1.sql > /dev/null 2>&1
60 rm -f $REL_PATH/t1.sql
61 rm -f $REL_PATH/drt1.sql
62 ipcrm -M 1199
63 ipcrm -M 2277
64 mv /tmp/csql.conf $CSQL_CONFIG_FILE
65 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
66 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
67 exit 0;