From: dan Date: Wed, 19 Aug 2015 08:34:34 +0000 (+0000) Subject: When updating a zipvfs database with RBU, set journal_mode=off to prevent the upper... X-Git-Tag: version-3.9.0~218 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ef2b281aa6fed9a45b8bbe20a5f26c9a03cc677;p=thirdparty%2Fsqlite.git When updating a zipvfs database with RBU, set journal_mode=off to prevent the upper-level pager from creating a large temporary file. FossilOrigin-Name: dec14a3980dcf6c61b0b9ac4ba82fa963ac346d4 --- diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c index 403d4ebdcb..7c7480bcfc 100644 --- a/ext/rbu/sqlite3rbu.c +++ b/ext/rbu/sqlite3rbu.c @@ -3043,14 +3043,25 @@ sqlite3rbu *sqlite3rbu_open( if( p->rc==SQLITE_OK ){ if( p->eStage==RBU_STAGE_OAL ){ + sqlite3 *db = p->dbMain; /* Open transactions both databases. The *-oal file is opened or ** created at this point. */ - p->rc = sqlite3_exec(p->dbMain, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); + p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); if( p->rc==SQLITE_OK ){ p->rc = sqlite3_exec(p->dbRbu, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); } - + + /* Check if the main database is a zipvfs db. If it is, set the upper + ** level pager to use "journal_mode=off". This prevents it from + ** generating a large journal using a temp file. */ + if( p->rc==SQLITE_OK ){ + int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); + if( frc==SQLITE_OK ){ + p->rc = sqlite3_exec(db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); + } + } + /* Point the object iterator at the first object */ if( p->rc==SQLITE_OK ){ p->rc = rbuObjIterFirst(p, &p->objiter); diff --git a/manifest b/manifest index e8d8f571a1..6862daf1ee 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\sfile\sspellfix2.test,\swhich\sshould\shave\sbeen\schecked\sin\ssome\stime\sago. -D 2015-08-18T19:09:28.809 +C When\supdating\sa\szipvfs\sdatabase\swith\sRBU,\sset\sjournal_mode=off\sto\sprevent\sthe\supper-level\spager\sfrom\screating\sa\slarge\stemporary\sfile. +D 2015-08-19T08:34:34.195 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2fc9ca6bf5949d415801c007ed3004a4bdb7c380 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -224,7 +224,7 @@ F ext/rbu/rbufault.test cc0be8d5d392d98b0c2d6a51be377ea989250a89 F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06 F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48 -F ext/rbu/sqlite3rbu.c 08fddeae6b89aeb1e960f9330a2228968210170a +F ext/rbu/sqlite3rbu.c 1650e682b3568db0ed97ff2c7ba5d1c8ea060a84 F ext/rbu/sqlite3rbu.h 5357f070cd8c0bcad459b620651ec1656859e4d0 F ext/rbu/test_rbu.c 2a3652241fa45d5eaa141775e4ae68c1d3582c03 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 @@ -1374,7 +1374,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 02448a9fccd4532daa667e4ba6ff1dbb7f68008a -R e8ec4f5131e6ed0a1e842df7f619d541 +P 8599402092537ab3df8926eb900661c12d738d4c +R 79cd53df2dc51b1e184555145183f89d U dan -Z 8dc6a1f25685915b0d47708aa8d01a68 +Z 080d9b0837b12f78f74559ebadf2ade0 diff --git a/manifest.uuid b/manifest.uuid index 5d84140b43..959045fb7f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8599402092537ab3df8926eb900661c12d738d4c \ No newline at end of file +dec14a3980dcf6c61b0b9ac4ba82fa963ac346d4 \ No newline at end of file