aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2009-11-20 18:48:35 +0000
committerdrh <drh@noemail.net>2009-11-20 18:48:35 +0000
commit8c30f72debb8c650ae7aa92632794e73878b1faa (patch)
treebe30650f1f0f68b1046fddc6808ea5baaee356a5 /src
parente6828f5503df0fdb0d625f5112bba1f56d8d4d44 (diff)
downloadsqlite-8c30f72debb8c650ae7aa92632794e73878b1faa.tar.gz
sqlite-8c30f72debb8c650ae7aa92632794e73878b1faa.zip
When moving pages as part of autovacuum on an in-memory database, make sure
that the source location is journalled so that a ROLLBACK can occur. Part of the fix for ticket [564d412f15a00] FossilOrigin-Name: 2f42f91fe65b0b21671936013df08037091f0cc6
Diffstat (limited to 'src')
-rw-r--r--src/pager.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pager.c b/src/pager.c
index 5ef579947..d781c25c0 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -5101,6 +5101,14 @@ int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
assert( pPg->nRef>0 );
+ /* In order to be able to rollback, an in-memory database must journal
+ ** the page we are moving from.
+ */
+ if( MEMDB ){
+ rc = sqlite3PagerWrite(pPg);
+ if( rc ) return rc;
+ }
+
/* If the page being moved is dirty and has not been saved by the latest
** savepoint, then save the current contents of the page into the
** sub-journal now. This is required to handle the following scenario:
@@ -5119,7 +5127,7 @@ int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
** one or more savepoint bitvecs. This is the reason this function
** may return SQLITE_NOMEM.
*/
- if( pPg->flags&PGHDR_DIRTY
+ if( pPg->flags&PGHDR_DIRTY
&& subjRequiresPage(pPg)
&& SQLITE_OK!=(rc = subjournalPage(pPg))
){