mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Simplify the pcache by not keeping continuous track of page 1 but instead
just loading page 1 on the rare occasions when it is actually needed. FossilOrigin-Name: 015302f15e46a087ec92f3644c6741600dbf4306
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C Optimization\sto\ssqlite3_value_bytes()\sfor\sthe\scommon\scase\sthat\sdoes\snot\nrequire\sa\sdata\stransformation.
|
||||
D 2015-06-25T23:52:48.104
|
||||
C Simplify\sthe\spcache\sby\snot\skeeping\scontinuous\strack\sof\spage\s1\sbut\sinstead\njust\sloading\spage\s1\son\sthe\srare\soccasions\swhen\sit\sis\sactually\sneeded.
|
||||
D 2015-06-26T02:41:31.913
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -240,7 +240,7 @@ F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c 9bc918a009285f96ec6dac62dd764c7063552455
|
||||
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
|
||||
F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8
|
||||
F src/pcache.c 10539fb959849ad6efff80050541cab3d25089d4
|
||||
F src/pcache.c d8b19632706dd6b81b03d0c5fd1e6bab8c13d0b9
|
||||
F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8
|
||||
F src/pcache1.c 8e3799b33c41d517d86444d4abefc80d4f02adca
|
||||
F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7
|
||||
@@ -1286,7 +1286,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 7d02e6c992ef92e1f77ebc13889e17c028454b06
|
||||
R 055499679190be686aed6dd5c50e96a1
|
||||
P 8d79f3a1443391bee204bb8c49240f44477168db
|
||||
R c56e8779f6e8f4f9de88fc3a0bf56b01
|
||||
U drh
|
||||
Z a43ea71012a447eaba4e577595223851
|
||||
Z 87d94359f0bb80945f07f56dd11de5b2
|
||||
|
||||
@@ -1 +1 @@
|
||||
8d79f3a1443391bee204bb8c49240f44477168db
|
||||
015302f15e46a087ec92f3644c6741600dbf4306
|
||||
22
src/pcache.c
22
src/pcache.c
@@ -28,7 +28,6 @@ struct PCache {
|
||||
int (*xStress)(void*,PgHdr*); /* Call to try make a page clean */
|
||||
void *pStress; /* Argument to xStress */
|
||||
sqlite3_pcache *pCache; /* Pluggable cache module */
|
||||
PgHdr *pPage1; /* Reference to page 1 */
|
||||
};
|
||||
|
||||
/********************************** Linked List Management ********************/
|
||||
@@ -106,9 +105,6 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){
|
||||
*/
|
||||
static void pcacheUnpin(PgHdr *p){
|
||||
if( p->pCache->bPurgeable ){
|
||||
if( p->pgno==1 ){
|
||||
p->pCache->pPage1 = 0;
|
||||
}
|
||||
sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +197,6 @@ int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
|
||||
sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
|
||||
}
|
||||
pCache->pCache = pNew;
|
||||
pCache->pPage1 = 0;
|
||||
pCache->szPage = szPage;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
@@ -359,9 +354,6 @@ PgHdr *sqlite3PcacheFetchFinish(
|
||||
pCache->nRef++;
|
||||
}
|
||||
pPgHdr->nRef++;
|
||||
if( pgno==1 ){
|
||||
pCache->pPage1 = pPgHdr;
|
||||
}
|
||||
return pPgHdr;
|
||||
}
|
||||
|
||||
@@ -402,9 +394,6 @@ void sqlite3PcacheDrop(PgHdr *p){
|
||||
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
|
||||
}
|
||||
p->pCache->nRef--;
|
||||
if( p->pgno==1 ){
|
||||
p->pCache->pPage1 = 0;
|
||||
}
|
||||
sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1);
|
||||
}
|
||||
|
||||
@@ -495,9 +484,14 @@ void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
|
||||
sqlite3PcacheMakeClean(p);
|
||||
}
|
||||
}
|
||||
if( pgno==0 && pCache->pPage1 ){
|
||||
memset(pCache->pPage1->pData, 0, pCache->szPage);
|
||||
pgno = 1;
|
||||
if( pgno==0 && pCache->nRef ){
|
||||
sqlite3_pcache_page *pPage1;
|
||||
pPage1 = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0);
|
||||
if( ALWAYS(pPage1) ){ /* Page 1 is always available in cache, because
|
||||
** pCache->nRef>0 */
|
||||
memset(pPage1->pBuf, 0, pCache->szPage);
|
||||
pgno = 1;
|
||||
}
|
||||
}
|
||||
sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user