Re: Re: [sqlite] Database Corruption and fix suggsted

2006-11-14 Thread jayanth KP
Hi Richard,

It is a linux platform compiled with glibc library. And os.c is not changed.

Regards
Jayanth





  


On Tue, 14 Nov 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> >
> > 2.) I compiled sqlite 2.8.13 for a proprietary platform that we are using 
> > for development(little endian) and ran sqlite binary on the directory that 
> > had the journal also.
> >
> > RESULT:
> > ---
> > The file is getting corrupted.
> >
> >
> > Please can you suggest to me what could be the issue. Or suggest to me 
> > where to look for this issue.
> >
>
>Prohaps the customized os.c that you are using on your proprietary
>platform has some subtle bug.
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] Database Corruption and fix suggsted

2006-11-14 Thread jayanth KP
Hi Richard,

Thanks.. As you said. Now I tried to open the database that is not 
corrupted with sqlite 2.8.13 (that we have). I have an intresting observation.

1.) I compiled sqlite 2.8.13 for PC (little endian) and ran sqlite binary on 
the directory that had the journal also.

RESULT: 
---
It did a rollback successfully - So this means sqlite 2.8.13 is fine.


2.) I compiled sqlite 2.8.13 for a proprietary platform that we are using for 
development(little endian) and ran sqlite binary on the directory that had the 
journal also.

RESULT: 
---
The file is getting corrupted.


Please can you suggest to me what could be the issue. Or suggest to me where to 
look for this issue.

Thanks and Regards
Jayanth







  


On Mon, 13 Nov 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi Richard,
> > I downloaded the sqlite-2.8.17.bin from sqlite.org 
> > (sqlite-2.8.17.bin.gz) and ran it on media.vdb.corrupt. I am getting the 
> > following error . I am confused how were you able to open this file. Plz 
> > open media..vdb.corrupt.
> >
>
>Once a file gets corrupted, there is nothing that can magically
>undo the corruption.
>
>What I did to open the file was put both the database as it
>appeared on disk after the power failure, but before it was
>opened by your broken version of sqlite, and the rollback
>journal together in the same directory.  Then I opened the
>database with a working version of SQLite and it recovered
>the database correctly.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




[sqlite] Database Corruption and fix suggsted

2006-11-12 Thread jayanth KP
Hi,

