/ Check-in [886e665f]
Login

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

Overview
Comment:The noReadlock property on a pager object implies the readOnly property. Use this fact to simplify the logic in sqlite3PagerSharedLock(). (CVS 6944)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 886e665f6cf780464b280c286b03c9fb5c1a6b2a
User & Date: drh 2009-07-25 22:13:35
Context
2009-07-27
10:05
When extracting values from a record to use in an UPDATEd version of that record, apply OP_RealAffinity if required. Fix for #3992. (CVS 6945) check-in: 3616766a user: danielk1977 tags: trunk
2009-07-25
22:13
The noReadlock property on a pager object implies the readOnly property. Use this fact to simplify the logic in sqlite3PagerSharedLock(). (CVS 6944) check-in: 886e665f user: drh tags: trunk
19:31
Remove obsolete assert and testcase macros related to ticket #2565 (CVS 6943) check-in: f0024b31 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.626 2009/07/25 19:31:32 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.627 2009/07/25 22:13:35 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   */
................................................................................
  3563   3563     }
  3564   3564   
  3565   3565     if( pPager->state==PAGER_UNLOCK || isErrorReset ){
  3566   3566       sqlite3_vfs * const pVfs = pPager->pVfs;
  3567   3567       int isHotJournal = 0;
  3568   3568       assert( !MEMDB );
  3569   3569       assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
  3570         -    if( !pPager->noReadlock ){
         3570  +    if( pPager->noReadlock ){
         3571  +      assert( pPager->readOnly );
         3572  +      pPager->state = PAGER_SHARED;
         3573  +    }else{
  3571   3574         rc = pager_wait_on_lock(pPager, SHARED_LOCK);
  3572   3575         if( rc!=SQLITE_OK ){
  3573   3576           assert( pPager->state==PAGER_UNLOCK );
  3574   3577           return pager_error(pPager, rc);
  3575   3578         }
  3576         -    }else if( pPager->state==PAGER_UNLOCK ){
  3577         -      pPager->state = PAGER_SHARED;
  3578   3579       }
  3579   3580       assert( pPager->state>=SHARED_LOCK );
  3580   3581   
  3581   3582       /* If a journal file exists, and there is no RESERVED lock on the
  3582   3583       ** database file, then it either needs to be played back or deleted.
  3583   3584       */
  3584   3585       if( !isErrorReset ){