SQLite

Check-in [495f017e03]
Login

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

Overview
Comment:Remove an faulty assertion inserted a few days ago. (CVS 6160)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 495f017e03f32420e6a6a7685125a86929cef142
User & Date: drh 2009-01-10 17:02:03.000
Context
2009-01-10
17:57
Remove the unused Pager.alwaysRollback flag. Fix a couple of comments in pager.c. (CVS 6161) (check-in: 8f0672af8d user: danielk1977 tags: trunk)
17:02
Remove an faulty assertion inserted a few days ago. (CVS 6160) (check-in: 495f017e03 user: drh tags: trunk)
16:15
When compiled with SQLITE_DEBUG (in other words, when assert() is enabled) the ALWAYS and NEVER macros will throw an assertion if their arguments are not true or false, respectively. (CVS 6159) (check-in: 64a8dcd8d6 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.545 2009/01/10 16:15:09 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/







|







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.546 2009/01/10 17:02:03 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
    }

    /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages 
    ** starting at pg1, then it needs to be set for all of them. Because
    ** writing to any of these nPage pages may damage the others, the
    ** journal file must contain sync()ed copies of all of them
    ** before any of them can be written out to the database file.
    **
    ** 2009-01-07:  This block of code appears to be a no-op.  I do not
    ** believe it is possible for any page on the sector to not have
    ** the PGHDR_NEED_SYNC flag set.  The "pPage->flags |= PGHDR_NEED_SYNC"
    ** line below does nothing, I think.  But it does no harm to leave
    ** this code in place until we can definitively prove this is the case.
    */
    if( needSync ){
      assert( !MEMDB && pPager->noSync==0 );
      for(ii=0; ii<nPage && needSync; ii++){
        PgHdr *pPage = pager_lookup(pPager, pg1+ii);
        if( pPage ){
          assert( pPage->flags & PGHDR_NEED_SYNC ); /* 2009-01-07 conjecture */
          pPage->flags |= PGHDR_NEED_SYNC;
          sqlite3PagerUnref(pPage);
        }
      }
      assert(pPager->needSync);
    }








<
<
<
<
<
<






<







3633
3634
3635
3636
3637
3638
3639






3640
3641
3642
3643
3644
3645

3646
3647
3648
3649
3650
3651
3652
    }

    /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages 
    ** starting at pg1, then it needs to be set for all of them. Because
    ** writing to any of these nPage pages may damage the others, the
    ** journal file must contain sync()ed copies of all of them
    ** before any of them can be written out to the database file.






    */
    if( needSync ){
      assert( !MEMDB && pPager->noSync==0 );
      for(ii=0; ii<nPage && needSync; ii++){
        PgHdr *pPage = pager_lookup(pPager, pg1+ii);
        if( pPage ){

          pPage->flags |= PGHDR_NEED_SYNC;
          sqlite3PagerUnref(pPage);
        }
      }
      assert(pPager->needSync);
    }