]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make setting "PRAGMA auto_vacuum = incremental" persistent if it is executed before...
authordanielk1977 <danielk1977@noemail.net>
Sun, 24 Jun 2007 10:14:00 +0000 (10:14 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sun, 24 Jun 2007 10:14:00 +0000 (10:14 +0000)
FossilOrigin-Name: c666fad151f25ab8365c497cd0967f4a5a2adb90

manifest
manifest.uuid
src/btree.c
src/prepare.c
src/vdbe.c
test/incrvacuum.test

index 7bbd42c950c240b47ca0b2f5208865e5867988a0..46bf5313346856656bd4bb3f305950926b9a631a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\s"(database.)freelist_count"\sPRAGMA.\sFor\squerying\sthe\ssize\sof\sthe\ndatabase\sfree-list.\s(CVS\s4112)
-D 2007-06-24T08:00:43
+C Make\ssetting\s"PRAGMA\sauto_vacuum\s=\sincremental"\spersistent\sif\sit\sis\sexecuted\sbefore\sthe\sdatabase\sfile\sis\screated.\s(CVS\s4113)
+D 2007-06-24T10:14:00
 F Makefile.in 7f7485a4cc039476a42e534b3f26ec90e2f9753e
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -65,7 +65,7 @@ F src/alter.c 1b1deeb97446ed87f2fa17a3eb6236548841a348
 F src/analyze.c 8d345472e0f4e44fc88f5cf489c16dcb77904525
 F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
 F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
-F src/btree.c ca4f2d5c67bb10b76ed9917db8b6a7dd64dbd5f1
+F src/btree.c 63d40146c74499b8119ce4772b27210c7830313e
 F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
 F src/btreeInt.h ac1ab1fb624ffbe571786cd2bd9559f9ae336355
 F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
@@ -100,7 +100,7 @@ F src/pager.c 39352b58ee840cae715a4f0d20e446aa5e1445fe
 F src/pager.h 94110a5570dca30d54a883e880a3633b2e4c05ae
 F src/parse.y ad2ce25665be7f7303137f774a4e3e72e0d036ff
 F src/pragma.c d2e6f5da991594e1c2c7636927f6be7cf66e81bd
-F src/prepare.c 87c23644986b5e41a58bc76f05abebd899e00089
+F src/prepare.c 609bb27860ce98ab39889fecc0998dfd8220891b
 F src/printf.c 9b3048d270e8bb2f8b910b491ac3aadece6cfab2
 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
 F src/select.c 2ee53f929fe3755a35de1fb937f22e2e60f7d3e5
@@ -137,7 +137,7 @@ F src/update.c 3359041db390a8f856d67272f299600e2104f350
 F src/utf.c 01b2aba02b10d12903e9e1ff897215c9faf6b662
 F src/util.c 80cdf6b68d03b8f0ab3237a390842e039cff66c6
 F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
-F src/vdbe.c 219cfe39555e6144d0b2b902832aaee18c9e0f0e
+F src/vdbe.c 0f4d3085e0aabe00aedfffb43ec5d07da2c54d9a
 F src/vdbe.h 001c5b257567c1d3de7feb2203aac71d0d7b16a3
 F src/vdbeInt.h 7d2bf163d6d4e815724a457f2216dd8e38c3955c
 F src/vdbeapi.c 7930b9a188ab385287ca3eb3840af7225cb43549
@@ -267,7 +267,7 @@ F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
 F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055
 F test/incrblob.test a23b9431596581f1f4ac03d04fa97c31776693d5
 F test/incrblob_err.test 2501bec57e317e7051451b5093b47fc61a96c85a
-F test/incrvacuum.test 740f441b9a61a9adff11b0ac57bf392a3414627c
+F test/incrvacuum.test 433fbe59b4a77d50117adaef66b6dca52f611179
 F test/incrvacuum2.test 82397ceb5941cbe852fd29bb33fcdf5665bc80c2
 F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a
 F test/index.test e65df12bed94b2903ee89987115e1578687e9266
@@ -514,7 +514,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P d5b7224f37db1729dd042d48765d7a79247e1bde
-R 68c93754de3917a7a2bfaeb6e4eb9132
+P 1fb4251a707d0b79d250d6ea2022913b371d5f14
+R 6b7b2c3441b3702881ad19fe0040737f
 U danielk1977
-Z 04ec3282e5bef0f3d8094230d12c6499
+Z 1b4f0a37e5195a0d15b992b6f3cc848b
index 08056425305baf85e02aa9cb178a28ba9953820a..fca75668cbbf881f8de6fd88b58d9b63648bdf4d 100644 (file)
@@ -1 +1 @@
-1fb4251a707d0b79d250d6ea2022913b371d5f14
\ No newline at end of file
+c666fad151f25ab8365c497cd0967f4a5a2adb90
\ No newline at end of file
index 7fc051cd88a2d1e173d1b58048eaa651d47653c5..5febf4e865985909ddebd5f29dac8519e200c501 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.389 2007/06/20 15:14:10 drh Exp $
+** $Id: btree.c,v 1.390 2007/06/24 10:14:00 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -1138,6 +1138,7 @@ int sqlite3BtreeOpen(
     pBt->pageSizeFixed = 1;
 #ifndef SQLITE_OMIT_AUTOVACUUM
     pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
+    pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
 #endif
   }
   pBt->usableSize = pBt->pageSize - nReserve;
@@ -1543,7 +1544,9 @@ static int newDatabase(BtShared *pBt){
   pBt->pageSizeFixed = 1;
 #ifndef SQLITE_OMIT_AUTOVACUUM
   assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );
+  assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );
   put4byte(&data[36 + 4*4], pBt->autoVacuum);
