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/pragma.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/pragma.c')
-rw-r--r-- | src/pragma.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pragma.c b/src/pragma.c index 362e77f29..7324e1bde 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1394,12 +1394,18 @@ void sqlite3Pragma( #ifndef SQLITE_OMIT_WAL /* ** PRAGMA [database.]wal_checkpoint + ** PRAGMA [database.]wal_blocking_checkpoint ** ** Checkpoint the database. */ - if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0 ){ + if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0 + || sqlite3StrICmp(zLeft, "wal_blocking_checkpoint")==0 + ){ + int bBlock = (zLeft[14]!=0); + int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED); + assert( bBlock==(sqlite3StrICmp(zLeft, "wal_checkpoint")!=0) ); if( sqlite3ReadSchema(pParse) ) goto pragma_out; - sqlite3VdbeAddOp3(v, OP_Checkpoint, pId2->z?iDb:SQLITE_MAX_ATTACHED, 0, 0); + sqlite3VdbeAddOp2(v, OP_Checkpoint, iBt, bBlock); }else /* |