mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Update this branch with recent checkpoint related changes from trunk.
FossilOrigin-Name: fb6b7938601505186c0b1f0df6c45630039027f85ff394d290bc2c86b16a3a07
This commit is contained in:
24
src/wal.c
24
src/wal.c
@@ -1586,8 +1586,9 @@ static void walIteratorFree(WalIterator *p){
|
||||
|
||||
/*
|
||||
** Construct a WalInterator object that can be used to loop over all
|
||||
** pages in the WAL in ascending order. The caller must hold the checkpoint
|
||||
** lock.
|
||||
** pages in the WAL following frame nBackfill in ascending order. Frames
|
||||
** nBackfill or earlier may be included - excluding them is an optimization
|
||||
** only. The caller must hold the checkpoint lock.
|
||||
**
|
||||
** On success, make *pp point to the newly allocated WalInterator object
|
||||
** return SQLITE_OK. Otherwise, return an error code. If this routine
|
||||
@@ -1596,7 +1597,7 @@ static void walIteratorFree(WalIterator *p){
|
||||
** The calling routine should invoke walIteratorFree() to destroy the
|
||||
** WalIterator object when it has finished with it.
|
||||
*/
|
||||
static int walIteratorInit(Wal *pWal, WalIterator **pp){
|
||||
static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
|
||||
WalIterator *p; /* Return value */
|
||||
int nSegment; /* Number of segments to merge */
|
||||
u32 iLast; /* Last frame in log */
|
||||
@@ -1633,7 +1634,7 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
}
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<nSegment; i++){
|
||||
for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i<nSegment; i++){
|
||||
volatile ht_slot *aHash;
|
||||
u32 iZero;
|
||||
volatile u32 *aPgno;
|
||||
@@ -1789,13 +1790,6 @@ static int walCheckpoint(
|
||||
pInfo = walCkptInfo(pWal);
|
||||
if( pInfo->nBackfill<pWal->hdr.mxFrame ){
|
||||
|
||||
/* Allocate the iterator */
|
||||
rc = walIteratorInit(pWal, &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 +1826,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 */
|
||||
|
Reference in New Issue
Block a user