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/main.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/main.c')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c index 25216070d..7ce43aec5 100644 --- a/src/main.c +++ b/src/main.c @@ -1361,7 +1361,7 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){ rc = SQLITE_ERROR; sqlite3Error(db, SQLITE_ERROR, "unknown database: %s", zDb); }else{ - rc = sqlite3Checkpoint(db, iDb); + rc = sqlite3Checkpoint(db, iDb, 0); sqlite3Error(db, rc, 0); } rc = sqlite3ApiExit(db, rc); @@ -1387,8 +1387,11 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){ ** If iDb is passed SQLITE_MAX_ATTACHED, then all attached databases are ** checkpointed. If an error is encountered it is returned immediately - ** no attempt is made to checkpoint any remaining databases. +** +** Parameter bBlock is true for a blocking-checkpoint, false for an +** ordinary, non-blocking, checkpoint. */ -int sqlite3Checkpoint(sqlite3 *db, int iDb){ +int sqlite3Checkpoint(sqlite3 *db, int iDb, int bBlock){ int rc = SQLITE_OK; /* Return code */ int i; /* Used to iterate through attached dbs */ @@ -1396,7 +1399,7 @@ int sqlite3Checkpoint(sqlite3 *db, int iDb){ for(i=0; i<db->nDb && rc==SQLITE_OK; i++){ if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){ - rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt); + rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, bBlock); } } |