Skip to content

Commit 8cb25d9

Browse files
committed
add LIBSQL_CHECKPOINT_ONLY_FULL compile option
1 parent e3904f9 commit 8cb25d9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

libsql-sqlite3/src/wal.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,15 @@ static int walCheckpoint(
20662066
}
20672067
}
20682068

2069+
2070+
#ifdef LIBSQL_CHECKPOINT_ONLY_FULL
2071+
// in case of LIBSQL_CHECKPOINT_ONLY_FULL option we want to either checkpoint whole WAL or quickly abort the checkpoint
2072+
if( mxSafeFrame!=walIndexHdr(pWal)->mxFrame ){
2073+
rc = SQLITE_BUSY;
2074+
goto walcheckpoint_out;
2075+
}
2076+
#endif
2077+
20692078
/* Allocate the iterator */
20702079
if( pInfo->nBackfill<mxSafeFrame ){
20712080
rc = walIteratorRevInit(pWal, pInfo->nBackfill, &pIter, mxSafeFrame, xCb == NULL);
@@ -2130,18 +2139,10 @@ static int walCheckpoint(
21302139

21312140
/* If work was actually accomplished... */
21322141
if( rc==SQLITE_OK ){
2133-
#ifdef LIBSQL_CHECKPOINT_CALLBACK_ON_ANY_FRAME_WRITTEN
2134-
if (xCb) {
2135-
rc = (xCb)(pCbData, mxSafeFrame, NULL, 0, 0, 0);
2136-
}
2137-
#endif
2138-
21392142
if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
2140-
#ifndef LIBSQL_CHECKPOINT_CALLBACK_ON_ANY_FRAME_WRITTEN
21412143
if (xCb) {
21422144
rc = (xCb)(pCbData, mxSafeFrame, NULL, 0, 0, 0);
21432145
}
2144-
#endif
21452146
if( rc==SQLITE_OK ){
21462147
i64 szDb = pWal->hdr.nPage*(i64)szPage;
21472148
testcase( IS_BIG_INT(szDb) );

0 commit comments

Comments
 (0)