SQLite

Check-in [b6ea0da76a]
Login

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

Overview
Comment:Fix a bug in the rollback validation logic (code that only runs during debugging). The problem was introduced by check-in (835). (CVS 849)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b6ea0da76a27a4a67a3978c53405840518de2379
User & Date: drh 2003-01-25 15:43:22.000
Context
2003-01-25
16:32
Version 2.7.6 (CVS 850) (check-in: bdba796f3b user: drh tags: trunk)
15:43
Fix a bug in the rollback validation logic (code that only runs during debugging). The problem was introduced by check-in (835). (CVS 849) (check-in: b6ea0da76a user: drh tags: trunk)
14:34
Remove an unused variable. (CVS 848) (check-in: 18f4ffaa2e user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.70 2003/01/22 01:26:44 drh Exp $
*/
#include "os.h"         /* Must be first to enable large file support */
#include "sqliteInt.h"
#include "pager.h"
#include <assert.h>
#include <string.h>








|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.71 2003/01/25 15:43:22 drh Exp $
*/
#include "os.h"         /* Must be first to enable large file support */
#include "sqliteInt.h"
#include "pager.h"
#include <assert.h>
#include <string.h>

1709
1710
1711
1712
1713
1714
1715


1716
1717
1718
1719
1720
1721

1722
1723
1724
1725
1726
1727
1728
#if defined(SQLITE_TEST) && !defined(NDEBUG)
  /* Truncate the journal to the size it was at the conclusion of the
  ** last sqliteOsSync() call.  This is really an error check.  If the
  ** rollback still works, it means that the rollback would have also
  ** worked if it had occurred after an OS crash or unexpected power
  ** loss.
  */


  if( pPager->syncJSize<sizeof(aJournalMagic)+sizeof(Pgno) ){
    pPager->syncJSize = sizeof(aJournalMagic)+sizeof(Pgno);
  }
  TRACE2("TRUNCATE JOURNAL %lld\n", pPager->syncJSize);
  rc =  sqliteOsTruncate(&pPager->jfd, pPager->syncJSize);
  if( rc ) return rc;

#endif

  if( pPager->errMask!=0 && pPager->errMask!=PAGER_ERR_FULL ){
    if( pPager->state>=SQLITE_WRITELOCK ){
      pager_playback(pPager);
    }
    return pager_errcode(pPager);







>
>
|
|
|
|
|
|
>







1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
#if defined(SQLITE_TEST) && !defined(NDEBUG)
  /* Truncate the journal to the size it was at the conclusion of the
  ** last sqliteOsSync() call.  This is really an error check.  If the
  ** rollback still works, it means that the rollback would have also
  ** worked if it had occurred after an OS crash or unexpected power
  ** loss.
  */
  if( !pPager->noSync ){
    assert( !pPager->tempFile );
    if( pPager->syncJSize<sizeof(aJournalMagic)+sizeof(Pgno) ){
      pPager->syncJSize = sizeof(aJournalMagic)+sizeof(Pgno);
    }
    TRACE2("TRUNCATE JOURNAL %lld\n", pPager->syncJSize);
    rc =  sqliteOsTruncate(&pPager->jfd, pPager->syncJSize);
    if( rc ) return rc;
  }
#endif

  if( pPager->errMask!=0 && pPager->errMask!=PAGER_ERR_FULL ){
    if( pPager->state>=SQLITE_WRITELOCK ){
      pager_playback(pPager);
    }
    return pager_errcode(pPager);