aboutsummaryrefslogtreecommitdiff
path: root/src/pager.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-11-16 18:56:51 +0000
committerdan <dan@noemail.net>2010-11-16 18:56:51 +0000
commita58f26f93f77ae83021d52ff76738f27a59596b9 (patch)
treeafa92bf1f5beecef718d32dd5334eeb4c934ae78 /src/pager.c
parent95aa47b10a6ff9e920ee82b1dcde8c8ed73c69c2 (diff)
downloadsqlite-a58f26f93f77ae83021d52ff76738f27a59596b9.tar.gz
sqlite-a58f26f93f77ae83021d52ff76738f27a59596b9.zip
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
Diffstat (limited to 'src/pager.c')
-rw-r--r--src/pager.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pager.c b/src/pager.c
index b774af3a5..29f3bf1eb 100644
--- a/src/pager.c
+++ b/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
);