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

Do not journal the locking page which doing an autovacuum. Similar to the

problem of #1432 except that this one occurs on autovacuum instead of vacuum.
An assert() has been added to catch any future incidents of this type. (CVS 2704)

FossilOrigin-Name: 5b6dc12b7d25d999be5d282cd0b06e02e2bda765
This commit is contained in:
drh
2005-09-16 17:16:52 +00:00
parent 50f2f43cba
commit 267cb326e9
3 changed files with 15 additions and 10 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.213 2005/09/16 10:18:46 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.214 2005/09/16 17:16:53 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -2307,7 +2307,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
/* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page
** number greater than this, or zero, is requested.
*/
if( pgno>PAGER_MAX_PGNO || pgno==0 ){
if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
return SQLITE_CORRUPT;
}
@@ -2833,6 +2833,10 @@ int sqlite3pager_write(void *pData){
}
}else{
u32 cksum;
/* We should never write to the journal file the page that
** contains the database locks. The following assert verifies
** that we do not. */
assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
CODEC(pPager, pData, pPg->pgno, 7);
cksum = pager_cksum(pPager, pPg->pgno, pData);
saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager);
@@ -3459,8 +3463,9 @@ int sqlite3pager_sync(Pager *pPager, const char *zMaster, Pgno nTrunc){
*/
Pgno i;
void *pPage;
int iSkip = PAGER_MJ_PGNO(pPager);
for( i=nTrunc+1; i<=pPager->origDbSize; i++ ){
if( !(pPager->aInJournal[i/8] & (1<<(i&7))) ){
if( !(pPager->aInJournal[i/8] & (1<<(i&7))) && i!=iSkip ){
rc = sqlite3pager_get(pPager, i, &pPage);
if( rc!=SQLITE_OK ) goto sync_exit;
rc = sqlite3pager_write(pPage);