Skip to content

Commit 628ccee

Browse files
committed
disable checkpoint downgrade under LIBSQL_DISABLE_CHECKPOINT_DOWNGRADE compile time option
1 parent 9b04f1d commit 628ccee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libsql-sqlite3/src/wal.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4131,13 +4131,21 @@ static int sqlite3WalCheckpoint(
41314131
*/
41324132
if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
41334133
rc = walBusyLock(pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1);
4134+
#ifndef LIBSQL_DISABLE_CHECKPOINT_DOWNGRADE
41344135
if( rc==SQLITE_OK ){
41354136
pWal->writeLock = 1;
41364137
}else if( rc==SQLITE_BUSY ){
41374138
eMode2 = SQLITE_CHECKPOINT_PASSIVE;
41384139
xBusy2 = 0;
41394140
rc = SQLITE_OK;
41404141
}
4142+
#else
4143+
// checkpoint downgrade can be undesirable behaviour especially in case of custom VWal implementation
4144+
// LIBSQL_DISABLE_CHECKPOINT_DOWNGRADE compile time option disables downgrade of checkpoint mode
4145+
if( rc==SQLITE_OK ){
4146+
pWal->writeLock = 1;
4147+
}
4148+
#endif
41414149
}
41424150
}
41434151

0 commit comments

Comments
 (0)