/ Check-in [533d6cc6]
Login

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

Overview
Comment:More simplifications to pager.c. (CVS 6939)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:533d6cc67a3b6467db5b83c5ca535d229d36ad27
User & Date: drh 2009-07-25 17:08:36
Context
2009-07-25
17:33
Change a condition to a '%' operator in bitvec.c. (CVS 6940) check-in: 10250fe5 user: drh tags: trunk
17:08
More simplifications to pager.c. (CVS 6939) check-in: 533d6cc6 user: drh tags: trunk
15:24
Simplifications and comment improvements to pager.c in support of coverage testing. (CVS 6938) check-in: 5b70b5c1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.623 2009/07/25 15:24:14 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.624 2009/07/25 17:08:36 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   
    26     26   /*
    27     27   ** Macros for troubleshooting.  Normally turned off
    28     28   */
................................................................................
  1175   1175   static int pager_error(Pager *pPager, int rc){
  1176   1176     int rc2 = rc & 0xff;
  1177   1177     assert(
  1178   1178          pPager->errCode==SQLITE_FULL ||
  1179   1179          pPager->errCode==SQLITE_OK ||
  1180   1180          (pPager->errCode & 0xff)==SQLITE_IOERR
  1181   1181     );
  1182         -  if(
  1183         -    rc2==SQLITE_FULL ||
  1184         -    rc2==SQLITE_IOERR ||
  1185         -    rc2==SQLITE_CORRUPT
  1186         -  ){
         1182  +  if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){
  1187   1183       pPager->errCode = rc;
  1188         -    if( pPager->state==PAGER_UNLOCK 
  1189         -     && sqlite3PcacheRefCount(pPager->pPCache)==0 
  1190         -    ){
  1191         -      /* If the pager is already unlocked, call pager_unlock() now to
  1192         -      ** clear the error state and ensure that the pager-cache is 
  1193         -      ** completely empty.
  1194         -      */
  1195         -      pager_unlock(pPager);
  1196         -    }
  1197   1184     }
  1198   1185     return rc;
  1199   1186   }
  1200   1187   
  1201   1188   /*
  1202   1189   ** Execute a rollback if a transaction is active and unlock the 
  1203   1190   ** database file. 
................................................................................
  3061   3048     ** flag is set, return without doing anything. The pcache layer will
  3062   3049     ** just have to go ahead and allocate a new page buffer instead of
  3063   3050     ** reusing pPg.
  3064   3051     **
  3065   3052     ** Similarly, if the pager has already entered the error state, do not
  3066   3053     ** try to write the contents of pPg to disk.
  3067   3054     */
  3068         -  if( pPager->errCode || (pPager->doNotSync && pPg->flags&PGHDR_NEED_SYNC) ){
         3055  +  if( NEVER(pPager->errCode)
         3056  +   || (pPager->doNotSync && pPg->flags&PGHDR_NEED_SYNC)
         3057  +  ){
  3069   3058       return SQLITE_OK;
  3070   3059     }
  3071   3060   
  3072   3061     /* Sync the journal file if required. */
  3073   3062     if( pPg->flags&PGHDR_NEED_SYNC ){
  3074   3063       rc = syncJournal(pPager);
  3075   3064       if( rc==SQLITE_OK && pPager->fullSync &&