I am using sqlite 2.8.13 which is supposed to have fix for "Corrupt problem 
encountered on Windows NT platform" check this 
(http://www.sqlite.org/cvstrac/tktview?tn=599). But the code in pager.c still 
has the following rc = write32bits(>jfd, pPager->noSync ? 0x : 
0); . But as suggested in the fix it should have been rc = 
write32bits(>jfd, 0x); . 

I also saw 2.8.13 and 2.8.12 code in sqlite CVS. Even that does not have the 
suggested change

Can anybody Please  explain ..


Regards
Jayanth



Ticket 599:   




[sqlite] Database Corruption and fix suggsted

2006-11-12 Thread jayanth KP
Hi,

I am using sqlite 2.8.13 which is supposed to have fix for "Corrupt problem 
encountered on Windows NT platform" check this 
(http://www.sqlite.org/cvstrac/tktview?tn=599). But the code in pager.c still 
has the following rc = write32bits(>jfd, pPager->noSync ? 0x : 
0); . But as suggested in the fix it should have been rc = 
write32bits(>jfd, 0x); . 

I also saw 2.8.13 and 2.8.12 code in sqlite CVS. Even that does not have the 
suggested change

Can anybody Please  explain ..


Regards
Jayanth



Ticket 599:   




[sqlite] Journal file corrouption on power failure .

2006-11-10 Thread jayanth KP
Hi,

   I have a question regarding powerfailure. I am using sqlite version 2.8.13 . 
I am seeing that the database is getting corrupted after power failure during 
delete database entry operation.

  Here are my observation that may give you gugs some insight:

1. I see a journal file in the database directory.
2. The database file before the sqlite_open() seems to be fine. But after  
sqlite_open() database file  gets corrupted.


Here are some prints that i put in the code.


fileBtreeBeginTrans:  Entry 

fileBtreeBeginTrans: PAGE#1 = 0

lockBtree: pP1->zMagic = <** This file contains an SQLite 2.1 database **>: 
zMagicHeader =<** This file contains an SQLite 2.1 database **>

fileBtreeBeginTrans: sqlitepager_begin IS OKKK


-- NOW I HAVE REBOOTED (POWER OFF)--


After reboot I am getting these prints below



sqlitepager_open:946 zFilename=/tmp/sqlite_fOql67XeTaDTEuU
lockBtree: pP1->zMagic = <>: zMagicHeader =<** This file contains an SQLite 2.1 
database **>
lockBtree : Not a valid DB file

In fuction="openDatabase" , Line #562  ErrMsg=file is encrypted or is not a 
database
Media DB: ALARAM: Databse open failed ERRCODE=26 : ERRMSG=file is encrypted or 
is not a database


Regards
Jayanth





Re: Re: [sqlite] database corrouption during power failure

2006-10-25 Thread jayanth KP
Thanks Dennis Cote. Now even though synchrounous is set to FULL. But Database 
Corrouption is happening.  Here are my observations in our sqlite 2.8.13.

1. This corrouption is not detected by the sqlite_open().

2. After the crash/power failure. I see a journal file in the same directory as 
the database file. This means the database can be rolled back. I analyed the 
journal header and checksum, it looks fine.

3. Now before the rollback if i copy the database file to a different directory 
and open using sqlite. None of the tables are seen.

4. Now if i do a sqlite_open(), the rollback of the orginal data does not 
happen. But the journal file is removed.

I am suprised how can journal be be present and still database corruption 
happen.. 

Please help me resolving this issue.

Bye
Jayanth


On Mon, 23 Oct 2006 Dennis Cote wrote :
>jayanth KP wrote:
>>But how do we read the current  synchronous value using C interface. Plz 
>> reply.
>>
>> 
>Jayanth,
>
>Try this:
>
>sqlite3_stmt* s;
>sqlite3_prepare(db, "PRAGMA SYNCHRONOUS", -1, , NULL);
>sqlite3_step(s);
>int sync = sqlite3_column_int(s, 1);
>sqlite3_finalize(s);
>
>switch (sync) {
>case 0: // off
>case 1: // normal
>case 2: // full
>}
>
>
>It simply executes the PRAGMA and collects the result.
>
>HTH
>Dennis Cote
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-23 Thread jayanth KP
Hi Dennis Cote,

   But how do we read the current  synchronous value using C interface. Plz 
reply.

Regards
Jayanth


On Mon, 16 Oct 2006 Dennis Cote wrote :
>jayanth KP wrote:
>>Thanks for ur reply. I searched in the whole source code i could not find 
>> SQLITE_NO_SYNC flag. 
>>Also i tried the following in my c code, after sqlite_open() was success.
>>sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, );
>>
>>Even this did not seem to work. How do i check if this PRAGMA is working fine 
>>from my code.
>>
>>
>> 
>
>The pragma commands are documented at http://www.sqlite.org/pragma.html. To 
>check the current value simply execute a "pragma synchronous" command. The 
>current setting will be returned. In your case it should be 2 for FULL 
>synchronous operation.
>
>The SQLITE_NO_SYNC flag is a define that can be passed to the compiler while 
>buiding your code. Look in your makefile or your compiler's options setting 
>dialog for -DSQLITE_NO_SYNC.
>
>HTH
>Dennis Cote
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-13 Thread jayanth KP
Hi Richard,

We are ALREADY using sqlite 2.8.13.

OBSERVATIONS:
-

1) If i call sync() system call after database update, the database is not 
getting corrupted.

2) In one scenario of corruption sqlite_open() returned an error message "file 
is encrypted or is not a database".

3) In another scenario sqlite_open() did not detect the corruption. But any 
subsequent calls is not successful. For example if we start sqlite application 
and run .tables , nothing is returned.


Thanks and regards
Jayanth
  


On Fri, 13 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> >Please can anybody respond to this question. I am able to hits is issue 
> > pretty often now...
>
>In my previous response, reproduced below, I showed you the
>cause of the problem and how to fix it.  What further response
>do you want?
>
> >
> > > >
> > > > Please help me in solving this issue
> > > >
> > >
> > >See http://www.sqlite.org/cvstrac/tktview?tn=599
> > >
> > >This problem was fixed in SQLite version 2.8.12, over two
> > >and a half years ago.
> > >
> > >--
> > >D. Richard Hipp  <[EMAIL PROTECTED]>
> > >
> > >
> > >-
> > >To unsubscribe, send email to [EMAIL PROTECTED]
> > >-
> > >
>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




