Additional debugging instrumentation added to the pager. (CVS 4078)
FossilOrigin-Name: dcdb20f81ae923f6f56d75c7b8b89a0b3abff954
This commit is contained in:
parent
7d7f17b6a8
commit
477731b52d
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Make\sarrangements\sto\soptionally\sprint\sa\sdebug\smessage\sat\sthe\spoint\nof\sa\ssimulated\smalloc()\sfailure\swhen\sSQLITE_MEMDEBUG\sis\sdefined.\s(CVS\s4077)
|
||||
D 2007-06-15T20:29:20
|
||||
C Additional\sdebugging\sinstrumentation\sadded\sto\sthe\spager.\s(CVS\s4078)
|
||||
D 2007-06-16T03:06:28
|
||||
F Makefile.in b9971ab07868cf2b3209fe3bf8c52e7e25af4193
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -94,7 +94,7 @@ F src/os_unix.c f2ccf2e9a925fc679faf7a8fe85700e0f13cf0e1
|
||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||
F src/os_win.c d868d5f9e95ec9c1b9e2a30c54c996053db6dddd
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
F src/pager.c 42cffb2e04a6efd23cfff28a15d686fbaa076b59
|
||||
F src/pager.c a4a02246d23edcc8113f5957d7db4772d9cd71bc
|
||||
F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae
|
||||
F src/parse.y 2ed1d91fdcb4ae7ae7d1f4674544297807c7cc26
|
||||
F src/pragma.c 0d25dad58bdfd6789943a10f1b9663c2eb85b96d
|
||||
@ -506,7 +506,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P b55318b12d026abd5a32469a19c36abbd6250137
|
||||
R 9fb9378a6131ef971724f58e359aa823
|
||||
P 7d3c1f08a34fcf2ca5c79d6e58f713ae6a4b34e8
|
||||
R 22dcb4d1b3c757bf921381ac2ad50631
|
||||
U drh
|
||||
Z 9b3a097433469bac22ff4239e6205986
|
||||
Z aa8c8e6b272cf52bad3cb3c217bce91b
|
||||
|
@ -1 +1 @@
|
||||
7d3c1f08a34fcf2ca5c79d6e58f713ae6a4b34e8
|
||||
dcdb20f81ae923f6f56d75c7b8b89a0b3abff954
|
33
src/pager.c
33
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.343 2007/06/13 15:22:28 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.344 2007/06/16 03:06:28 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -512,19 +512,27 @@ static int pager_error(Pager *pPager, int rc){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** If SQLITE_CHECK_PAGES is defined then we do some sanity checking
|
||||
** on the cache using a hash function. This is used for testing
|
||||
** and debugging only.
|
||||
*/
|
||||
#ifdef SQLITE_CHECK_PAGES
|
||||
/*
|
||||
** Return a 32-bit hash of the page data for pPage.
|
||||
*/
|
||||
static u32 pager_pagehash(PgHdr *pPage){
|
||||
static u32 pager_datahash(int nByte, unsigned char *pData){
|
||||
u32 hash = 0;
|
||||
int i;
|
||||
unsigned char *pData = (unsigned char *)PGHDR_TO_DATA(pPage);
|
||||
for(i=0; i<pPage->pPager->pageSize; i++){
|
||||
hash = (hash+i)^pData[i];
|
||||
for(i=0; i<nByte; i++){
|
||||
hash = (hash*1039) + pData[i];
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
static u32 pager_pagehash(PgHdr *pPage){
|
||||
return pager_datahash(pPage->pPager->pageSize,
|
||||
(unsigned char *)PGHDR_TO_DATA(pPage));
|
||||
}
|
||||
|
||||
/*
|
||||
** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES
|
||||
@ -539,6 +547,8 @@ static void checkPage(PgHdr *pPg){
|
||||
}
|
||||
|
||||
#else
|
||||
#define pager_datahash(X) 0
|
||||
#define pager_pagehash(X) 0
|
||||
#define CHECK_PAGE(x)
|
||||
#endif
|
||||
|
||||
@ -1105,7 +1115,8 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
|
||||
** cache or else it is marked as needSync==0.
|
||||
*/
|
||||
pPg = pager_lookup(pPager, pgno);
|
||||
PAGERTRACE3("PLAYBACK %d page %d\n", PAGERID(pPager), pgno);
|
||||
PAGERTRACE4("PLAYBACK %d page %d hash(%08x)\n",
|
||||
PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, aData));
|
||||
if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) ){
|
||||
rc = sqlite3OsSeek(pPager->fd, (pgno-1)*(i64)pPager->pageSize);
|
||||
if( rc==SQLITE_OK ){
|
||||
@ -2472,7 +2483,8 @@ static int pager_write_pagelist(PgHdr *pList){
|
||||
*/
|
||||
if( pList->pgno<=pPager->dbSize ){
|
||||
char *pData = CODEC2(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6);
|
||||
PAGERTRACE3("STORE %d page %d\n", PAGERID(pPager), pList->pgno);
|
||||
PAGERTRACE4("STORE %d page %d hash(%08x)\n",
|
||||
PAGERID(pPager), pList->pgno, pager_pagehash(pList));
|
||||
IOTRACE(("PGOUT %p %d\n", pPager, pList->pgno));
|
||||
rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize);
|
||||
PAGER_INCR(sqlite3_pager_writedb_count);
|
||||
@ -2718,12 +2730,13 @@ static int readDbPage(Pager *pPager, PgHdr *pPg, Pgno pgno){
|
||||
PAGER_INCR(sqlite3_pager_readdb_count);
|
||||
PAGER_INCR(pPager->nRead);
|
||||
IOTRACE(("PGIN %p %d\n", pPager, pgno));
|
||||
PAGERTRACE3("FETCH %d page %d\n", PAGERID(pPager), pPg->pgno);
|
||||
if( pgno==1 ){
|
||||
memcpy(&pPager->dbFileVers, &((u8*)PGHDR_TO_DATA(pPg))[24],
|
||||
sizeof(pPager->dbFileVers));
|
||||
}
|
||||
CODEC1(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
|
||||
PAGERTRACE4("FETCH %d page %d hash(%08x)\n",
|
||||
PAGERID(pPager), pPg->pgno, pager_pagehash(pPg));
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -3500,8 +3513,8 @@ static int pager_write(PgHdr *pPg){
|
||||
pPager->journalOff, szPg));
|
||||
PAGER_INCR(sqlite3_pager_writej_count);
|
||||
pPager->journalOff += szPg;
|
||||
PAGERTRACE4("JOURNAL %d page %d needSync=%d\n",
|
||||
PAGERID(pPager), pPg->pgno, pPg->needSync);
|
||||
PAGERTRACE5("JOURNAL %d page %d needSync=%d hash(%08x)\n",
|
||||
PAGERID(pPager), pPg->pgno, pPg->needSync, pager_pagehash(pPg));
|
||||
*(u32*)pEnd = saved;
|
||||
|
||||
/* An error has occured writing to the journal file. The
|
||||
|
Loading…
Reference in New Issue
Block a user