-C Remove\san\sunused\svariable\sfrom\ssqlite3ExprListDup().\s\sTicket\s#3973.\s(CVS\s6898)
-D 2009-07-16T12:41:06
+C Code\ssimplifications\sand\scomment\simprovements\sin\ssupport\sof\sstructural\ncoverage\stesting.\s(CVS\s6899)
+D 2009-07-16T18:21:18
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
-F src/btree.c 7e2ecefda6cecffd8754e574410f633da7cb2da2
+F src/btree.c 4d964398d7291fd536cd6361c70ccad9c8dc3b9a
F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
F src/lempar.c 0c4d1ab0a5ef2b0381eb81a732c54f68f27a574d
F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a
F src/main.c 4e6d1c2418983cebed436be2996a067f9e1bfe5d
-F src/malloc.c 16907f3b9d3f56e2c69d763ff18d9ee49e7433cd
+F src/malloc.c 70d226282bc6e1eaccb7e2f6872c69ac31f14c94
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548
F src/mem3.c 67153ec933e08b70714055e872efb58a6b287939
F src/mem5.c 838309b521c96a2a34507f74a5a739d28de4aac6
F src/memjournal.c e68cb5f7e828b84d5bf2ea16c5d87f1ed7e9fe7f
-F src/mutex.c 5e2ea0e0490a3567dc08a014bcee748c0cea727f
+F src/mutex.c 73899d158560117c02909b6e9ffe2bad2560a817
F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f
F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0
F src/pager.c 283d4e9c64d4a4555a9a15cf870180b4fc102f7e
F src/pager.h 5aec418bf99f568b92ae82816a1463400513726d
F src/parse.y bcd46d43fbd23a22b8c020a3eb1806b794794ed5
-F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d
+F src/pcache.c 7d27635a4bd03c81ce848cb186fea6192706fa1a
F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324
-F src/pcache1.c 97e7e8e6e34026fb43b47d08532b0c02e959c26c
+F src/pcache1.c daa2a58a42a3891a5fc1003fad0a704f465eb3b8
F src/pragma.c 9eb44ac1d3dc1ac3ea4f444abe1a10ae8acaa16c
F src/prepare.c 12e556fc9f72a6563db7099697f657d75d4bb91c
F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1
F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
F src/tclsqlite.c e18e5013dc6bca9f25e6022fbe17ba3ccb821f95
F src/test1.c c8f9358879876660b721369f576bf6e4ac5b9210
-F src/test2.c d73e4a490349245fb196b990b80684513e0ceaee
+F src/test2.c d7d7907cec3ed918b3b35e8e44fb3de3709d9509
F src/test3.c 2445c2beb5e7a0c91fd8136dc1339ec369a24898
F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
F src/test5.c 162a1cea2105a2c460a3f39fa6919617b562a288
F test/misc4.test 91e8ed25c092c2bb4e0bb01864631e2930f8d7de
F test/misc5.test 6a5c1e3217a95b0db05ff9a0f1ecb5ce9043ffef
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
-F test/misc7.test debcd7dbfd847ae97b16ceb7fec6f567902874a6
+F test/misc7.test c5f4e6a82e04e71820c0f9f64f6733f04c8ae0ae
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/mutex1.test 5b71777fc127509cd257910c8db799de557a02de
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 6242db39f7f4ead5017bf684139d1f8312799f81
-R a3cf7fcfc25ee4fb5320c7c0dd02a2d0
+P 17c05aefd6c9e938a4cc5d3de348d8c8fdc9394d
+R eacf63252667dbb069131e999be4c4b5
U drh
-Z d63993f78c2605b7a463f91faa166797
+Z 929c4cc923822b5a2b9ba3adb55fe10b
-17c05aefd6c9e938a4cc5d3de348d8c8fdc9394d
\ No newline at end of file
+945251798144110787b197f9eb552a2dd4a25cb4
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.690 2009/07/15 18:15:23 drh Exp $
+** $Id: btree.c,v 1.691 2009/07/16 18:21:18 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
/*
** Move the open database page pDbPage to location iFreePage in the
** database. The pDbPage reference remains valid.
+**
+** The isCommit flag indicates that there is no need to remember that
+** the journal needs to be sync()ed before database page pDbPage->pgno
+** can be written to. The caller has already promised not to write to that
+** page.
*/
static int relocatePage(
BtShared *pBt, /* Btree */
u8 eType, /* Pointer map 'type' entry for pDbPage */
Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */
Pgno iFreePage, /* The location to move pDbPage to */
- int isCommit
+ int isCommit /* isCommit flag passed to sqlite3PagerMovepage */
){
MemPage *pPtrPage; /* The page that contains a pointer to pDbPage */
Pgno iDbPage = pDbPage->pgno;
**
** Memory allocation functions used throughout sqlite.
**
-** $Id: malloc.c,v 1.64 2009/06/27 00:48:33 drh Exp $
+** $Id: malloc.c,v 1.65 2009/07/16 18:21:18 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
** The alarm callback and its arguments. The mem0.mutex lock will
** be held while the callback is running. Recursive calls into
** the memory subsystem are allowed, but no new callbacks will be
- ** issued. The alarmBusy variable is set to prevent recursive
- ** callbacks.
+ ** issued.
*/
sqlite3_int64 alarmThreshold;
void (*alarmCallback)(void*, sqlite3_int64,int);
void *alarmArg;
- int alarmBusy;
/*
** Pointers to the end of sqlite3GlobalConfig.pScratch and
*/
u32 *aScratchFree;
u32 *aPageFree;
-} mem0 = { 62560955, 0, 0, 0, 0, 0, 0, 0, 0 };
+} mem0 = { 0, 0, 0, 0, 0, 0, 0, 0 };
#define mem0 GLOBAL(struct Mem0Global, mem0)
void (*xCallback)(void*,sqlite3_int64,int);
sqlite3_int64 nowUsed;
void *pArg;
- if( mem0.alarmCallback==0 || mem0.alarmBusy ) return;
- mem0.alarmBusy = 1;
+ if( mem0.alarmCallback==0 ) return;
xCallback = mem0.alarmCallback;
nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
pArg = mem0.alarmArg;
+ mem0.alarmCallback = 0;
sqlite3_mutex_leave(mem0.mutex);
xCallback(pArg, nowUsed, nByte);
sqlite3_mutex_enter(mem0.mutex);
- mem0.alarmBusy = 0;
+ mem0.alarmCallback = xCallback;
+ mem0.alarmArg = pArg;
}
/*
** This file contains code that is common across all mutex implementations.
**
-** $Id: mutex.c,v 1.30 2009/02/17 16:29:11 danielk1977 Exp $
+** $Id: mutex.c,v 1.31 2009/07/16 18:21:18 drh Exp $
*/
#include "sqliteInt.h"
** install a mutex implementation via sqlite3_config() prior to
** sqlite3_initialize() being called. This block copies pointers to
** the default implementation into the sqlite3GlobalConfig structure.
- **
- ** The danger is that although sqlite3_config() is not a threadsafe
- ** API, sqlite3_initialize() is, and so multiple threads may be
- ** attempting to run this function simultaneously. To guard write
- ** access to the sqlite3GlobalConfig structure, the 'MASTER' static mutex
- ** is obtained before modifying it.
*/
- sqlite3_mutex_methods *p = sqlite3DefaultMutex();
- sqlite3_mutex *pMaster = 0;
-
- rc = p->xMutexInit();
- if( rc==SQLITE_OK ){
- pMaster = p->xMutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
- assert(pMaster);
- p->xMutexEnter(pMaster);
- assert( sqlite3GlobalConfig.mutex.xMutexAlloc==0
- || sqlite3GlobalConfig.mutex.xMutexAlloc==p->xMutexAlloc
- );
- if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
- sqlite3GlobalConfig.mutex = *p;
- }
- p->xMutexLeave(pMaster);
- }
- }else{
- rc = sqlite3GlobalConfig.mutex.xMutexInit();
+ sqlite3_mutex_methods *pFrom = sqlite3DefaultMutex();
+ sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
+
+ memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
+ memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
+ sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
+ pTo->xMutexAlloc = pFrom->xMutexAlloc;
}
+ rc = sqlite3GlobalConfig.mutex.xMutexInit();
}
return rc;
*************************************************************************
** This file implements that page cache.
**
-** @(#) $Id: pcache.c,v 1.44 2009/03/31 01:32:18 drh Exp $
+** @(#) $Id: pcache.c,v 1.45 2009/07/16 18:21:18 drh Exp $
*/
#include "sqliteInt.h"
** Sort the list of pages in accending order by pgno. Pages are
** connected by pDirty pointers. The pDirtyPrev pointers are
** corrupted by this sort.
+**
+** Since there cannot be more than 2^31 distinct pages in a database,
+** there cannot be more than 31 buckets required by the merge sorter.
+** One extra bucket is added to catch overflow in case something
+** ever changes to make the previous sentence incorrect.
*/
-#define N_SORT_BUCKET_ALLOC 25
-#define N_SORT_BUCKET 25
-#ifdef SQLITE_TEST
- int sqlite3_pager_n_sort_bucket = 0;
- #undef N_SORT_BUCKET
- #define N_SORT_BUCKET \
- (sqlite3_pager_n_sort_bucket?sqlite3_pager_n_sort_bucket:N_SORT_BUCKET_ALLOC)
-#endif
+#define N_SORT_BUCKET 32
static PgHdr *pcacheSortDirtyList(PgHdr *pIn){
- PgHdr *a[N_SORT_BUCKET_ALLOC], *p;
+ PgHdr *a[N_SORT_BUCKET], *p;
int i;
memset(a, 0, sizeof(a));
while( pIn ){
p = pIn;
pIn = p->pDirty;
p->pDirty = 0;
- for(i=0; i<N_SORT_BUCKET-1; i++){
+ for(i=0; ALWAYS(i<N_SORT_BUCKET-1); i++){
if( a[i]==0 ){
a[i] = p;
break;
a[i] = 0;
}
}
- if( i==N_SORT_BUCKET-1 ){
- /* Coverage: To get here, there need to be 2^(N_SORT_BUCKET)
- ** elements in the input list. This is possible, but impractical.
- ** Testing this line is the point of global variable
- ** sqlite3_pager_n_sort_bucket.
+ if( NEVER(i==N_SORT_BUCKET-1) ){
+ /* To get here, there need to be 2^(N_SORT_BUCKET) elements in
+ ** the input list. But that is impossible.
*/
a[i] = pcacheMergeDirtyList(a[i], p);
}
** If the default page cache implementation is overriden, then neither of
** these two features are available.
**
-** @(#) $Id: pcache1.c,v 1.17 2009/06/09 18:58:53 shane Exp $
+** @(#) $Id: pcache1.c,v 1.18 2009/07/16 18:21:18 drh Exp $
*/
#include "sqliteInt.h"
pPage->pNext = pCache->apHash[h];
pCache->apHash[h] = pPage;
- if( iNew>pCache->iMaxKey ){
+ /* The xRekey() interface is only used to move pages earlier in the
+ ** database file (in order to move all free pages to the end of the
+ ** file where they can be truncated off.) Hence, it is not possible
+ ** for the new page number to be greater than the largest previously
+ ** fetched page. But we retain the following test in case xRekey()
+ ** begins to be used in different ways in the future.
+ */
+ if( NEVER(iNew>pCache->iMaxKey) ){
pCache->iMaxKey = iNew;
}
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test2.c,v 1.71 2009/06/18 17:22:39 drh Exp $
+** $Id: test2.c,v 1.72 2009/07/16 18:21:18 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
extern int sqlite3_io_error_hardhit;
extern int sqlite3_diskfull_pending;
extern int sqlite3_diskfull;
- extern int sqlite3_pager_n_sort_bucket;
static struct {
char *zName;
Tcl_CmdProc *xProc;
(char*)&sqlite3_diskfull, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_pending_byte",
(char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "sqlite_pager_n_sort_bucket",
- (char*)&sqlite3_pager_n_sort_bucket, TCL_LINK_INT);
return TCL_OK;
}
#***********************************************************************
# This file implements regression tests for SQLite library.
#
-# $Id: misc7.test,v 1.28 2009/02/10 05:45:42 danielk1977 Exp $
+# $Id: misc7.test,v 1.29 2009/07/16 18:21:18 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {32}
-set sqlite_pager_n_sort_bucket 4
-do_test misc7-17 {
- execsql {
- PRAGMA integrity_check;
- VACUUM;
- PRAGMA integrity_check;
- }
-} {ok ok}
-set sqlite_pager_n_sort_bucket 0
-
#----------------------------------------------------------------------
# Test the situation where a hot-journal is discovered but write-access
# to it is denied. This should return SQLITE_BUSY.