aboutsummaryrefslogtreecommitdiff
path: root/src/pager.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-04-03 13:08:09 +0000
committerdrh <drh@noemail.net>2010-04-03 13:08:09 +0000
commit8d83c0fdd55575b58ca39da25882ff77e11391fb (patch)
treeec3b3b289717433bcc01752ecca8d86120c31052 /src/pager.c
parent34e2b837d55ed298c88fedf3d390842749ab02f9 (diff)
downloadsqlite-8d83c0fdd55575b58ca39da25882ff77e11391fb.tar.gz
sqlite-8d83c0fdd55575b58ca39da25882ff77e11391fb.zip
Silently abandon a rollback if the journal has been truncated.
FossilOrigin-Name: 7626f6c9ea04d1a5690dd11bb13e8c3c04e3b0f5
Diffstat (limited to 'src/pager.c')
-rw-r--r--src/pager.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pager.c b/src/pager.c
index 7182f34e6..03fd077da 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -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