/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

2911
2912
2913
2914
2915
2916
2917



2918
2919
2920
2921
2922



2923
2924
2925
2926
2927
2928
2929
2930
2931



2932
2933












2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
    rc = pagerUndoCallback((void *)pPager, pList->pgno);
    pList = pNext;
  }

  return rc;
}




/*
** This function is a wrapper around sqlite3WalFrames(). As well as logging
** the contents of the list of pages headed by pList (connected by pDirty),
** this function notifies any active backup processes that the pages have
** changed. 



*/ 
static int pagerWalFrames(
  Pager *pPager,                  /* Pager object */
  PgHdr *pList,                   /* List of frames to log */
  Pgno nTruncate,                 /* Database size after this commit */
  int isCommit,                   /* True if this is a commit */
  int syncFlags                   /* Flags to pass to OsSync() (or 0) */
){
  int rc;                         /* Return code */




  assert( pPager->pWal );












  rc = sqlite3WalFrames(pPager->pWal, 
      pPager->pageSize, pList, nTruncate, isCommit, syncFlags
  );
  if( rc==SQLITE_OK && pPager->pBackup ){
    PgHdr *p;
    for(p=pList; p; p=p->pDirty){
      sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
    }
  }

#ifdef SQLITE_CHECK_PAGES
  {
    PgHdr *p;
    for(p=pList; p; p=p->pDirty) pager_set_pagehash(p);
  }
#endif

  return rc;
}

/*







>
>
>




|
>
>
>









>
>
>


>
>
>
>
>
>
>
>
>
>
>
>











|
|
<







2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967

2968
2969
2970
2971
2972
2973
2974
    rc = pagerUndoCallback((void *)pPager, pList->pgno);
    pList = pNext;
  }

  return rc;
}

/* Forward declaration */
static int pager_incr_changecounter(Pager*,int);

/*
** This function is a wrapper around sqlite3WalFrames(). As well as logging
** the contents of the list of pages headed by pList (connected by pDirty),
** this function notifies any active backup processes that the pages have
** changed.
**
** The list of pages passed into this routine is always sorted by page number.
** Hence, if page 1 appears anywhere on the list, it will be the first page.
*/ 
static int pagerWalFrames(
  Pager *pPager,                  /* Pager object */
  PgHdr *pList,                   /* List of frames to log */
  Pgno nTruncate,                 /* Database size after this commit */
  int isCommit,                   /* True if this is a commit */
  int syncFlags                   /* Flags to pass to OsSync() (or 0) */
){
  int rc;                         /* Return code */
#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES)
  PgHdr *p;                       /* For looping over pages */
#endif

  assert( pPager->pWal );
#ifdef SQLITE_DEBUG
  /* Verify that the page list is in accending order */
  for(p=pList; p && p->pDirty; p=p->pDirty){
    assert( p->pgno < p->pDirty->pgno );
  }
#endif

  if( pList->pgno==1 ){
    pPager->changeCountDone = 0;
    pager_incr_changecounter(pPager,0);
    pPager->changeCountDone = 0;
  }
  rc = sqlite3WalFrames(pPager->pWal, 
      pPager->pageSize, pList, nTruncate, isCommit, syncFlags
  );
  if( rc==SQLITE_OK && pPager->pBackup ){
    PgHdr *p;
    for(p=pList; p; p=p->pDirty){
      sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
    }
  }

#ifdef SQLITE_CHECK_PAGES
  for(p=pList; p; p=p->pDirty){
    pager_set_pagehash(p);

  }
#endif

  return rc;
}

/*

test/progress.test became a regular file.

tool/mkopts.tcl became a regular file.