/ Check-in [04fa1e16]
Login

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

Overview
Comment:Make sure the change-counter and SQLite-version fields of the header are set correctly even when doing a VACUUM with locking_mode=EXCLUSIVE. Ticket [5d863f876ee9561b].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 04fa1e16905183b948ee6456675799a873d5f97d
User & Date: drh 2011-01-16 00:56:19
References
2011-02-20
03:32
Make sure the change-counter and SQLite-version fields of the header are set correctly even after vacuuming. This is a backport of changes [0be92a7576] and [04fa1e1690] to address ticket [5d863f876ee]. check-in: 442be135 user: drh tags: branch-3.7.4
Context
2011-01-16
22:37
On a backup from a smaller to a larger page size, do not begin committing the transaction until the source pages after the pending byte have been copied. check-in: 612e2599 user: drh tags: trunk
00:56
Make sure the change-counter and SQLite-version fields of the header are set correctly even when doing a VACUUM with locking_mode=EXCLUSIVE. Ticket [5d863f876ee9561b]. check-in: 04fa1e16 user: drh tags: trunk
2011-01-15
21:42
Make sure the change counter and SQLite version numbers in the header are set correctly, even when running in WAL mode and when VACUUMing in WAL mode. Ticket [5d863f876ee9561b9]. check-in: 0be92a75 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

4001
4002
4003
4004
4005
4006
4007

4008
4009
4010
4011
4012
4013
4014
....
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
    ** set (set by sqlite3PagerDontWrite()).
    */
    if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
      i64 offset = (pgno-1)*(i64)pPager->pageSize;   /* Offset to write */
      char *pData;                                   /* Data to write */    

      assert( (pList->flags&PGHDR_NEED_SYNC)==0 );


      /* Encode the database */
      CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);

      /* Write out the page data. */
      rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);

................................................................................
    assert( pPgHdr==0 || rc==SQLITE_OK );

    /* If page one was fetched successfully, and this function is not
    ** operating in direct-mode, make page 1 writable.  When not in 
    ** direct mode, page 1 is always held in cache and hence the PagerGet()
    ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.
    */
    if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){
      rc = sqlite3PagerWrite(pPgHdr);
    }

    if( rc==SQLITE_OK ){
      /* Actually do the update of the change counter */
      pager_write_changecounter(pPgHdr);








>







 







|







4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
....
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
    ** set (set by sqlite3PagerDontWrite()).
    */
    if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
      i64 offset = (pgno-1)*(i64)pPager->pageSize;   /* Offset to write */
      char *pData;                                   /* Data to write */    

      assert( (pList->flags&PGHDR_NEED_SYNC)==0 );
      if( pList->pgno==1 ) pager_write_changecounter(pList);

      /* Encode the database */
      CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);

      /* Write out the page data. */
      rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);

................................................................................
    assert( pPgHdr==0 || rc==SQLITE_OK );

    /* If page one was fetched successfully, and this function is not
    ** operating in direct-mode, make page 1 writable.  When not in 
    ** direct mode, page 1 is always held in cache and hence the PagerGet()
    ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.
    */
    if( !DIRECT_MODE && rc==SQLITE_OK ){
      rc = sqlite3PagerWrite(pPgHdr);
    }

    if( rc==SQLITE_OK ){
      /* Actually do the update of the change counter */
      pager_write_changecounter(pPgHdr);

Changes to test/exclusive2.test.

295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
} {4}
do_test exclusive2-3.5 {
  execsql {
    PRAGMA locking_mode = normal;
    INSERT INTO t1 VALUES(randstr(10, 400));
  }
  readPagerChangeCounter test.db
} {4}
do_test exclusive2-3.6 {
  execsql {
    INSERT INTO t1 VALUES(randstr(10, 400));
  }
  readPagerChangeCounter test.db
} {5}
sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)

finish_test







|





|



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
} {4}
do_test exclusive2-3.5 {
  execsql {
    PRAGMA locking_mode = normal;
    INSERT INTO t1 VALUES(randstr(10, 400));
  }
  readPagerChangeCounter test.db
} {5}
do_test exclusive2-3.6 {
  execsql {
    INSERT INTO t1 VALUES(randstr(10, 400));
  }
  readPagerChangeCounter test.db
} {6}
sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)

finish_test