]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug causing the pager-cache size to be reset to its default value whenever...
authordanielk1977 <danielk1977@noemail.net>
Mon, 23 Jun 2008 16:53:46 +0000 (16:53 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 23 Jun 2008 16:53:46 +0000 (16:53 +0000)
FossilOrigin-Name: 6dbe67da5cb0141e011b4fdcc3964a20f68be843

ext/rtree/rtree1.test
manifest
manifest.uuid
src/callback.c
src/prepare.c
test/pragma.test

index acf20f99e01ab6c142526e9d05cf64a83d7e25af..bb759af1e2508c37b1926408058d2da35c877a20 100644 (file)
@@ -11,7 +11,7 @@
 #
 # The focus of this file is testing the r-tree extension.
 #
-# $Id: rtree1.test,v 1.3 2008/06/23 15:55:52 danielk1977 Exp $
+# $Id: rtree1.test,v 1.4 2008/06/23 16:53:47 danielk1977 Exp $
 #
 
 if {![info exists testdir]} {
@@ -61,6 +61,7 @@ do_test rtree-1.1.3 {
 # an attached database.
 #
 do_test rtree-1.2.1 {
+  file delete -force test2.db
   execsql {
     ATTACH 'test2.db' AS aux;
     CREATE VIRTUAL TABLE aux.'a" "b' USING rtree(ii, x1, x2, y1, y2);
index 84e4a487fa4ac23c5a6bc6e95e62df5eab228e49..984da081ed090ac889079f255528a58c3c7ea3c5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Run\s(a\ssubset\sof)\sthe\srtree\stests\sfrom\squick.test.\s(CVS\s5282)
-D 2008-06-23T15:55:52
+C Fix\sa\sbug\scausing\sthe\spager-cache\ssize\sto\sbe\sreset\sto\sits\sdefault\svalue\swhenever\sthe\sdatabase\sschema\swas\sreloaded.\s(CVS\s5283)
+D 2008-06-23T16:53:47
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -66,7 +66,7 @@ F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 20b87410e55f33a03e0f7cc58c0f1908faf91858
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
-F ext/rtree/rtree1.test b7c40c535804f786ea1dbf975a28f0c0e2d26f88
+F ext/rtree/rtree1.test 994da7f85328cf499cdf149c6caa32547ea75dbf
 F ext/rtree/rtree2.test 07aea32287ce3f7717fe285e6172e5418ce3fd52
 F ext/rtree/rtree3.test 877a09c1a0c2b87af0f94f3a286e7dd3b65adf22
 F ext/rtree/rtree4.test 11724f766a74f48710998cdd7552cec140c55bf9
@@ -99,7 +99,7 @@ F src/btree.c 6d25027de7c26b1c0a69ad3f2045f944e20fba22
 F src/btree.h b1bd7e0b8c2e33658aaf447cb0d1d94f74664b6b
 F src/btreeInt.h 02325f04758dba0fcd0c08ac55cd9b189dad61a5
 F src/build.c 88cc5501a87f72d0538b040001d88d31f994edea
-F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
+F src/callback.c 3ba98ae46f60aa7c2c40eac7d18fe5ba9b706b83
 F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
 F src/date.c e841168e5520bbbb2a1cbcdce7531d8b23017b4d
 F src/delete.c d3fc5987f2eb88f7b9549d58a5dfea079a83fe8b
@@ -137,7 +137,7 @@ F src/pager.c e2a49872f1e15eb83895ace704c48ac8ded998ba
 F src/pager.h 6aa3050a3c684475a5a9dbad5ff1cebad612acba
 F src/parse.y 8c2c3145eebe1964eb279cb3c4e502eae28bb0fa
 F src/pragma.c e6c55362d164e4bc8ebc83a9a01635552d854800
-F src/prepare.c 3c19149e75fbf3b08471a389f064da7302cad9c5
+F src/prepare.c aba51dad52308e3d9d2074d8ff4e612e7f1cab51
 F src/printf.c 8b063da9dcde26b7c500a01444b718d86f21bc6e
 F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
 F src/select.c ea3e5e233cf16f4cb43f6ec35972683ae7bc03f3
@@ -423,7 +423,7 @@ F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
 F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b
 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
 F test/permutations.test eb7373f8dd450b99b8addfdabe820da0cc851e54
-F test/pragma.test 6b9bee4f5dbb9bccde4d0d5caf13a33f9da86e15
+F test/pragma.test 44bc52afa72cabfeae82641e0033ca24919f3ce8
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d
 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
@@ -592,7 +592,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 006fd69bf56f05448fd9aa82d3b1cdcc175369ad
-R eaeaee6d431b07ec903a8c0b496cdb2e
+P e872c78c72eb5976e72123485692a76409bd857f
+R f7cd8593345fa0392a9591d6d8df4193
 U danielk1977
-Z 4f90c48cde8f4b8c15d87a303ff9e628
+Z 82fd96eb942b7f8687f6348bde0b3b6d
index 62abf327c27b3c754e3423bb002fb13e3785ab4c..e913abd6c2defbbd81efd0ace81ed6c012bd1022 100644 (file)
@@ -1 +1 @@
-e872c78c72eb5976e72123485692a76409bd857f
\ No newline at end of file
+6dbe67da5cb0141e011b4fdcc3964a20f68be843
\ No newline at end of file
index 009cfd740e4e43f4cf7937da4da8ac83bd992290..1a8198b067d6cf9b3f85a2d6e4e4b1739de66b67 100644 (file)
@@ -13,7 +13,7 @@
 ** This file contains functions used to access the internal hash tables
 ** of user defined functions and collation sequences.
 **
-** $Id: callback.c,v 1.23 2007/08/29 12:31:26 danielk1977 Exp $
+** $Id: callback.c,v 1.24 2008/06/23 16:53:47 danielk1977 Exp $
 */
 
 #include "sqliteInt.h"
@@ -328,6 +328,8 @@ FuncDef *sqlite3FindFunction(
 ** at a Schema struct. This function does not call sqlite3_free() on the 
 ** pointer itself, it just cleans up subsiduary resources (i.e. the contents
 ** of the schema hash tables).
+**
+** The Schema.cache_size variable is not cleared.
 */
 void sqlite3SchemaFree(void *p){
   Hash temp1;
index 676f4370efa5fc8e279613e7ac9589820bffc521..ec2e1c07e135fb54f232275aec59483c879c7de6 100644 (file)
@@ -13,7 +13,7 @@
 ** interface, and routines that contribute to loading the database schema
 ** from disk.
 **
-** $Id: prepare.c,v 1.87 2008/06/15 02:51:48 drh Exp $
+** $Id: prepare.c,v 1.88 2008/06/23 16:53:47 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -274,11 +274,13 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
   }
   pDb->pSchema->enc = ENC(db);
 
-  size = meta[2];
-  if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
-  if( size<0 ) size = -size;
-  pDb->pSchema->cache_size = size;
-  sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
+  if( pDb->pSchema->cache_size==0 ){
+    size = meta[2];
+    if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
+    if( size<0 ) size = -size;
+    pDb->pSchema->cache_size = size;
+    sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
+  }
 
   /*
   ** file_format==1    Version 3.0.0.
index deffc159f6f4427044879eabf715b3ad6daa7239..a97d58a6730169f550f1f65248f03c4f06ab14d6 100644 (file)
@@ -12,7 +12,7 @@
 #
 # This file implements tests for the PRAGMA command.
 #
-# $Id: pragma.test,v 1.61 2008/06/06 11:11:27 danielk1977 Exp $
+# $Id: pragma.test,v 1.62 2008/06/23 16:53:47 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -32,6 +32,8 @@ source $testdir/tester.tcl
 # pragma-10.*: Test the count_changes pragma in the presence of triggers.
 # pragma-11.*: Test the collation_list pragma.
 # pragma-14.*: Test the page_count pragma.
+# pragma-15.*: Test that the value set using the cache_size pragma is not
+#              reset when the schema is reloaded.
 #
 
 ifcapable !pragma {
@@ -1151,6 +1153,35 @@ ifcapable pager_pragmas {
   } {5}
 }
 
+# Test that the value set using the cache_size pragma is not reset when the
+# schema is reloaded.
+#
+ifcapable pager_pragmas {
+  db close
+  sqlite3 db test.db
+  do_test pragma-15.1 {
+    execsql {
+      PRAGMA cache_size=59;
+      PRAGMA cache_size;
+    }
+  } {59}
+  do_test pragma-15.2 {
+    sqlite3 db2 test.db
+    execsql {
+      CREATE TABLE newtable(a, b, c);
+    } db2
+    db2 close
+  } {}
+  do_test pragma-15.3 {
+    # Evaluating this statement will cause the schema to be reloaded (because
+    # the schema was changed by another connection in pragma-15.2). At one
+    # point there was a bug that reset the cache_size to its default value
+    # when this happened. 
+    execsql { SELECT * FROM sqlite_master }
+    execsql { PRAGMA cache_size }
+  } {59}
+}
+
 # Reset the sqlite3_temp_directory variable for the next run of tests:
 sqlite3 dbX :memory:
 dbX eval {PRAGMA temp_store_directory = ""}