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

When committing a WAL transaction, make sure at least one page is

written to the WAL file so that the WAL subsystem will have a page
on which to set the commit flag.
Ticket [2d1a5c67dfc236].

FossilOrigin-Name: 67bf1c9a888b0d84d252d6c4c754c2c51994d208
This commit is contained in:
drh
2011-05-19 01:21:42 +00:00
parent 52784bd01a
commit e5a1320d73
4 changed files with 91 additions and 7 deletions

View File

@@ -5747,11 +5747,21 @@ int sqlite3PagerCommitPhaseOne(
}else{
if( pagerUseWal(pPager) ){
PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
PgHdr *pPageOne = 0;
if( pList==0 ){
/* Must have at least one page for the WAL commit flag.
** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
rc = sqlite3PagerGet(pPager, 1, &pPageOne);
pList = pPageOne;
pList->pDirty = 0;
}
assert( pList!=0 || rc!=SQLITE_OK );
if( pList ){
rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1,
(pPager->fullSync ? pPager->syncFlags : 0)
);
}
sqlite3PagerUnref(pPageOne);
if( rc==SQLITE_OK ){
sqlite3PcacheCleanAll(pPager->pPCache);
}