/ Check-in [4a0b29dc]
Login

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

Overview
Comment:Fix a pager bug introduced by the wal code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal
Files: files | file ages | folders
SHA1: 4a0b29dc5e573a5d696ede17db5d7acf8d23aa98
User & Date: dan 2010-04-13 11:18:40
Context
2010-04-13
11:35
Fix test script issues preventing walthread.test from running. check-in: d90b1dde user: dan tags: wal
11:18
Fix a pager bug introduced by the wal code. check-in: 4a0b29dc user: dan tags: wal
06:20
Sync wal branch with [012cf101bf]. check-in: 9d690f24 user: dan tags: wal
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/pager.c.

3778
3779
3780
3781
3782
3783
3784
3785
3786
3787

3788

3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
....
3806
3807
3808
3809
3810
3811
3812











3813
3814
3815
3816
3817
3818
3819
    if( isOpen(pPager->jfd) || pPager->zJournal ){
      isErrorReset = 1;
    }
    pPager->errCode = SQLITE_OK;
    pager_reset(pPager);
  }

  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);
    }
  }
  assert( pPager->state>=SHARED_LOCK );

  if( pagerUseLog(pPager) ){
    int changed = 0;
    rc = sqlite3LogOpenSnapshot(pPager->pLog, &changed);
    if( rc==SQLITE_OK ){
      if( changed ){
        pager_reset(pPager);
        assert( pPager->errCode || pPager->dbSizeValid==0 );
      }
      pPager->state = PAGER_SHARED;
................................................................................
      rc = sqlite3PagerPagecount(pPager, &changed);
    }
  }else if( pPager->state==PAGER_UNLOCK || isErrorReset ){
    sqlite3_vfs * const pVfs = pPager->pVfs;
    int isHotJournal = 0;
    assert( !MEMDB );
    assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );












    /* 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 ){
      assert( pPager->state <= PAGER_SHARED );
      rc = hasHotJournal(pPager, &isHotJournal);







|
|
<
>
|
>





|
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>







3778
3779
3780
3781
3782
3783
3784
3785
3786

3787
3788
3789
3790
3791
3792
3793
3794
3795




3796
3797
3798
3799
3800
3801
3802
....
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
    if( isOpen(pPager->jfd) || pPager->zJournal ){
      isErrorReset = 1;
    }
    pPager->errCode = SQLITE_OK;
    pager_reset(pPager);
  }

  if( pagerUseLog(pPager) ){
    int changed = 0;


    /* TODO: Change the following block to grab a WAL read-lock. Or, 
    ** combine obtaining the read-lock with LogOpenSnapshot()?  */
    rc = pager_wait_on_lock(pPager, SHARED_LOCK);
    if( rc!=SQLITE_OK ){
      assert( pPager->state==PAGER_UNLOCK );
      return pager_error(pPager, rc);
    }





    rc = sqlite3LogOpenSnapshot(pPager->pLog, &changed);
    if( rc==SQLITE_OK ){
      if( changed ){
        pager_reset(pPager);
        assert( pPager->errCode || pPager->dbSizeValid==0 );
      }
      pPager->state = PAGER_SHARED;
................................................................................
      rc = sqlite3PagerPagecount(pPager, &changed);
    }
  }else 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 ){
      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);
      }
    }
    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 ){
      assert( pPager->state <= PAGER_SHARED );
      rc = hasHotJournal(pPager, &isHotJournal);

Changes to test/quick.test.

97
98
99
100
101
102
103



104
105
106
107
108
109
110
  incrvacuum_ioerr.test
  autovacuum_crash.test
  btree8.test
  shared_err.test
  vtab_err.test
  veryquick.test
  mallocAll.test



}

if {[sqlite3 -has-codec]} {
  # lappend EXCLUDE \
  #  conflict.test
}








>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  incrvacuum_ioerr.test
  autovacuum_crash.test
  btree8.test
  shared_err.test
  vtab_err.test
  veryquick.test
  mallocAll.test

  walslow.test
  walcrash.test
}

if {[sqlite3 -has-codec]} {
  # lappend EXCLUDE \
  #  conflict.test
}