/ Check-in [c1e0d09c]
Login

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

Overview
Comment:Increment the change counter and update the SQLite version number whenever page 1 is added to the WAL. Ticket [5d863f876ee9561b9]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-5d863f87
Files: files | file ages | folders
SHA1: c1e0d09cd3f5feae123468a35f147021d839641c
User & Date: drh 2011-01-15 17:12:59
Original Comment: Increment the change counter and update the SQLite version number whenever page 1 is added to the WAL. Ticket [5d863f876ee9561b9]
Context
2011-01-15
18:11
Fix the change-counter increment for WAL pages so that it works even when invoked from xStress. Ticket [5d863f876ee9561b95e2]. Closed-Leaf check-in: 228e7c34 user: drh tags: bug-5d863f87
17:12
Increment the change counter and update the SQLite version number whenever page 1 is added to the WAL. Ticket [5d863f876ee9561b9] check-in: c1e0d09c user: drh tags: bug-5d863f87
16:52
Add a test case demonstrating the problem described by ticket [5d863f876e]. check-in: af54963f user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  2911   2911       rc = pagerUndoCallback((void *)pPager, pList->pgno);
  2912   2912       pList = pNext;
  2913   2913     }
  2914   2914   
  2915   2915     return rc;
  2916   2916   }
  2917   2917   
         2918  +/* Forward declaration */
         2919  +static int pager_incr_changecounter(Pager*,int);
         2920  +
  2918   2921   /*
  2919   2922   ** This function is a wrapper around sqlite3WalFrames(). As well as logging
  2920   2923   ** the contents of the list of pages headed by pList (connected by pDirty),
  2921   2924   ** this function notifies any active backup processes that the pages have
  2922         -** changed. 
         2925  +** changed.
         2926  +**
         2927  +** The list of pages passed into this routine is always sorted by page number.
         2928  +** Hence, if page 1 appears anywhere on the list, it will be the first page.
  2923   2929   */ 
  2924   2930   static int pagerWalFrames(
  2925   2931     Pager *pPager,                  /* Pager object */
  2926   2932     PgHdr *pList,                   /* List of frames to log */
  2927   2933     Pgno nTruncate,                 /* Database size after this commit */
  2928   2934     int isCommit,                   /* True if this is a commit */
  2929   2935     int syncFlags                   /* Flags to pass to OsSync() (or 0) */
  2930   2936   ){
  2931   2937     int rc;                         /* Return code */
         2938  +#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES)
         2939  +  PgHdr *p;                       /* For looping over pages */
         2940  +#endif
  2932   2941   
  2933   2942     assert( pPager->pWal );
         2943  +#ifdef SQLITE_DEBUG
         2944  +  /* Verify that the page list is in accending order */
         2945  +  for(p=pList; p && p->pDirty; p=p->pDirty){
         2946  +    assert( p->pgno < p->pDirty->pgno );
         2947  +  }
         2948  +#endif
         2949  +
         2950  +  if( pList->pgno==1 ){
         2951  +    pPager->changeCountDone = 0;
         2952  +    pager_incr_changecounter(pPager,0);
         2953  +    pPager->changeCountDone = 0;
         2954  +  }
  2934   2955     rc = sqlite3WalFrames(pPager->pWal, 
  2935   2956         pPager->pageSize, pList, nTruncate, isCommit, syncFlags
  2936   2957     );
  2937   2958     if( rc==SQLITE_OK && pPager->pBackup ){
  2938   2959       PgHdr *p;
  2939   2960       for(p=pList; p; p=p->pDirty){
  2940   2961         sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
  2941   2962       }
  2942   2963     }
  2943   2964   
  2944   2965   #ifdef SQLITE_CHECK_PAGES
  2945         -  {
  2946         -    PgHdr *p;
  2947         -    for(p=pList; p; p=p->pDirty) pager_set_pagehash(p);
         2966  +  for(p=pList; p; p=p->pDirty){
         2967  +    pager_set_pagehash(p);
  2948   2968     }
  2949   2969   #endif
  2950   2970   
  2951   2971     return rc;
  2952   2972   }
  2953   2973   
  2954   2974   /*

test/progress.test became a regular file.


tool/mkopts.tcl became a regular file.