]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Take care that the number of reserved bits per page is consistent between
authordrh <drh@noemail.net>
Wed, 23 Sep 2015 19:17:23 +0000 (19:17 +0000)
committerdrh <drh@noemail.net>
Wed, 23 Sep 2015 19:17:23 +0000 (19:17 +0000)
the source and destination databases when doing the back-copy on a VACUUM.

FossilOrigin-Name: 5b61b72f5424a2d9bb4e68eb95026cd63f003db9

manifest
manifest.uuid
src/backup.c
src/pager.c
src/pager.h

index a5c55554866f1a4fd7489ef815a11dfbfc293d2e..bf24e71000f27974bd81165a08c90fe67dc5d864 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Capture\sAFL-generated\sfuzz\stests\sfor\sjson1.c\sinto\sthe\stest/fuzzdata4.db\sfile.
-D 2015-09-23T11:59:50.725
+C Take\scare\sthat\sthe\snumber\sof\sreserved\sbits\sper\spage\sis\sconsistent\sbetween\s\nthe\ssource\sand\sdestination\sdatabases\swhen\sdoing\sthe\sback-copy\son\sa\sVACUUM.
+D 2015-09-23T19:17:23.388
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e1afa6fb2de2bddd50e0ddae8166c2ee9d69b301
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -279,7 +279,7 @@ F src/alter.c 4911e1f18fc11b60edbc6410643e938762969a6a
 F src/analyze.c 4c308880cf53c558070cb8513bdff4ffb1a38a77
 F src/attach.c e944d0052b577703b9b83aac1638452ff42a8395
 F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
-F src/backup.c 4d9134dc988a87838c06056c89c0e8c4700a0452
+F src/backup.c c3a9c4209439b806c44cf30daf466955727bf46c
 F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d
 F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
 F src/btree.c 164583151135a3764672c2c25aa8e4fa06bdb12b
@@ -327,8 +327,8 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
 F src/os_unix.c 76f493ed71c4154338049dee1bf6e47f69c74a55
 F src/os_win.c 40b3af7a47eb1107d0d69e592bec345a3b7b798a
 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
-F src/pager.c 4784012f80b2197c61ff6eaf4f5c7026d93253fd
-F src/pager.h 6d435f563b3f7fcae4b84433b76a6ac2730036e2
+F src/pager.c 2fbeeba28f4e6d08a15bc106f36c43346a81f09e
+F src/pager.h ac213f8143ebfee6a8bfb91cf4ca02c9a83343c5
 F src/parse.y f599aa5e871a493330d567ced93de696f61f48f7
 F src/pcache.c 24be750c79272e0ca7b6e007bc94999700f3e5ef
 F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9
@@ -1388,7 +1388,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 7c7a3f3e9bc2f7a7334d8d6eae183d83f22097be
-R 64646de8f025fcbfbac14050e58f6d8a
+P 10a214fdb3c13b25e0bdd15c975c21c8890c47ee
+R 2b1245a60b251810f1e390834307b519
 U drh
-Z 8d3625ca1ecc6df3eff60cf48fea0eb8
+Z 954cd22d559279a8020d621e1b476fcf
index 5e8156b16ca730636a94c37d9fa874ec9b0fd272..5731652f022b623b8c2113cace1eab025c107c43 100644 (file)
@@ -1 +1 @@
-10a214fdb3c13b25e0bdd15c975c21c8890c47ee
\ No newline at end of file
+5b61b72f5424a2d9bb4e68eb95026cd63f003db9
\ No newline at end of file
index 94e578d9df0afa532947819acb90cf3c8e06ae07..69e3c52822859ad56ba5f1b3cd9bf9ad6cf2ac13 100644 (file)
@@ -769,6 +769,10 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
   b.pDest = pTo;
   b.iNext = 1;
 
+#ifdef SQLITE_HAS_CODEC
+  sqlite3PagerAlignReserve(sqlite3BtreePager(pTo), sqlite3BtreePager(pFrom));
+#endif
+
   /* 0x7FFFFFFF is the hard limit for the number of pages in a database
   ** file. By passing this as the number of pages to copy to
   ** sqlite3_backup_step(), we can guarantee that the copy finishes 
index 2f7c330d60f19505af7e4071ad1ff330b8abd6cf..399070af01d503683ea692d1474910a2e64aefe9 100644 (file)
@@ -2116,6 +2116,20 @@ static void pagerReportSize(Pager *pPager){
 # define pagerReportSize(X)     /* No-op if we do not support a codec */
 #endif
 
+#ifdef SQLITE_HAS_CODEC
+/*
+** Make sure the number of reserved bits is the same in the destination
+** pager as it is in the source.  This comes up when a VACUUM changes the
+** number of reserved bits to the "optimal" amount.
+*/
+void sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){
+  if( pDest->nReserve!=pSrc->nReserve ){
+    pDest->nReserve = pSrc->nReserve;
+    pagerReportSize(pDest);
+  }
+}
+#endif
+
 /*
 ** Read a single page from either the journal file (if isMainJrnl==1) or
 ** from the sub-journal (if isMainJrnl==0) and playback that page.
index e3b57f435e1ea0af92ca6156487ba5b4c47f4b32..99a7aebc78f3c443bc1da88c0a15f8d6243b04ed 100644 (file)
@@ -118,6 +118,9 @@ int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
 /* Functions used to configure a Pager object. */
 void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);
 int sqlite3PagerSetPagesize(Pager*, u32*, int);
+#ifdef SQLITE_HAS_CODEC
+void sqlite3PagerAlignReserve(Pager*,Pager*);
+#endif
 int sqlite3PagerMaxPageCount(Pager*, int);
 void sqlite3PagerSetCachesize(Pager*, int);
 void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);