1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

When committing a WAL transaction, do not write any pages to the WAL file with page numbers greater than the size of the database image in pages.

FossilOrigin-Name: 311d0b613d9cfa2dbcbb9ef2450041b1fd48770a
This commit is contained in:
dan
2011-04-05 16:09:08 +00:00
parent 0d8bba982d
commit ce8e5ffe1c
4 changed files with 73 additions and 9 deletions

View File

@@ -2972,6 +2972,19 @@ static int pagerWalFrames(
}
#endif
if( isCommit ){
/* If a WAL transaction is being committed, there is no point in writing
** any pages with page numbers greater than nTruncate into the WAL file.
** They will never be read by any client. So remove them from the pDirty
** list here. */
PgHdr *p;
PgHdr **ppNext = &pList;
for(p=pList; (*ppNext = p); p=p->pDirty){
if( p->pgno<=nTruncate ) ppNext = &p->pDirty;
}
assert( pList );
}
if( pList->pgno==1 ) pager_write_changecounter(pList);
rc = sqlite3WalFrames(pPager->pWal,
pPager->pageSize, pList, nTruncate, isCommit, syncFlags
@@ -2984,6 +2997,7 @@ static int pagerWalFrames(
}
#ifdef SQLITE_CHECK_PAGES
pList = sqlite3PcacheDirtyList(pPager->pPCache);
for(p=pList; p; p=p->pDirty){
pager_set_pagehash(p);
}