1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix a couple of assert() failures that can occur in btree.c and pager.c. (CVS 6055)

FossilOrigin-Name: ae44e7482476478c8eeacfb80b282f17894530e5
This commit is contained in:
danielk1977
2008-12-23 10:37:47 +00:00
parent 7974759cb4
commit a4124bdfb7
5 changed files with 59 additions and 33 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.521 2008/12/22 11:43:36 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.522 2008/12/23 10:37:47 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -3289,6 +3289,7 @@ static int pager_write(PgHdr *pPg){
*/
if( !pPager->noSync ){
pPg->flags |= PGHDR_NEED_SYNC;
pPager->needSync = 1;
}
/* An error has occured writing to the journal file. The
@@ -3305,14 +3306,12 @@ static int pager_write(PgHdr *pPg){
}else{
if( !pPager->journalStarted && !pPager->noSync ){
pPg->flags |= PGHDR_NEED_SYNC;
pPager->needSync = 1;
}
PAGERTRACE4("APPEND %d page %d needSync=%d\n",
PAGERID(pPager), pPg->pgno,
((pPg->flags&PGHDR_NEED_SYNC)?1:0));
}
if( pPg->flags&PGHDR_NEED_SYNC ){
pPager->needSync = 1;
}
}
/* If the statement journal is open and the page is not in it,
@@ -3409,6 +3408,7 @@ int sqlite3PagerWrite(DbPage *pDbPage){
rc = pager_write(pPage);
if( pPage->flags&PGHDR_NEED_SYNC ){
needSync = 1;
assert(pPager->needSync);
}
sqlite3PagerUnref(pPage);
}