aboutsummaryrefslogtreecommitdiff
path: root/src/wal.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2018-03-02 16:52:47 +0000
committerdan <dan@noemail.net>2018-03-02 16:52:47 +0000
commitf0cb61d6c2e7b09a0bb9fef3144637957cf3f952 (patch)
treecf29d92222404b3361772e4f571be9f46d7431bd /src/wal.c
parent302ce47519a2b98adc0ed77fadeadf8cd3cb293b (diff)
downloadsqlite-f0cb61d6c2e7b09a0bb9fef3144637957cf3f952.tar.gz
sqlite-f0cb61d6c2e7b09a0bb9fef3144637957cf3f952.zip
In a checkpoint, figure out if it is possible to checkpoint any frames at all
before creating the wal-iterator. FossilOrigin-Name: 044b0b65e716bffeddedbd1b0360c4c332f6d2359167c1d327a5ff96539474cb
Diffstat (limited to 'src/wal.c')
-rw-r--r--src/wal.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/wal.c b/src/wal.c
index fdcaa8057..c42bf39bc 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1789,13 +1789,6 @@ static int walCheckpoint(
pInfo = walCkptInfo(pWal);
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
- /* Allocate the iterator */
- rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter);
- if( rc!=SQLITE_OK ){
- return rc;
- }
- assert( pIter );
-
/* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
** in the SQLITE_CHECKPOINT_PASSIVE mode. */
assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
@@ -1832,7 +1825,13 @@ static int walCheckpoint(
}
}
- if( pInfo->nBackfill<mxSafeFrame
+ /* Allocate the iterator */
+ if( pInfo->nBackfill<mxSafeFrame ){
+ rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter);
+ assert( rc==SQLITE_OK || pIter==0 );
+ }
+
+ if( pIter
&& (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
){
i64 nSize; /* Current size of database file */