]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the scrub utility program so that it does a FULL checkpoint prior to scrub-backup
authordrh <drh@noemail.net>
Tue, 17 May 2016 21:17:51 +0000 (21:17 +0000)
committerdrh <drh@noemail.net>
Tue, 17 May 2016 21:17:51 +0000 (21:17 +0000)
starting the backup, to ensure that the database file content matches what needs
to be backed up without having to look at the WAL file.

FossilOrigin-Name: ab1c5ce50f139070d7a322f43132a93c8af2ed68

ext/misc/scrub.c
manifest
manifest.uuid

index 12adcd7bd993c2b2d7b95cab1485a9881391bfbe..1d21fc5389d8f08d153b55f589b4b49175940b5c 100644 (file)
@@ -164,13 +164,20 @@ static void scrubBackupOpenSrc(ScrubState *p){
                       sqlite3_errmsg(p->dbSrc));
     return;
   }
-  p->rcErr = sqlite3_exec(p->dbSrc, "BEGIN", 0, 0, 0);
+  p->rcErr = sqlite3_exec(p->dbSrc, "SELECT 1 FROM sqlite_master; BEGIN;",
+                          0, 0, 0);
   if( p->rcErr ){
     scrubBackupErr(p,
        "cannot start a read transaction on the source database: %s",
        sqlite3_errmsg(p->dbSrc));
     return;
   }
+  rc = sqlite3_wal_checkpoint_v2(p->dbSrc, "main", SQLITE_CHECKPOINT_FULL,
+                                 0, 0);
+  if( rc ){
+    scrubBackupErr(p, "cannot checkpoint the source database");
+    return;
+  }
   pStmt = scrubBackupPrepare(p, p->dbSrc, "PRAGMA page_size");
   if( pStmt==0 ) return;
   rc = sqlite3_step(pStmt);
index 9b5c6f0b2e8c0e738c2367a430fb1b9c70048424..8af4221406f7bd7d1d669997c1e475aad74507c8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sthe\slatest\schanges\sfrom\strunk.
-D 2016-05-17T17:11:21.184
+C Enhance\sthe\sscrub\sutility\sprogram\sso\sthat\sit\sdoes\sa\sFULL\scheckpoint\sprior\sto\nstarting\sthe\sbackup,\sto\sensure\sthat\sthe\sdatabase\sfile\scontent\smatches\swhat\sneeds\nto\sbe\sbacked\sup\swithout\shaving\sto\slook\sat\sthe\sWAL\sfile.
+D 2016-05-17T21:17:51.530
 F Makefile.in f59e0763ff448719fc1bd25513882b0567286317
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 306d73e854b1a92ea06e5d1e637faa5c44de53c7
@@ -215,7 +215,7 @@ F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
 F ext/misc/regexp.c a68d25c659bd2d893cd1215667bbf75ecb9dc7d4
 F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
-F ext/misc/scrub.c a3380a5ff0698f88a56a23c999ee5e53768ac3ae
+F ext/misc/scrub.c ea0903701e3ac02b4466ce9cffd0325c7ddbfcf0
 F ext/misc/series.c e11e534ada797d5b816d7e7a93c022306563ca35
 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
 F ext/misc/spellfix.c bf1b922c2750698e9a3d4c50cce6974adb7e93be
@@ -1489,7 +1489,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d2efd3c176f0eba2d78105f0bb3161db38bd4bab 995c084bde44e678facc5f5d95a2335ce61e57b0
-R c8a04e46ce574c9cb7d04e9b64f57621
+P 5021dfe1f3f723a5938d547a0308f1d63103702d
+R a2f9971160f157164223781dabeb5e95
 U drh
-Z 19bb7af983a6a8b12079243584bed878
+Z 2fde01a79f5811045a1dffd48050935f
index ba749ac7fbbd398aeb0253b542a7c753ccbd4253..30152d3b675ea4e4556ffcf8d269a68e697e40a0 100644 (file)
@@ -1 +1 @@
-5021dfe1f3f723a5938d547a0308f1d63103702d
\ No newline at end of file
+ab1c5ce50f139070d7a322f43132a93c8af2ed68
\ No newline at end of file