[sqlite] [sqlite]: How does a transaction work

2006-10-13 Thread jayanth KP
Hi,
I wanted to know how does a transaction work..

In the following example shown below, where is the transaction updated. Is it 
in the memory or some temp file or is it directly written to the database file. 
Please give more internal details on this.

sqlite_exec_printf(pDBHandle,"begin transaction;", 0, 0, NULL);

sqlite_exec_printf(pDBHandle, "update table1 set c1 = 1",0,0,0,NULL);
sqlite_exec_printf(pDBHandle, "update table2 set c1 = 1",0,0,0,NULL);
sqlite_exec_printf(pDBHandle, "update table3 set c1 = 1",0,0,0,NULL);
sqlite_exec_printf(pDBHandle, "update table4 set c1 = 1",0,0,0,NULL);

sqlite_exec_printf(pDBHandle,"COMMIT;", 0, 0, NULL);



Regards
Jayanth




Re: Re: [sqlite] database corrouption during power failure

2006-10-13 Thread jayanth KP
Hi,

   Please can anybody respond to this question. I am able to hits is issue 
pretty often now...



Regards,
Jayanth  


On Fri, 06 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >I have a question regarding power failure handling in sqlite 2.8.3.
> >
> > When the power is switched off during  a database write like 
> > (insert/update), in next reboot database is getting corroupted.
> >
> > The database is in a ext3 partition on the harddisk (linux 2.6).
> >
> >
> > Also i tried the following in my c code after sqlite_open() was success.
> >
> > sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, );
> >
> > This did not seem to work.
> >
> > Please help me in solving this issue
> >
>
>See http://www.sqlite.org/cvstrac/tktview?tn=599
>
>This problem was fixed in SQLite version 2.8.12, over two
>and a half years ago.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




Re: Re: [sqlite] database corrouption during power failure

2006-10-06 Thread jayanth KP
Hi Richard,

   Sorry, i gave a wrong version number of sqlite . We are using sqlite 2.8.13.

OBSERVATIONS:
-

1) If i call sync() system call after database update, the database is not 
getting corrupted.

2) In one scenario of corruption sqlite_open() returned an error message "file 
is encrypted or is not a database".

3) In another scenario sqlite_open() did not detect the corruption. But any 
subsequent calls is not successful. For example if we start sqlite application 
and run .tables , nothing is returned.


Thanks and regards
Jayanth






  


On Fri, 06 Oct 2006 [EMAIL PROTECTED] wrote :
>"jayanth KP" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >I have a question regarding power failure handling in sqlite 2.8.3.
> >
> > When the power is switched off during  a database write like 
> > (insert/update), in next reboot database is getting corroupted.
> >
> > The database is in a ext3 partition on the harddisk (linux 2.6).
> >
> >
> > Also i tried the following in my c code after sqlite_open() was success.
> >
> > sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, );
> >
> > This did not seem to work.
> >
> > Please help me in solving this issue
> >
>
>See http://www.sqlite.org/cvstrac/tktview?tn=599
>
>This problem was fixed in SQLite version 2.8.12, over two
>and a half years ago.
>
>--
>D. Richard Hipp  <[EMAIL PROTECTED]>
>
>
>-
>To unsubscribe, send email to [EMAIL PROTECTED]
>-
>




[sqlite] database corrouption during power failure

2006-10-06 Thread jayanth KP
  
Hi,
   I have a question regarding power failure handling in sqlite 2.8.3. 

When the power is switched off during  a database write like (insert/update), 
in next reboot database is getting corroupted. 

The database is in a ext3 partition on the harddisk (linux 2.6).


Also i tried the following in my c code after sqlite_open() was success.

sqlite_exec(pDbHandle,"PRAGMA synchronous=FULL;", NULL, NULL, );

This did not seem to work. 

Please help me in solving this issue


Regards
Jayanth





[sqlite] test mail - plz ignore

2006-10-06 Thread jayanth KP