mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Add experimental command "PRAGMA wal_blocking_checkpoint", which uses the busy-handler to block until all readers have finished in order to ensure the next writer will be able to wrap around to the start of the log file.
FossilOrigin-Name: 7e3fc2c833a5baa08820c499867b6902bdc2ed5a
This commit is contained in:
10
src/pager.c
10
src/pager.c
@@ -6516,13 +6516,19 @@ sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
|
||||
|
||||
#ifndef SQLITE_OMIT_WAL
|
||||
/*
|
||||
** This function is called when the user invokes "PRAGMA checkpoint".
|
||||
** This function is called when the user invokes "PRAGMA wal_checkpoint",
|
||||
** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint()
|
||||
** or wal_blocking_checkpoint() API functions.
|
||||
**
|
||||
** Parameter bBlock is true for a blocking-checkpoint, false for an
|
||||
** ordinary, non-blocking, checkpoint.
|
||||
*/
|
||||
int sqlite3PagerCheckpoint(Pager *pPager){
|
||||
int sqlite3PagerCheckpoint(Pager *pPager, int bBlock){
|
||||
int rc = SQLITE_OK;
|
||||
if( pPager->pWal ){
|
||||
u8 *zBuf = (u8 *)pPager->pTmpSpace;
|
||||
rc = sqlite3WalCheckpoint(pPager->pWal,
|
||||
(bBlock ? pPager->xBusyHandler : 0), pPager->pBusyHandlerArg,
|
||||
(pPager->noSync ? 0 : pPager->sync_flags),
|
||||
pPager->pageSize, zBuf
|
||||
);
|
||||
|
Reference in New Issue
Block a user