On 14 Jan 2016, at 8:44am, sanhua.zh <sanhua.zh at foxmail.com> wrote:

> Recently, my monitoring system showed that the error code SQLITE_FULL and 
> SQLITE_CORRUPT increasing in same trend. And thousands of users, who?s 
> database is corrupt, also traped inlow disk free space and their log show 
> that SQLITE_IOERR, SQLITE_FULL happened simultaneously.

Once you have received SQLITE_CORRUPT once, the database is corrupt and you 
should no longer use it.  Later commands may return SQLITE_OK but that just 
means that they didn't read the corrupt part of the database.  Somewhere else 
in the database file it is still corrupt.

> I confuse that whether disk full will corrupt the database (may be 
> indirectyly).

Not always ("will"), but sometimes (might).  It depends on what SQLite is doing 
when it finds no spare space.

However, if this happens

1) The program returned SQLITE_IOERR or SQLITE_FULL then crashed
2) you deleted some files to make some free space
3) you restart the program
4) the program works without returning any other SQLite error

SQLite has returned the database to an uncorrupted state by rolling back the 
last transaction before the crash.  This cannot happen if the error is instead 
SQLITE_CORRUPT.  That result always means that the database is corrupt in a way 
that SQLite will not automatically fix.

Simon.

Reply via email to