Thanks again to everyone for the guidance. I read through that list of corruption candidates and most don't seem to apply. Only one app accesses the db file, it's on a local NTFS partition, there were no power failures or hard reboots, no pragmas or non-default access options were used. So I guess that leaves hardware issues. This software is still in the testing state and has been run on about 10 different machines for about 4 weeks total. I guess it would be my luck to hit something exceedingly rare with such a small sample size. In any case, I'll take this opportunity to add a bunch of additional code to check for issues and try to fix them, or at the very least keep itself from infinite looping if things go too wrong.

Jeff

On 2/13/2017 1:26 PM, Simon Slavin wrote:
On 13 Feb 2017, at 7:12pm, Jeff B. <su...@cox.net> wrote:

The vacuum followed by a reindex seems to have fixed the db (see below).  But 
are there any other theories as to how we got to this point?  Could I have 
possibly caused this or do I just need to build in code to detect problems like 
this and rebuild on the fly?  I'm new to SQLite so I don't have a good feel for 
what is overkill vs what is best practices.
The database was definitely corrupt.  It’s quite difficult to do that.  It 
might happen through using some of the PRAGMAs which tell SQLite not to bother 
doing locking/synching correctly.  It might happen through a power-cut at just 
the wrong moment.  It might happen because your hard disk is faulty and that 
was the first known sign of it failing.  It might happen through broken 
software overwriting part of the database. And, for any of those it might 
happen just once in the lifetime of your program.

But the stark fact is that many users never see this happen ever.

Proper defensive action, as you suggested, is to build the integrity_check 
thing into some monthly/yearly maintenance routine.  Or to do it weekly for a 
while, then monthly, then yearly, until you have confidence in your hardware.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to