/ Check-in [04fa1e16]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  4001   4001       ** set (set by sqlite3PagerDontWrite()).
  4002   4002       */
  4003   4003       if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
  4004   4004         i64 offset = (pgno-1)*(i64)pPager->pageSize;   /* Offset to write */
  4005   4005         char *pData;                                   /* Data to write */    
  4006   4006   
  4007   4007         assert( (pList->flags&PGHDR_NEED_SYNC)==0 );
         4008  +      if( pList->pgno==1 ) pager_write_changecounter(pList);
  4008   4009   
  4009   4010         /* Encode the database */
  4010   4011         CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData);
  4011   4012   
  4012   4013         /* Write out the page data. */
  4013   4014         rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);
  4014   4015   
................................................................................
  5580   5581       assert( pPgHdr==0 || rc==SQLITE_OK );
  5581   5582   
  5582   5583       /* If page one was fetched successfully, and this function is not
  5583   5584       ** operating in direct-mode, make page 1 writable.  When not in 
  5584   5585       ** direct mode, page 1 is always held in cache and hence the PagerGet()
  5585   5586       ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.
  5586   5587       */
  5587         -    if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){
         5588  +    if( !DIRECT_MODE && rc==SQLITE_OK ){
  5588   5589         rc = sqlite3PagerWrite(pPgHdr);
  5589   5590       }
  5590   5591   
  5591   5592       if( rc==SQLITE_OK ){
  5592   5593         /* Actually do the update of the change counter */
  5593   5594         pager_write_changecounter(pPgHdr);
  5594   5595   

Changes to test/exclusive2.test.

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