+  put4byte(&data[36 + 7*4], pBt->incrVacuum);
 #endif
   return SQLITE_OK;
 }
index 223df16f6cc6e5376f52f326c44745cdbdf80068..82c72413ea336eeb2253bc4a7fc9f8ba15cf6e5f 100644 (file)
@@ -13,7 +13,7 @@
 ** interface, and routines that contribute to loading the database schema
 ** from disk.
 **
-** $Id: prepare.c,v 1.50 2007/05/08 20:37:39 drh Exp $
+** $Id: prepare.c,v 1.51 2007/06/24 10:14:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -213,7 +213,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
   **    meta[3]   Use freelist if 0.  Autovacuum if greater than zero.
   **    meta[4]   Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE
   **    meta[5]   The user cookie. Used by the application.
-  **    meta[6]   
+  **    meta[6]   Incremental-vacuum flag.
   **    meta[7]
   **    meta[8]
   **    meta[9]
index e4f94acd4c5cfa65736df5250fc6453014290559..4e8b17220630900e9b1261d794672cce21afeca7 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.628 2007/06/24 08:00:43 danielk1977 Exp $
+** $Id: vdbe.c,v 1.629 2007/06/24 10:14:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -2509,6 +2509,11 @@ case OP_Transaction: {       /* no-push */
 ** the main database file and P1==1 is the database file used to store
 ** temporary tables.
 **
+** If P1 is negative, then this is a request to read the size of a
+** databases free-list. P2 must be set to 1 in this case. The actual
+** database accessed is ((P1+1)*-1). For example, a P1 parameter of -1
+** corresponds to database 0 ("main"), a P1 of -1 is database 1 ("temp").
+**
 ** There must be a read-lock on the database (either a transaction
 ** must be started or there must be an open cursor) before
 ** executing this instruction.
index a05ad0c5f4ecb5fc69f5701b6409d41e20e34d85..b0a688009a13beee448377bc0896ff9176390721 100644 (file)
@@ -14,7 +14,7 @@
 # Note: There are also some tests for incremental vacuum and IO 
 # errors in incrvacuum_ioerr.test.
 #
-# $Id: incrvacuum.test,v 1.10 2007/05/24 10:18:22 danielk1977 Exp $
+# $Id: incrvacuum.test,v 1.11 2007/06/24 10:14:00 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -554,5 +554,58 @@ do_test incrvacuum-10.7 {
   expr [file size test.db] / 1024
 } {1}
 
+#----------------------------------------------------------------
+# Test that if we set the auto_vacuum mode to 'incremental', then
+# create a database, thereafter that database defaults to incremental 
+# vacuum mode.
+#
+db close
+file delete -force test.db test.db-journal
+sqlite3 db test.db
+
+do_test incrvacuum-11.1 {
+  execsql {
+    PRAGMA auto_vacuum;
+  }
+} {0}
+do_test incrvacuum-11.2 {
+  execsql {
+    PRAGMA auto_vacuum = incremental;
+  }
+} {}
+do_test incrvacuum-11.3 {
+  execsql {
+    PRAGMA auto_vacuum;
+  }
+} {2}
+do_test incrvacuum-11.4 {
+  file size test.db
+} {0}
+do_test incrvacuum-11.5 {
+  # Create the database file.
+  execsql { CREATE TABLE abc(a, b, c); }
+  # Close and reopen the connection.
+  db close
+  sqlite3 db test.db
+
+  # Test we are still in incremental vacuum mode.
+  execsql { PRAGMA auto_vacuum; }
+} {2}
+do_test incrvacuum-11.6 {
+  execsql {
+    PRAGMA auto_vacuum = 'full';
+    PRAGMA auto_vacuum;
+  }
+} {1}
+do_test incrvacuum-11.7 {
+  # Close and reopen the connection.
+  db close
+  sqlite3 db test.db
+
+  # Test we are still in incremental vacuum mode.
+  execsql { PRAGMA auto_vacuum; }
+} {2}
+
 finish_test