Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove the SQLITE_PAGECACHE_BLOCKALLOC compilation option. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4eb4689834b538b9eeec5a5803528260 |
User & Date: | dan 2011-09-22 14:56:31.229 |
Context
2011-09-22
| ||
15:31 | Remove a redundant (and undefined) "forcedelete" command from corruptE.test. (check-in: 6d8d4e1694 user: dan tags: trunk) | |
14:56 | Remove the SQLITE_PAGECACHE_BLOCKALLOC compilation option. (check-in: 4eb4689834 user: dan tags: trunk) | |
14:41 | Add the SQLITE_DB_STATUS_CACHE_HIT and MISS options. For querying the number of cache hits and misses on a per-connection basis. (check-in: 5100b6e9dc user: dan tags: trunk) | |
Changes
Changes to src/ctime.c.
︙ | ︙ | |||
325 326 327 328 329 330 331 | #endif #ifdef SQLITE_OMIT_WSD "OMIT_WSD", #endif #ifdef SQLITE_OMIT_XFER_OPT "OMIT_XFER_OPT", #endif | < < < | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | #endif #ifdef SQLITE_OMIT_WSD "OMIT_WSD", #endif #ifdef SQLITE_OMIT_XFER_OPT "OMIT_XFER_OPT", #endif #ifdef SQLITE_PERFORMANCE_TRACE "PERFORMANCE_TRACE", #endif #ifdef SQLITE_PROXY_DEBUG "PROXY_DEBUG", #endif #ifdef SQLITE_SECURE_DELETE |
︙ | ︙ |
Changes to src/pcache1.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "sqliteInt.h" typedef struct PCache1 PCache1; typedef struct PgHdr1 PgHdr1; typedef struct PgFreeslot PgFreeslot; typedef struct PGroup PGroup; | < < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "sqliteInt.h" typedef struct PCache1 PCache1; typedef struct PgHdr1 PgHdr1; typedef struct PgFreeslot PgFreeslot; typedef struct PGroup PGroup; /* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set ** of one or more PCaches that are able to recycle each others unpinned ** pages when they are under memory pressure. A PGroup is an instance of ** the following object. ** ** This page cache implementation works in one of two modes: |
︙ | ︙ | |||
52 53 54 55 56 57 58 | struct PGroup { sqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */ int nMaxPage; /* Sum of nMax for purgeable caches */ int nMinPage; /* Sum of nMin for purgeable caches */ int mxPinned; /* nMaxpage + 10 - nMinPage */ int nCurrentPage; /* Number of purgeable pages allocated */ PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | struct PGroup { sqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */ int nMaxPage; /* Sum of nMax for purgeable caches */ int nMinPage; /* Sum of nMin for purgeable caches */ int mxPinned; /* nMaxpage + 10 - nMinPage */ int nCurrentPage; /* Number of purgeable pages allocated */ PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */ }; /* Each page cache is an instance of the following object. Every ** open database file (including each in-memory database and each ** temporary or transient database) has a single page cache which ** is an instance of this object. ** ** Pointers to structures of this type are cast and returned as |
︙ | ︙ | |||
214 215 216 217 218 219 220 | ** a pointer to a block of szPage bytes of data and the return value is ** a pointer to the associated PgHdr1 structure. ** ** assert( PGHDR1_TO_PAGE(PAGE_TO_PGHDR1(pCache, X))==X ); */ #define PGHDR1_TO_PAGE(p) (void*)(((char*)p) - p->pCache->szPage) #define PAGE_TO_PGHDR1(c, p) (PgHdr1*)(((char*)p) + c->szPage) | < < < < < < < < < < < | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | ** a pointer to a block of szPage bytes of data and the return value is ** a pointer to the associated PgHdr1 structure. ** ** assert( PGHDR1_TO_PAGE(PAGE_TO_PGHDR1(pCache, X))==X ); */ #define PGHDR1_TO_PAGE(p) (void*)(((char*)p) - p->pCache->szPage) #define PAGE_TO_PGHDR1(c, p) (PgHdr1*)(((char*)p) + c->szPage) /* ** Macros to enter and leave the PCache LRU mutex. */ #define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex) #define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex) |
︙ | ︙ | |||
351 352 353 354 355 356 357 | iSize = sqlite3MallocSize(p); sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); return iSize; } } #endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | iSize = sqlite3MallocSize(p); sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); return iSize; } } #endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */ /* ** Allocate a new page object initially associated with cache pCache. */ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ int nByte = sizeof(PgHdr1) + pCache->szPage; PgHdr1 *p = 0; void *pPg; /* The group mutex must be released before pcache1Alloc() is called. This ** is because it may call sqlite3_release_memory(), which assumes that ** this mutex is not held. */ assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); pcache1LeaveMutex(pCache->pGroup); pPg = pcache1Alloc(nByte); pcache1EnterMutex(pCache->pGroup); if( pPg ){ p = PAGE_TO_PGHDR1(pCache, pPg); if( pCache->bPurgeable ){ pCache->pGroup->nCurrentPage++; } } return p; } /* ** Free a page object allocated by pcache1AllocPage(). ** ** The pointer is allowed to be NULL, which is prudent. But it turns out ** that the current implementation happens to never call this routine ** with a NULL pointer, so we mark the NULL test with ALWAYS(). */ static void pcache1FreePage(PgHdr1 *p){ if( ALWAYS(p) ){ PCache1 *pCache = p->pCache; assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) ); pcache1Free(PGHDR1_TO_PAGE(p)); if( pCache->bPurgeable ){ pCache->pGroup->nCurrentPage--; } } } /* |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | ** ** nReq is the number of bytes of memory required. Once this much has ** been released, the function returns. The return value is the total number ** of bytes of memory released. */ int sqlite3PcacheReleaseMemory(int nReq){ int nFree = 0; | < < < | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | ** ** nReq is the number of bytes of memory required. Once this much has ** been released, the function returns. The return value is the total number ** of bytes of memory released. */ int sqlite3PcacheReleaseMemory(int nReq){ int nFree = 0; assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); assert( sqlite3_mutex_notheld(pcache1.mutex) ); if( pcache1.pStart==0 ){ PgHdr1 *p; pcache1EnterMutex(&pcache1.grp); while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){ nFree += pcache1MemSize(PGHDR1_TO_PAGE(p)); |
︙ | ︙ |
Changes to src/test_config.c.
︙ | ︙ | |||
551 552 553 554 555 556 557 | #ifdef YYTRACKMAXSTACKDEPTH Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY); #endif | < < < < < < | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | #ifdef YYTRACKMAXSTACKDEPTH Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY); #endif #define LINKVAR(x) { \ static const int cv_ ## x = SQLITE_ ## x; \ Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ TCL_LINK_INT | TCL_LINK_READ_ONLY); } LINKVAR( MAX_LENGTH ); LINKVAR( MAX_COLUMN ); |
︙ | ︙ |
Changes to test/ctime.test.
︙ | ︙ | |||
218 219 220 221 222 223 224 | # test 1 before array bounds (N=-1) do_test ctime-2.5.$tc { set N -1 set ans [ catchsql { SELECT sqlite_compileoption_get($N); } ] } {0 {{}}} | < < < < < < < < < < < | 218 219 220 221 222 223 224 225 226 227 | # test 1 before array bounds (N=-1) do_test ctime-2.5.$tc { set N -1 set ans [ catchsql { SELECT sqlite_compileoption_get($N); } ] } {0 {{}}} finish_test |
Changes to test/memdb.test.
︙ | ︙ | |||
403 404 405 406 407 408 409 | DELETE FROM t1; SELECT count(*) FROM t1; } } 0 # Test that auto-vacuum works with in-memory databases. # | | | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | DELETE FROM t1; SELECT count(*) FROM t1; } } 0 # Test that auto-vacuum works with in-memory databases. # ifcapable autovacuum { do_test memdb-9.1 { db close sqlite3 db test.db db cache size 0 execsql { PRAGMA auto_vacuum = full; CREATE TABLE t1(a); |
︙ | ︙ |
Changes to test/memsubsys1.test.
︙ | ︙ | |||
21 22 23 24 25 26 27 | # will not work with the "memsubsys1" permutation. # if {[permutation] == "memsubsys1"} { finish_test return } | < < < < < < < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # will not work with the "memsubsys1" permutation. # if {[permutation] == "memsubsys1"} { finish_test return } # This procedure constructs a new database in test.db. It fills # this database with many small records (enough to force multiple # rebalance operations in the btree-layer and to require a large # page cache), verifies correct results, then returns. # proc build_test_db {testname pragmas} { catch {db close} |
︙ | ︙ |
Changes to test/pcache2.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file is focused on testing the pcache module. # # $Id: pcache2.test,v 1.5 2009/07/18 14:36:24 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl | < < < < < < < < | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file is focused on testing the pcache module. # # $Id: pcache2.test,v 1.5 2009/07/18 14:36:24 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Set up a pcache memory pool so that we can easily track how many # pages are being used for cache. # do_test pcache2-1.1 { db close sqlite3_reset_auto_extension sqlite3_shutdown |
︙ | ︙ |