-C Removed\sINVARIANTS\ssections\sin\sthe\sexperimental\sextension\sloading\sAPI\sthat\sI\sshould\snot\shave\sadded\sin\sthe\sfirst\splace.\sNo\schanges\sto\scode.\s(CVS\s5273)
-D 2008-06-22T16:35:49
+C Fix\sa\sbug\swhereby\sopening\sa\sconnection\sto\san\sexisting\sshared-cache\scaused\sthe\scache-size\s(the\svalue\sconfigured\sby\s"PRAGMA\scache_size")\sto\srevert\sto\sits\sdefault\svalue.\s(CVS\s5274)
+D 2008-06-23T09:50:51
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
-F src/btree.c 54a5e5f84657e57313be156cdf47dfc8d1182b39
+F src/btree.c 6d25027de7c26b1c0a69ad3f2045f944e20fba22
F src/btree.h b1bd7e0b8c2e33658aaf447cb0d1d94f74664b6b
F src/btreeInt.h 02325f04758dba0fcd0c08ac55cd9b189dad61a5
F src/build.c 88cc5501a87f72d0538b040001d88d31f994edea
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c 3626c71fb70912abec9a4312beba753a9ce800df
F src/loadext.c 40024a0f476c1279494876b9a002001b29e5d3e3
-F src/main.c 37e65eaad07de56353cf149b45896b2c56cca9b2
+F src/main.c e9a760651620c9dd6e86224ef4cada9fb71ad898
F src/malloc.c d4339af305c2cb62fbecc2c533b3169dec315d44
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 159f10e280f2d9aea597cf938851e61652dd5c3d
F src/shell.c a12ea645271b7876c8f080146f48e20b00d367ec
F src/sqlite.h.in 4a42be927bc632f7c06042e5022c64834cc82943
F src/sqlite3ext.h f162a72daef5ebf8b211fe8c0ec96e85d22fbf9b
-F src/sqliteInt.h 973e5cc6db87f12eba25ae847494af57844be9bf
+F src/sqliteInt.h 9cd8b86d9592f9ca521e6d1f003cc6ce8f673cfc
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 6cb10377992505bd69f1ca1d75c1240a65f25a58
F src/table.c 1fa8f8113ac9cbc09ae4801c6d2a7f0af82c5822
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
F test/shared.test c6769531e0cb751d46a9838c0532d3786606c0f6
F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
-F test/shared3.test 546b69002d23a704acbe8b5ed24bc5930b6b0bfe
+F test/shared3.test 987316be601e2349e6a340a6d5f8ed981e507931
F test/shared_err.test 10157148055f1b96373bcc59ecd4e84a83e22a81
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/sidedelete.test 736ac1da08b3b1aa62df97fef2fcdb1b660111b9
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 663a590e3086145a57af7569d8f798b6b6a8b76c
-R 45e33e074c642d8dbfde0cca0369777f
-U mihailim
-Z fea5e0f4352ec79670c3c8b75e3787b1
+P e7610890b4df78af5bb8f3e8f8d05ef5cf36e186
+R c4d643cc756037ad7486bb96e515e495
+U danielk1977
+Z aadad94b6ce5d63b330c8f427e6c96a1
-e7610890b4df78af5bb8f3e8f8d05ef5cf36e186
\ No newline at end of file
+0492aa8ed3c35dd2cdfc69c9cb87e43ef0460826
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.468 2008/06/19 01:03:18 drh Exp $
+** $Id: btree.c,v 1.469 2008/06/23 09:50:51 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
** call the nBytes parameter is ignored and a pointer to the same blob
** of memory returned.
**
+** If the nBytes parameter is 0 and the blob of memory has not yet been
+** allocated, a null pointer is returned. If the blob has already been
+** allocated, it is returned as normal.
+**
** Just before the shared-btree is closed, the function passed as the
** xFree argument when the memory allocation was made is invoked on the
** blob of allocated memory. This function should not call sqlite3_free()
void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
BtShared *pBt = p->pBt;
sqlite3BtreeEnter(p);
- if( !pBt->pSchema ){
+ if( !pBt->pSchema && nBytes ){
pBt->pSchema = sqlite3MallocZero(nBytes);
pBt->xFreeSchema = xFree;
}
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.455 2008/06/20 14:59:51 danielk1977 Exp $
+** $Id: main.c,v 1.456 2008/06/23 09:50:51 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
}
rc = sqlite3BtreeOpen(zFilename, (sqlite3 *)db, ppBtree, btFlags, vfsFlags);
- if( rc==SQLITE_OK ){
+
+ /* If the B-Tree was successfully opened, set the pager-cache size to the
+ ** default value. Except, if the call to BtreeOpen() returned a handle
+ ** open on an existing shared pager-cache, do not change the pager-cache
+ ** size.
+ */
+ if( rc==SQLITE_OK && 0==sqlite3BtreeSchema(*ppBtree, 0, 0) ){
sqlite3BtreeSetCacheSize(*ppBtree, nCache);
}
return rc;
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.722 2008/06/22 12:37:58 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.723 2008/06/23 09:50:52 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
void *sqlite3PageMalloc(int);
void sqlite3PageFree(void*);
void sqlite3MemSetDefault(void);
+void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
#ifndef SQLITE_MUTEX_NOOP
sqlite3_mutex_methods *sqlite3DefaultMutex(void);
#
#***********************************************************************
#
-# $Id: shared3.test,v 1.2 2008/06/20 17:51:17 danielk1977 Exp $
+# $Id: shared3.test,v 1.3 2008/06/23 09:50:52 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test shared3-2.1 {
sqlite3 db1 test.db
execsql {
- PRAGMA main.cache_size = 64;
+ PRAGMA main.cache_size = 10;
} db1
} {}
do_test shared3-2.2 {
execsql { PRAGMA main.cache_size } db1
-} {64}
+} {10}
do_test shared3-2.3 {
sqlite3 db2 test.db
execsql { PRAGMA main.cache_size } db1
-} {64}
+} {10}
do_test shared3-2.4 {
execsql { PRAGMA main.cache_size } db2
-} {64}
+} {10}
do_test shared3-2.5 {
execsql { PRAGMA main.cache_size } db1
-} {64}
+} {10}
+
+# The cache-size should now be 10 pages. However at one point there was
+# a bug that caused the cache size to return to the default value when
+# a second connection was opened on the shared-cache (as happened in
+# test case shared3-2.3 above). The goal of the following tests is to
+# ensure that the cache-size really is 10 pages.
+#
+if {$::tcl_platform(platform)=="unix"} {
+ set alternative_name ./test.db
+} else {
+ set alternative_name TEST.DB
+}
+do_test shared3-2.6 {
+ sqlite3 db3 $alternative_name
+ catchsql {select count(*) from sqlite_master} db3
+} {0 1}
+do_test shared3-2.7 {
+ execsql {
+ BEGIN;
+ INSERT INTO t1 VALUES(10, randomblob(5000))
+ } db1
+ catchsql {select count(*) from sqlite_master} db3
+} {0 1}
+do_test shared3-2.8 {
+ execsql {
+ INSERT INTO t1 VALUES(10, randomblob(10000))
+ } db1
+
+ # If the pager-cache is really still limited to 10 pages, then the INSERT
+ # statement above should have caused the pager to grab an exclusive lock
+ # on the database file so that the cache could be spilled.
+ #
+ catchsql {select count(*) from sqlite_master} db3
+} {1 {database is locked}}
db1 close
db2 close
+db3 close
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test