diff options
author | dan <dan@noemail.net> | 2010-11-16 18:56:51 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-11-16 18:56:51 +0000 |
commit | a58f26f93f77ae83021d52ff76738f27a59596b9 (patch) | |
tree | afa92bf1f5beecef718d32dd5334eeb4c934ae78 /src/btree.c | |
parent | 95aa47b10a6ff9e920ee82b1dcde8c8ed73c69c2 (diff) | |
download | sqlite-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/btree.c')
-rw-r--r-- | src/btree.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/btree.c b/src/btree.c index 7e8c39feb..94100f48f 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7935,8 +7935,15 @@ int sqlite3BtreeIsInTrans(Btree *p){ ** ** Return SQLITE_LOCKED if this or any other connection has an open ** transaction on the shared-cache the argument Btree is connected to. +** +** If parameter bBlock is true, then the layers below invoke the +** busy-handler callback while waiting for readers to release locks so +** that the entire WAL can be checkpointed. If it is false, then as +** much as possible of the WAL is checkpointed without waiting for readers +** to finish. bBlock is true for "PRAGMA wal_blocking_checkpoint" and false +** for "PRAGMA wal_checkpoint". */ -int sqlite3BtreeCheckpoint(Btree *p){ +int sqlite3BtreeCheckpoint(Btree *p, int bBlock){ int rc = SQLITE_OK; if( p ){ BtShared *pBt = p->pBt; @@ -7944,7 +7951,7 @@ int sqlite3BtreeCheckpoint(Btree *p){ if( pBt->inTransaction!=TRANS_NONE ){ rc = SQLITE_LOCKED; }else{ - rc = sqlite3PagerCheckpoint(pBt->pPager); + rc = sqlite3PagerCheckpoint(pBt->pPager, bBlock); } sqlite3BtreeLeave(p); } |