/ Check-in [942daf94]
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:Add an assert() to verify that the dirty-page list in the pager is valid before using it. (CVS 4810)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 942daf94ef1f8ac678988e175ef968a2d3f801e9
User & Date: drh 2008-02-26 14:46:05
Context
2008-02-26
16:16
Add commentary to clarify what is happening when an I/O error occurs while writing dirty pages to the database file. (CVS 4811) check-in: afe49d81 user: drh tags: trunk
14:46
Add an assert() to verify that the dirty-page list in the pager is valid before using it. (CVS 4810) check-in: 942daf94 user: drh tags: trunk
06:05
Have sqlite3PagerPagecount() return -1 when the pager is in error state. Fix for #2961. (CVS 4809) check-in: 427e7f8b user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
3000
3001
3002
3003
3004
3005
3006













3007
3008
3009
3010
3011
3012
3013
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.409 2008/02/26 06:05:31 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include <assert.h>
#include <string.h>

/*
................................................................................

/*
** Collect every dirty page into a dirty list and
** return a pointer to the head of that list.  All pages are
** collected even if they are still in use.
*/
static PgHdr *pager_get_all_dirty_pages(Pager *pPager){













  return pPager->pDirty;
}

/*
** Return TRUE if there is a hot journal on the given pager.
** A hot journal is one that needs to be played back.
**







|







 







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







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.410 2008/02/26 14:46:05 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include <assert.h>
#include <string.h>

/*
................................................................................

/*
** Collect every dirty page into a dirty list and
** return a pointer to the head of that list.  All pages are
** collected even if they are still in use.
*/
static PgHdr *pager_get_all_dirty_pages(Pager *pPager){

#ifndef NDEBUG
  /* Verify the sanity of the dirty list when we are running
  ** in debugging mode.  This is expensive, so do not
  ** do this on a normal build. */
  int n1 = 0;
  int n2 = 0;
  PgHdr *p;
  for(p=pPager->pAll; p; p=p->pNextAll){ if( p->dirty ) n1++; }
  for(p=pPager->pDirty; p; p=p->pDirty){ n2++; }
  assert( n1==n2 );
#endif

  return pPager->pDirty;
}

/*
** Return TRUE if there is a hot journal on the given pager.
** A hot journal is one that needs to be played back.
**