]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If meta(3)>0 then make the database readonly for now. This allows the current
authordrh <drh@noemail.net>
Sat, 14 Aug 2004 19:20:09 +0000 (19:20 +0000)
committerdrh <drh@noemail.net>
Sat, 14 Aug 2004 19:20:09 +0000 (19:20 +0000)
database to interact with future releases that might include autovacuum. (CVS 1888)

FossilOrigin-Name: 7619bf4771781005da23a3e9d7b00de405e27a64

manifest
manifest.uuid
src/btree.c
src/main.c
test/btree.test

index b179ba695a7d29bc909a50a149cdd38a6c0958ee..4afe6eaadf2c5435856774099c0fda57f608207a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sthat\swas\spreventing\s"PRAGMA\stemp_store=MEMORY"\sfrom\sworking.\s(CVS\s1887)
-D 2004-08-14T18:34:55
+C If\smeta(3)>0\sthen\smake\sthe\sdatabase\sreadonly\sfor\snow.\s\sThis\sallows\sthe\scurrent\ndatabase\sto\sinteract\swith\sfuture\sreleases\sthat\smight\sinclude\sautovacuum.\s(CVS\s1888)
+D 2004-08-14T19:20:10
 F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -27,7 +27,7 @@ F sqlite3.def c139a6b17293d71759a7c301ad76707243ce5d54
 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
 F src/attach.c 0bd4f11da6999665da30625665a4096ba7898de6
 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
-F src/btree.c cfa5ed01838247be40c113cac528286675940801
+F src/btree.c 14c20dfb320473a1fd4e37d43eba5e2afd606757
 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
 F src/build.c 951a36b246d9f38f2340562bfdd6a96bf7433530
 F src/date.c a164e3a58f61306e82c5626e5fa16f861a9a7084
@@ -39,7 +39,7 @@ F src/hash.c f0a2f22c2a7052d67053b5f4690ea3010bb3fb9f
 F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
 F src/insert.c bedcba371401395033a1a1c578d8fdc3fec87bec
 F src/legacy.c 2f3617c61bcdcd1d776154a9cfebf99facda8ad8
-F src/main.c 32b91a5799d53586af068b5f95cd851242d681ca
+F src/main.c 34a95ab1b2f6b33dfebb64d4367c34627b1f0a24
 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
 F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345
 F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
@@ -90,7 +90,7 @@ F test/bigfile.test 62722ac4b420dfbcdceb137b8634e2cf2865fe27
 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
 F test/bind.test 94c3df3da774b48c6946c81b1d7f1b1646e0bd46
 F test/blob.test 8727a7b46b2073a369cfc9bcb6f54dd366b9d884
-F test/btree.test 973791eb269ab320c1a2bf0c440adee28ea936d2
+F test/btree.test 97b563e1ab999bf8764b129e8c4b4be0a116a52a
 F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
 F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
 F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
@@ -242,7 +242,7 @@ F www/tclsqlite.tcl 06a86cba4d7fc88e2bcd633b57702d3d16abebb5
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 6b8178de9936e48ed69d1546218b5def6665b459
-R dd5d27280c9e7d8e0c9807625c7d9299
+P bb55894521848b6a9d8b516a3c7eeb3482936d7e
+R d4b24a8ba05379c1060c6d483ca4b2cb
 U drh
-Z 1990a2927b4118ca945a16b473a82826
+Z 660b1c4514e63b0b891d0f5f8d1e26a5
index d5d7cc1236ba76ac0857b4f9c3fd7c950ebf04a9..90d07c832ffdbd67540b2c84768a21d47a7b1c5e 100644 (file)
@@ -1 +1 @@
-bb55894521848b6a9d8b516a3c7eeb3482936d7e
\ No newline at end of file
+7619bf4771781005da23a3e9d7b00de405e27a64
\ No newline at end of file
index 3f9992caa10d74380ecd4896b8c179e29ba1834c..0b4ddeb60e3803f099721a8ffd0e2f8bfd804697 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.181 2004/08/08 19:43:30 drh Exp $
+** $Id: btree.c,v 1.182 2004/08/14 19:20:10 drh Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** For a detailed discussion of BTrees, refer to
@@ -3746,6 +3746,11 @@ int sqlite3BtreeGetMeta(Btree *pBt, int idx, u32 *pMeta){
   if( rc ) return rc;
   *pMeta = get4byte(&pP1[36 + idx*4]);
   sqlite3pager_unref(pP1);
+
+  /* The current implementation is unable to handle writes to an autovacuumed
+  ** database.  So make such a database readonly. */
+  if( idx==4 && *pMeta>0 ) pBt->readOnly = 1;
+
   return SQLITE_OK;
 }
 
index e46e7cb1d2d165a8affd4b12c140862eef4bfda1..ce7f223add254e95784f773e8964585a583204dc 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.250 2004/08/14 18:34:55 drh Exp $
+** $Id: main.c,v 1.251 2004/08/14 19:20:10 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -197,7 +197,7 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){
   **    meta[0]   Schema cookie.  Changes with each schema change.
   **    meta[1]   File format of schema layer.
   **    meta[2]   Size of the page cache.
-  **    meta[3]
+  **    meta[3]   Use freelist if 0.  Autovacuum if greater than zero.
   **    meta[4]   Db text encoding. 1:UTF-8 3:UTF-16 LE 4:UTF-16 BE
   **    meta[5]
   **    meta[6]   
index 4396bea4f932d05ec5f4f1d75d0a9612456750a5..1a274d4db6fcde9517e8ea138b52516f87ad1efc 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is btree database backend
 #
-# $Id: btree.test,v 1.29 2004/06/30 02:35:51 danielk1977 Exp $
+# $Id: btree.test,v 1.30 2004/08/14 19:20:10 drh Exp $
 
 
 set testdir [file dirname $argv0]
@@ -379,13 +379,13 @@ do_test btree-5.2 {
 do_test btree-5.3 {
   btree_begin_transaction $::b1
   set rc [catch {
-    btree_update_meta $::b1 0 1 2 3 4 5 6 7 8 9
+    btree_update_meta $::b1 0 1 2 3 0 5 6 7 8 9
   } msg]
   lappend rc $msg
 } {0 {}}
 do_test btree-5.4 {
   btree_get_meta $::b1
-} {0 1 2 3 4 5 6 7 8 9}
+} {0 1 2 3 0 5 6 7 8 9}
 do_test btree-5.5 {
   btree_close_cursor $::c1
   btree_rollback $::b1
@@ -393,10 +393,10 @@ do_test btree-5.5 {
 } {0 0 0 0 0 0 0 0 0 0}
 do_test btree-5.6 {
   btree_begin_transaction $::b1
-  btree_update_meta $::b1 0 10 20 30 40 50 60 70 80 90
+  btree_update_meta $::b1 0 10 20 30 0 50 60 70 80 90
   btree_commit $::b1
   btree_get_meta $::b1
-} {0 10 20 30 40 50 60 70 80 90}
+} {0 10 20 30 0 50 60 70 80 90}
 
 proc select_all {cursor} {
   set r {}