1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Silently abandon a rollback if the journal has been truncated.

FossilOrigin-Name: 7626f6c9ea04d1a5690dd11bb13e8c3c04e3b0f5
This commit is contained in:
drh
2010-04-03 13:08:09 +00:00
parent 34e2b837d5
commit 8d83c0fdd5
3 changed files with 18 additions and 10 deletions

View File

@@ -1978,6 +1978,14 @@ static int pager_playback(Pager *pPager, int isHot){
rc = SQLITE_OK;
pPager->journalOff = szJ;
break;
}else if( rc==SQLITE_IOERR_SHORT_READ ){
/* If the journal has been truncated, simply stop reading and
** processing the journal. This might happen if the journal was
** not completely written and synced prior to a crash. In that
** case, the database should have never been written in the
** first place so it is OK to simply abandon the rollback. */
rc = SQLITE_OK;
goto end_playback;
}else{
/* If we are unable to rollback, quit and return the error
** code. This will cause the pager to enter the error state