I'm not sure if you received my last email, so I'm sending it to the list in the hope that someone can help me.
You say that I shouldn't get a corrupt database when I pull the power, but I am consistently getting this. I am using SQLite version 2.8.9 using the C++ interface running on Windows XP Home. Is there anything I can do to stop this happening?
Thanks,
Liz.
----Original Message Follows---- From: "D. Richard Hipp" <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: [sqlite] Effectiveness of PRAGMA integrity_check; Date: Wed, 14 Apr 2004 10:50:28 -0400
Liz Steel wrote:
I am trying to do a similar sort of thing with my database. The only way I've found to fairly reliably create a corrupt database file is to pull the battery out of my laptop whilst my application is accessing the database....
I've just tried it, and I get a code 11 (SQLITE_CORRUPT) returned from the PRAGMA integrity_check command. Is this correct behaviour?
No, this is not correct. SQLite is suppose to survive an abrupt power loss with no loss of data. (Uncommitted transactions will be rolled back, but committed transactions should persist and be consistent.)
I believe that SQLite does survive power loss without problems on Linux. However, I have received reports that the windows API function FlushFileBuffers() sometimes lies and does not really flush contents to the disk surface as it claims it does. This is just hearsay - I have not independently verified those reports. If FlushFileBuffers() does lie and a power loss occurred in the middle of a COMMIT, then database corruption is possible on windows. This is a bug in the OS and there is not anything SQLite (or any other database engine) can do about it.
There was a bug in SQLite version 2.8.12 that could cause database corruption if a power loss occurred at a particularly inauspicious moment in the middle of a COMMIT. That problem was fixed with version 2.8.13.
If you are seeing database corruption following power loss on Linux with SQLite version 2.8.13, please let us know about it right away. If you are seeing corruption on Windows, let us know there too - the problem might be the FlushFileBuffers() bug or it might be something else - either way we want to investigate.
-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger http://www.msn.co.uk/messenger
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]