From: drh Date: Thu, 12 Nov 2015 16:44:40 +0000 (+0000) Subject: Enhance the "PRAGMA cache_spill" statement to accept an integer argument which X-Git-Tag: version-3.10.0~143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2e0dd4ddd81abbbb25200495df450afa794b9b6;p=thirdparty%2Fsqlite.git Enhance the "PRAGMA cache_spill" statement to accept an integer argument which is the threshold at which spilling will begin. FossilOrigin-Name: f79d264db24a470d1a4571e15a99cd3d68b5166c --- c2e0dd4ddd81abbbb25200495df450afa794b9b6 diff --cc manifest index 0565883d76,1b21bffde4..06f06b267c --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Fix\sa\s#define\sin\sparse.y\sthat\sdisabled\sunused\scode\sin\sthe\sgenerated\sparser. - D 2015-11-12T15:04:05.278 -C Test\scases.\s\sMinor\sproblems\sfixed.\s\sAll\sappears\sto\swork\snow. -D 2015-11-12T15:47:48.274 ++C Enhance\sthe\s"PRAGMA\scache_spill"\sstatement\sto\saccept\san\sinteger\sargument\swhich\nis\sthe\sthreshold\sat\swhich\sspilling\swill\sbegin. ++D 2015-11-12T16:44:40.812 F Makefile.in d828db6afa6c1fa060d01e33e4674408df1942a1 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc e928e68168df69b353300ac87c10105206653a03 @@@ -326,14 -326,14 +326,14 @@@ F src/os_setup.h c9d4553b5aaa6f73391448 F src/os_unix.c cf72e06e15839ebe7121e01d3eebf256c039b0ca F src/os_win.c 1716291e5ec2dbfc5a1fe0b32182030f1f7d8acf F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca - F src/pager.c ed5cff11793b6a4146582aabb29ed8613a6cf89e - F src/pager.h 7fc069c07f3120ee466ff3d48a9d376974ebffa7 + F src/pager.c 18341e2b759b447cbc82fb9215d08d9c5864e92e + F src/pager.h 87c4118a71ba3965184148b379a6d93179071091 -F src/parse.y 8a364a7a692e517dea8711b3c7f0d07fe32727d8 +F src/parse.y aad5cc866dc23719f361fe7e0b8eaec8ce4861a4 - F src/pcache.c 24be750c79272e0ca7b6e007bc94999700f3e5ef - F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9 + F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23 + F src/pcache.h 1ff11adce609ba7de139b6abfabaf9a2bac947b5 F src/pcache1.c 902e1bc7bdaa81b40f8543407c5e2ac8ef4dc035 - F src/pragma.c 9dbb9ba2453d79bfc5905be0398aa30342b066bb - F src/pragma.h 631a91c8b0e6ca8f051a1d8a4a0da4150e04620a -F src/pragma.c 0e91830e5cea31771121eb8967e8c110f7e8216a ++F src/pragma.c 56161e4aa4891a45b534f6516acb343df15a5120 + F src/pragma.h 31b110aaecb5603829c97747b99abfe491df5fa0 F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1 F src/printf.c 0c4bcdd1c2e2521024f0a69cb5eb334f86b3652a F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 @@@ -1402,7 -1402,7 +1402,8 @@@ F tool/vdbe_profile.tcl 246d0da094856d7 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f - P ed24d302657e8495bef7f5ed698c7cca12717be9 - R d2bed45a676ff9fbad30132bc7912ff2 -P 549d42be0dac87dc04c3eeccfdc60615c3a6ad3f -R 675bbffc41ae7c4e7c58162bf39590a3 ++P f84e3085c87cfffe4aba0eb4c4a3298b4027db83 9a431362dccbc9b8f93375f30a3b8955903cca79 ++R 5f87cb60f8f27cae7787baa81cd88247 ++T +closed 9a431362dccbc9b8f93375f30a3b8955903cca79 U drh - Z 9ab7252fe5fcd6a0ff588f1afe46df1d -Z 4ec2916143a078881954f66921bb963f ++Z c0a66dbf9634d84e657f233ea4ee622f diff --cc manifest.uuid index 6e51c4b405,27ce563ab6..9052b6aab8 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - f84e3085c87cfffe4aba0eb4c4a3298b4027db83 -9a431362dccbc9b8f93375f30a3b8955903cca79 ++f79d264db24a470d1a4571e15a99cd3d68b5166c diff --cc src/pragma.c index a0e394f782,7754e26c89..792f4f7e32 --- a/src/pragma.c +++ b/src/pragma.c @@@ -747,7 -747,51 +747,50 @@@ void sqlite3Pragma } /* - ** PRAGMA [database.]mmap_size(N) + ** PRAGMA [schema.]cache_spill + ** PRAGMA cache_spill=BOOLEAN + ** PRAGMA [schema.]cache_spill=N + ** + ** The first form reports the current local setting for the + ** page cache spill size. The second form turns cache spill on + ** or off. When turnning cache spill on, the size is set to the + ** current cache_size. The third form sets a spill size that + ** may be different form the cache size. + ** If N is positive then that is the + ** number of pages in the cache. If N is negative, then the + ** number of pages is adjusted so that the cache uses -N kibibytes + ** of memory. + ** + ** If the number of cache_spill pages is less then the number of + ** cache_size pages, no spilling occurs until the page count exceeds + ** the number of cache_size pages. + ** + ** The cache_spill=BOOLEAN setting applies to all attached schemas, + ** not just the schema specified. + */ + case PragTyp_CACHE_SPILL: { + assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); + if( !zRight ){ - if( sqlite3ReadSchema(pParse) ) goto pragma_out; + returnSingleInt(v, "cache_spill", + (db->flags & SQLITE_CacheSpill)==0 ? 0 : + sqlite3BtreeSetSpillSize(pDb->pBt,0)); + }else{ + int size = 1; + if( sqlite3GetInt32(zRight, &size) ){ + sqlite3BtreeSetSpillSize(pDb->pBt, size); + } + if( sqlite3GetBoolean(zRight, size!=0) ){ + db->flags |= SQLITE_CacheSpill; + }else{ + db->flags &= ~SQLITE_CacheSpill; + } + setAllPagerFlags(db); + } + break; + } + + /* + ** PRAGMA [schema.]mmap_size(N) ** ** Used to set mapping size limit. The mapping size limit is ** used to limit the aggregate size of all memory mapped regions of the