Code simplifications in support of structural testing. (CVS 6900)
FossilOrigin-Name: fb1b955dda5105025ef199880afa871e44331d65
This commit is contained in:
parent
e64ca7ba11
commit
f18a61dd59
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Code\ssimplifications\sand\scomment\simprovements\sin\ssupport\sof\sstructural\ncoverage\stesting.\s(CVS\s6899)
|
||||
D 2009-07-16T18:21:18
|
||||
C Code\ssimplifications\sin\ssupport\sof\sstructural\stesting.\s(CVS\s6900)
|
||||
D 2009-07-17T11:44:07
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -105,7 +105,7 @@ F src/attach.c 13995348fc5a26cdd136a50806faf292aabc173f
|
||||
F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
|
||||
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
|
||||
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
|
||||
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
|
||||
F src/btmutex.c f7b059a9b08e1af2dd222bf3cc5c45054af0bba6
|
||||
F src/btree.c 4d964398d7291fd536cd6361c70ccad9c8dc3b9a
|
||||
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
|
||||
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
|
||||
@ -127,7 +127,7 @@ F src/legacy.c 54a11649f27ae55f4fcd6e6b5ba836f839cb8704
|
||||
F src/lempar.c 0c4d1ab0a5ef2b0381eb81a732c54f68f27a574d
|
||||
F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a
|
||||
F src/main.c 4e6d1c2418983cebed436be2996a067f9e1bfe5d
|
||||
F src/malloc.c 70d226282bc6e1eaccb7e2f6872c69ac31f14c94
|
||||
F src/malloc.c 561710bf4b84084e2d047584ab3e7c7094e22a56
|
||||
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
||||
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
||||
F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548
|
||||
@ -152,7 +152,7 @@ F src/pager.h 5aec418bf99f568b92ae82816a1463400513726d
|
||||
F src/parse.y bcd46d43fbd23a22b8c020a3eb1806b794794ed5
|
||||
F src/pcache.c 7d27635a4bd03c81ce848cb186fea6192706fa1a
|
||||
F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324
|
||||
F src/pcache1.c daa2a58a42a3891a5fc1003fad0a704f465eb3b8
|
||||
F src/pcache1.c 6dc833c89feac405dd8b4858232c97e679f182ec
|
||||
F src/pragma.c 9eb44ac1d3dc1ac3ea4f444abe1a10ae8acaa16c
|
||||
F src/prepare.c 12e556fc9f72a6563db7099697f657d75d4bb91c
|
||||
F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1
|
||||
@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
|
||||
P 17c05aefd6c9e938a4cc5d3de348d8c8fdc9394d
|
||||
R eacf63252667dbb069131e999be4c4b5
|
||||
P 945251798144110787b197f9eb552a2dd4a25cb4
|
||||
R 1c8ff9295bcd8f6ec0b813abe7f11af7
|
||||
U drh
|
||||
Z 929c4cc923822b5a2b9ba3adb55fe10b
|
||||
Z a07afaca9e6c4c7b333f6347b1d75539
|
||||
|
@ -1 +1 @@
|
||||
945251798144110787b197f9eb552a2dd4a25cb4
|
||||
fb1b955dda5105025ef199880afa871e44331d65
|
@ -10,7 +10,7 @@
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** $Id: btmutex.c,v 1.15 2009/04/10 12:55:17 danielk1977 Exp $
|
||||
** $Id: btmutex.c,v 1.16 2009/07/17 11:44:07 drh Exp $
|
||||
**
|
||||
** This file contains code used to implement mutexes on Btree objects.
|
||||
** This code really belongs in btree.c. But btree.c is getting too
|
||||
@ -308,8 +308,12 @@ void sqlite3BtreeMutexArrayEnter(BtreeMutexArray *pArray){
|
||||
/* We should already hold a lock on the database connection */
|
||||
assert( sqlite3_mutex_held(p->db->mutex) );
|
||||
|
||||
/* The Btree is sharable because only sharable Btrees are entered
|
||||
** into the array in the first place. */
|
||||
assert( p->sharable );
|
||||
|
||||
p->wantToLock++;
|
||||
if( !p->locked && p->sharable ){
|
||||
if( !p->locked ){
|
||||
lockBtreeMutex(p);
|
||||
}
|
||||
}
|
||||
@ -324,14 +328,14 @@ void sqlite3BtreeMutexArrayLeave(BtreeMutexArray *pArray){
|
||||
Btree *p = pArray->aBtree[i];
|
||||
/* Some basic sanity checking */
|
||||
assert( i==0 || pArray->aBtree[i-1]->pBt<p->pBt );
|
||||
assert( p->locked || !p->sharable );
|
||||
assert( p->locked );
|
||||
assert( p->wantToLock>0 );
|
||||
|
||||
/* We should already hold a lock on the database connection */
|
||||
assert( sqlite3_mutex_held(p->db->mutex) );
|
||||
|
||||
p->wantToLock--;
|
||||
if( p->wantToLock==0 && p->locked ){
|
||||
if( p->wantToLock==0 ){
|
||||
unlockBtreeMutex(p);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
**
|
||||
** Memory allocation functions used throughout sqlite.
|
||||
**
|
||||
** $Id: malloc.c,v 1.65 2009/07/16 18:21:18 drh Exp $
|
||||
** $Id: malloc.c,v 1.66 2009/07/17 11:44:07 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@ -423,9 +423,7 @@ int sqlite3MallocSize(void *p){
|
||||
}
|
||||
int sqlite3DbMallocSize(sqlite3 *db, void *p){
|
||||
assert( db==0 || sqlite3_mutex_held(db->mutex) );
|
||||
if( p==0 ){
|
||||
return 0;
|
||||
}else if( isLookaside(db, p) ){
|
||||
if( isLookaside(db, p) ){
|
||||
return db->lookaside.sz;
|
||||
}else{
|
||||
return sqlite3GlobalConfig.m.xSize(p);
|
||||
|
@ -16,7 +16,7 @@
|
||||
** If the default page cache implementation is overriden, then neither of
|
||||
** these two features are available.
|
||||
**
|
||||
** @(#) $Id: pcache1.c,v 1.18 2009/07/16 18:21:18 drh Exp $
|
||||
** @(#) $Id: pcache1.c,v 1.19 2009/07/17 11:44:07 drh Exp $
|
||||
*/
|
||||
|
||||
#include "sqliteInt.h"
|
||||
@ -218,9 +218,13 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
|
||||
|
||||
/*
|
||||
** 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( p ){
|
||||
if( ALWAYS(p) ){
|
||||
if( p->pCache->bPurgeable ){
|
||||
pcache1.nCurrentPage--;
|
||||
}
|
||||
@ -471,7 +475,14 @@ static int pcache1Pagecount(sqlite3_pcache *p){
|
||||
** Fetch a page by key value.
|
||||
**
|
||||
** Whether or not a new page may be allocated by this function depends on
|
||||
** the value of the createFlag argument.
|
||||
** the value of the createFlag argument. 0 means do not allocate a new
|
||||
** page. 1 means allocate a new page if space is easily available. 2
|
||||
** means to try really hard to allocate a new page.
|
||||
**
|
||||
** For a non-purgeable cache (a cache used as the storage for an in-memory
|
||||
** database) there is really no difference between createFlag 1 and 2. So
|
||||
** the calling function (pcache.c) will never have a createFlag of 1 on
|
||||
** a non-purgable cache.
|
||||
**
|
||||
** There are three different approaches to obtaining space for a page,
|
||||
** depending on the value of parameter createFlag (which may be 0, 1 or 2).
|
||||
@ -482,9 +493,8 @@ static int pcache1Pagecount(sqlite3_pcache *p){
|
||||
** 2. If createFlag==0 and the page is not already in the cache, NULL is
|
||||
** returned.
|
||||
**
|
||||
** 3. If createFlag is 1, the cache is marked as purgeable and the page is
|
||||
** not already in the cache, and if either of the following are true,
|
||||
** return NULL:
|
||||
** 3. If createFlag is 1, and the page is not already in the cache,
|
||||
** and if either of the following are true, return NULL:
|
||||
**
|
||||
** (a) the number of pages pinned by the cache is greater than
|
||||
** PCache1.nMax, or
|
||||
@ -513,6 +523,7 @@ static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){
|
||||
PCache1 *pCache = (PCache1 *)p;
|
||||
PgHdr1 *pPage = 0;
|
||||
|
||||
assert( pCache->bPurgeable || createFlag!=1 );
|
||||
pcache1EnterMutex();
|
||||
if( createFlag==1 ) sqlite3BeginBenignMalloc();
|
||||
|
||||
@ -529,7 +540,7 @@ static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){
|
||||
|
||||
/* Step 3 of header comment. */
|
||||
nPinned = pCache->nPage - pCache->nRecyclable;
|
||||
if( createFlag==1 && pCache->bPurgeable && (
|
||||
if( createFlag==1 && (
|
||||
nPinned>=(pcache1.nMaxPage+pCache->nMin-pcache1.nMinPage)
|
||||
|| nPinned>=(pCache->nMax * 9 / 10)
|
||||
)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user