SQLite

Check-in [886e665f6c]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 886e665f6cf780464b280c286b03c9fb5c1a6b2a
User & Date: drh 2009-07-25 22:13:35.000
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: 3616766a6f 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: 886e665f6c user: drh tags: trunk)
19:31
Remove obsolete assert and testcase macros related to ticket #2565 (CVS 6943) (check-in: f0024b3189 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/pager.c.
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
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.626 2009/07/25 19:31:32 drh Exp $
** @(#) $Id: pager.c,v 1.627 2009/07/25 22:13:35 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
3563
3564
3565
3566
3567
3568
3569
3570




3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3563
3564
3565
3566
3567
3568
3569

3570
3571
3572
3573
3574
3575
3576
3577
3578


3579
3580
3581
3582
3583
3584
3585







-
+
+
+
+





-
-







  }

  if( pPager->state==PAGER_UNLOCK || isErrorReset ){
    sqlite3_vfs * const pVfs = pPager->pVfs;
    int isHotJournal = 0;
    assert( !MEMDB );
    assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
    if( !pPager->noReadlock ){
    if( pPager->noReadlock ){
      assert( pPager->readOnly );
      pPager->state = PAGER_SHARED;
    }else{
      rc = pager_wait_on_lock(pPager, SHARED_LOCK);
      if( rc!=SQLITE_OK ){
        assert( pPager->state==PAGER_UNLOCK );
        return pager_error(pPager, rc);
      }
    }else if( pPager->state==PAGER_UNLOCK ){
      pPager->state = PAGER_SHARED;
    }
    assert( pPager->state>=SHARED_LOCK );

    /* If a journal file exists, and there is no RESERVED lock on the
    ** database file, then it either needs to be played back or deleted.
    */
    if( !isErrorReset ){