SQLite

Check-in [7626f6c9ea]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Silently abandon a rollback if the journal has been truncated.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7626f6c9ea04d1a5690dd11bb13e8c3c04e3b0f5
User & Date: drh 2010-04-03 13:08:10.000
Context
2010-04-05
15:11
Minor comment changes to the OP_OpenEphemeral header. No changes to code. (check-in: 8e1d7ef47f user: drh tags: trunk)
2010-04-03
13:08
Silently abandon a rollback if the journal has been truncated. (check-in: 7626f6c9ea user: drh tags: trunk)
2010-04-02
13:25
Check for a failure in the call to sqlite3PagerPagecount() from within sqlite3PagerWrite(). (Error discovered by valgrind.) (check-in: d64d181c79 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
1974
1975
1976
1977
1978
1979
1980








1981
1982
1983
1984
1985
1986
1987
      }
      rc = pager_playback_one_page(pPager,1,isUnsync,&pPager->journalOff,0,0);
      if( rc!=SQLITE_OK ){
        if( rc==SQLITE_DONE ){
          rc = SQLITE_OK;
          pPager->journalOff = szJ;
          break;








        }else{
          /* If we are unable to rollback, quit and return the error
          ** code.  This will cause the pager to enter the error state
          ** so that no further harm will be done.  Perhaps the next
          ** process to come along will be able to rollback the database.
          */
          goto end_playback;







>
>
>
>
>
>
>
>







1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
      }
      rc = pager_playback_one_page(pPager,1,isUnsync,&pPager->journalOff,0,0);
      if( rc!=SQLITE_OK ){
        if( rc==SQLITE_DONE ){
          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
          ** so that no further harm will be done.  Perhaps the next
          ** process to come along will be able to rollback the database.
          */
          goto end_playback;