1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +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:
dan
2010-11-16 18:56:51 +00:00
parent 95aa47b10a
commit a58f26f93f
14 changed files with 256 additions and 67 deletions

View File

@@ -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);
}