-C Add\sa\scomment\sto\sxUnfetch\son\swindows\sto\ssay\sthat\sthe\scall\sto\swinUnmapfile()\nmight\sbe\sunnecessary.
-D 2013-04-01T18:25:48.030
+C Add\sthe\sSQLITE_CONFIG_MMAP_LIMIT\sconfiguration\soption\sfor\soverriding\sthe\nSQLITE_DEFAULT_MMAP_LIMIT\scompile-time\ssetting.\s\sEnhance\s"PRAGMA\smmap_limit"\nso\sthat\swithout\sa\sspecific\sdatabase\sname,\sit\ssets\sthe\slimit\son\sall\sdatabase\nfiles\sand\schanges\sthe\sdefault\sfor\sany\sfuture\sdatabases\sthat\smight\sbe\sadded\nusing\sATTACH.
+D 2013-04-01T22:38:06.929
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/backup.c b2cac9f7993f3f9588827b824b1501d0c820fa68
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
-F src/btree.c 84c9a4a20b827a6f7dbcbcda59607dbee57af446
+F src/btree.c bb679fddb7269dd7cfb950f845b1b18f19df4f4a
F src/btree.h d9490cd37aaeb530a41b07f06e1262950b1be916
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
F src/build.c 083da8466fd7e481cb8bd5264398f537507f6176
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179
F src/func.c 48987c025d69399f59a1c2a553cea5da41bf105d
-F src/global.c e59ecd2c553ad0d4bfbc84ca71231336f8993a7a
+F src/global.c d2494a1cea8f66a2cab8258449df07f8f0ae6330
F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
F src/loadext.c 1422eba4aa2b1fb5f7b3aef574752272477d21e2
-F src/main.c 379160ec3680e3009aa4978eac47027c3ef27ac5
+F src/main.c 54a841854734b6731c4d026834788cac6a19f3d1
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d
F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
-F src/os_unix.c d136eca0cff2f8a5ac2f45867d5e5153d60e377c
+F src/os_unix.c 9912ab0cfcd7fa2b058544d861a9fead3adac8da
F src/os_win.c a2f41c9dfb9b065285ba94d4a40a31ca2e2b6ea3
-F src/pager.c 2b9980e87296812a6ce51121a3335550ae25e3ec
+F src/pager.c 072512d05dacd61b1f147736825bd32fdc890ba4
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
F src/parse.y 5d5e12772845805fdfeb889163516b84fbb9ae95
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9
-F src/pragma.c 8875d32d54530300e6aa31a9d5426b2088a69b12
+F src/pragma.c d0231f412dea33c35c1309b45b535cf0c10c63c8
F src/prepare.c 310eaff1ee5f3c700b3545afb095cfe9346efc3a
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c 01540bcd3df3c8f1187158e77986028b1c667258
F src/shell.c 7c41bfcd9e5bf9d96b9215f79b03a5b2b44a3bca
-F src/sqlite.h.in 921ba42ec3531fe8cf021492ffd781b161383f1b
+F src/sqlite.h.in 42c69ea00dfcce84394d6ce0d8dac7bb3d2ecff2
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 7183ab832e23db0f934494f16928da127a571d75
-F src/sqliteInt.h 0f8f05ee4db4ba9120b38f7a3992b325698f6e8a
+F src/sqliteInt.h 1664dc5ad6f8d4dab871416628aa3271044d66c0
F src/sqliteLimit.h 83d0cd0ce3050a80930406d3c7aecb48c1ccdfc5
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 0e44ed1badde6d766f18d1373d968e5b286b15bd
-R 8c3ade0fe410bf8f08819b27491eb958
+P e3c63c31a21b27806592d066a013a111b280c61f
+R 6d1c950d2134f5ef56d487146725ba7a
U drh
-Z 1d97c5c3c6a55788c16fe769f3e976ae
+Z 72c1547cadf3e5127066e34139489015
-e3c63c31a21b27806592d066a013a111b280c61f
\ No newline at end of file
+78141d0a16dd1d56b575fccd149de7fa789cb06c
\ No newline at end of file
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
EXTRA_SIZE, flags, vfsFlags, pageReinit);
if( rc==SQLITE_OK ){
+ sqlite3PagerSetMmapLimit(pBt->pPager, db->mxMmap);
rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
}
if( rc!=SQLITE_OK ){
(void*)0, /* pHeap */
0, /* nHeap */
0, 0, /* mnHeap, mxHeap */
+ SQLITE_DEFAULT_MMAP_LIMIT, /* mxMmap */
(void*)0, /* pScratch */
0, /* szScratch */
0, /* nScratch */
}
#endif
+ case SQLITE_CONFIG_MMAP_LIMIT: {
+ sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
+ if( mxMmap<0 ) mxMmap = SQLITE_DEFAULT_MMAP_LIMIT;
+ sqlite3GlobalConfig.mxMmap = mxMmap;
+ break;
+ }
+
default: {
rc = SQLITE_ERROR;
break;
memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
db->autoCommit = 1;
db->nextAutovac = -1;
+ db->mxMmap = sqlite3GlobalConfig.mxMmap;
db->nextPagesize = 0;
db->flags |= SQLITE_ShortColNames | SQLITE_AutoIndex | SQLITE_EnableTrigger
#if SQLITE_DEFAULT_FILE_FORMAT<4
}
case SQLITE_FCNTL_MMAP_LIMIT: {
pFile->mmapLimit = *(i64*)pArg;
+printf("MMAP-LIMIT(%s) -> %lld\n", pFile->zPath, pFile->mmapLimit);
return SQLITE_OK;
}
#ifdef SQLITE_DEBUG
/* pPager->pBusyHandlerArg = 0; */
pPager->xReiniter = xReinit;
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
- pPager->mxMmap = SQLITE_DEFAULT_MMAP_LIMIT;
+ /* pPager->mxMmap = SQLITE_DEFAULT_MMAP_LIMIT // will be set by btree.c */
*ppPager = pPager;
return SQLITE_OK;
** Used to set mapping size limit. The mapping size limit is
** used to limit the aggregate size of all memory mapped regions of the
** database file. If this parameter is set to zero, then memory mapping
- ** is not used at all. The parameter N is measured in bytes.
+ ** is not used at all. If N is negative, then the default memory map
+ ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_LIMIT) is set.
+ ** The parameter N is measured in bytes.
**
** This value is advisory. The underlying VFS is free to memory map
** as little or as much as it wants. Except, if N is set to 0 then the
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
if( zRight ){
sqlite3_int64 size;
+ int ii;
sqlite3Atoi64(zRight, &size, 1000, SQLITE_UTF8);
- sqlite3BtreeSetMmapLimit(pDb->pBt, size);
+ if( size<0 ) size = sqlite3GlobalConfig.mxMmap;
+ if( pId2->n==0 ) db->mxMmap = size;
+ for(ii=db->nDb-1; ii>=0; ii--){
+ if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
+ sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, size);
+ }
+ }
}
}else
** points to has just been executed. Or, if the fourth parameter is 2, then
** the connection being passed as the second parameter is being closed. The
** third parameter is passed NULL In this case.
+**
+** [[SQLITE_CONFIG_MMAP_LIMIT]]
+** <dt>SQLITE_CONFIG_MMAP_LIMIT
+** <dd>The sole argument should be a 64-bit integer (an sqlite3_int64) that
+** is the default maximum number of bytes of process address space that
+** should be used for accessing each database file using memory mapping.
+** The default setting can be overridden by each database connection using
+** either the [PRAGMA mmap_limit] command or the "mmaplimit" query parameter
+** on the [URI filename] when opening the databaes file or by using the
+** [SQLITE_FCNTL_MMAP_LIMIT] file control. The value set here overrides the
+** compile-time default that is set using the [SQLITE_DEFAULT_MMAP_LIMIT]
+** compile-time option. If the argument to this option is negative, then
+** the memory map limit is set to the compile-time default.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
+#define SQLITE_CONFIG_MMAP_LIMIT 22 /* sqlite3_int64 */
/*
** CAPI3REF: Database Connection Configuration Options
int nDb; /* Number of backends currently in use */
int flags; /* Miscellaneous flags. See below */
i64 lastRowid; /* ROWID of most recent insert (see above) */
+ i64 mxMmap; /* Default mmap_limit setting */
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
int errCode; /* Most recent error code (SQLITE_*) */
int errMask; /* & result codes with this before returning */
void *pHeap; /* Heap storage space */
int nHeap; /* Size of pHeap[] */
int mnReq, mxReq; /* Min and max heap requests sizes */
+ sqlite3_int64 mxMmap; /* Maximum mmap() space per open file */
void *pScratch; /* Scratch memory */
int szScratch; /* Size of each scratch buffer */
int nScratch; /* Number of scratch buffers */