u32 szPage; /* Page size */
u32 szUsable; /* Usable bytes on each page */
u32 nPage; /* Number of pages */
+ u32 iLastPage; /* Page number of last page written so far*/
u8 *page1; /* Content of page 1 */
};
scrubBackupErr(p, "write failed for page %d", pgno);
p->rcErr = SQLITE_IOERR;
}
+ if( pgno>p->iLastPage ) p->iLastPage = pgno;
}
/* Prepare a statement against the "db" database. */
}
sqlite3_finalize(pStmt);
+ /* If the last page of the input db file is a free-list leaf, then the
+ ** backup file on disk is still smaller than the size indicated within
+ ** the database header. In this case, write a page of zeroes to the
+ ** last page of the backup database so that SQLite does not mistakenly
+ ** think the db is corrupt. */
+ if( s.iLastPage<s.nPage ){
+ u8 *aZero = scrubBackupAllocPage(&s);
+ if( aZero ){
+ memset(aZero, 0, s.szPage);
+ scrubBackupWrite(&s, s.nPage, aZero);
+ sqlite3_free(aZero);
+ }
+ }
+
scrub_abort:
/* Close the destination database without closing the transaction. If we
** commit, page zero will be overwritten. */
-C Copy\sthe\scache_spill\ssetting\sfrom\sthe\smain\sdatabase\sover\sto\sthe\nvacuum_db\stransient\sdatabase\swhen\srunning\sa\sVACUUM.
-D 2016-07-26T04:49:43.617
+C Ensure\sthat\sthe\ssqlite3_scrub_backup()\sextension\screates\sa\sbackup\sdatabase\sat\sleast\sas\slarge\sas\sindicated\sby\sthe\sdatabase\sheader,\seven\sif\sthe\slast\spage\sof\sthe\sinput\sdatabase\sis\sa\sfree-list\sleaf.
+D 2016-07-26T10:46:21.988
F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
F ext/misc/regexp.c a68d25c659bd2d893cd1215667bbf75ecb9dc7d4
F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
-F ext/misc/scrub.c ea0903701e3ac02b4466ce9cffd0325c7ddbfcf0
+F ext/misc/scrub.c 1c5bfb8b0cd18b602fcb55755e84abf0023ac2fb
F ext/misc/series.c e11e534ada797d5b816d7e7a93c022306563ca35
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F ext/misc/spellfix.c bf1b922c2750698e9a3d4c50cce6974adb7e93be
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b819bace9c2a0b0159122b26db96a8f50a6f0eac
-R 2279949c9ee671e45067af58637c4ef8
-U drh
-Z ef49efbba33d277501e077ba267218c2
+P c0e7d98ef2a13ede5ae865083ede1aaffdf43310
+R 783c6677056c1c6297ef166e24fadbce
+U dan
+Z 42a389186c57610d077ea553714cade1