/ Check-in [ded04f12]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure the auto_vacuum=INCREMENTAL setting is preserved across a VACUUM. Ticket #3663. (CVS 6304)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ded04f12f41504e4a3ecd5164f0d4cbbde5e16f7
User & Date: drh 2009-02-18 20:31:18
Context
2009-02-19
14:39
Changes to reduce the heap space consumed by triggers, views and tables in the in-memory representation of the schema. Also to reduce the space used by prepared statements slightly. (CVS 6305) check-in: d9f6ffbc user: danielk1977 tags: trunk
2009-02-18
20:31
Make sure the auto_vacuum=INCREMENTAL setting is preserved across a VACUUM. Ticket #3663. (CVS 6304) check-in: ded04f12 user: drh tags: trunk
18:37
Move the text of C-API requirements out of the sqlite.h.in source file and into separate files in the "docsrc" CM system. Comment changes only - no changes to code. (CVS 6303) check-in: 419eb48b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.565 2009/02/04 01:49:30 shane Exp $
           12  +** $Id: btree.c,v 1.566 2009/02/18 20:31:18 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
  1770   1770   */
  1771   1771   int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
  1772   1772   #ifdef SQLITE_OMIT_AUTOVACUUM
  1773   1773     return SQLITE_READONLY;
  1774   1774   #else
  1775   1775     BtShared *pBt = p->pBt;
  1776   1776     int rc = SQLITE_OK;
  1777         -  u8 av = autoVacuum ?1:0;
         1777  +  u8 av = (u8)autoVacuum;
  1778   1778   
  1779   1779     sqlite3BtreeEnter(p);
  1780         -  if( pBt->pageSizeFixed && av!=pBt->autoVacuum ){
         1780  +  if( pBt->pageSizeFixed && (av ?1:0)!=pBt->autoVacuum ){
  1781   1781       rc = SQLITE_READONLY;
  1782   1782     }else{
  1783         -    pBt->autoVacuum = av;
         1783  +    pBt->autoVacuum = av ?1:0;
         1784  +    pBt->incrVacuum = av==2 ?1:0;
  1784   1785     }
  1785   1786     sqlite3BtreeLeave(p);
  1786   1787     return rc;
  1787   1788   #endif
  1788   1789   }
  1789   1790   
  1790   1791   /*

Changes to test/incrvacuum.test.

    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the incremental vacuum feature.
    13     13   #
    14     14   # Note: There are also some tests for incremental vacuum and IO 
    15     15   # errors in incrvacuum_ioerr.test.
    16     16   #
    17         -# $Id: incrvacuum.test,v 1.22 2009/01/30 05:47:15 shane Exp $
           17  +# $Id: incrvacuum.test,v 1.23 2009/02/18 20:31:18 drh Exp $
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22     22   # If this build of the library does not support auto-vacuum, omit this
    23     23   # whole file.
    24     24   ifcapable {!autovacuum || !pragma} {
................................................................................
   669    669     execsql { BEGIN EXCLUSIVE; } db2
   670    670     catchsql { PRAGMA auto_vacuum = 2; }
   671    671   } {1 {database is locked}}
   672    672   
   673    673   do_test incrvacuum-12.3 {
   674    674     execsql { ROLLBACK; } db2
   675    675     execsql { PRAGMA auto_vacuum }
   676         -} {1}
          676  +} {2}   ;# Still 2 because PRAGMA auto_vacuum setting held in case of vacuum
          677  +do_test incrvacuum-12.4 {
          678  +  db close
          679  +  sqlite3 db test.db
          680  +  execsql { PRAGMA auto_vacuum }
          681  +} {1}   ;# Revert to 1 because the database file did not change
   677    682   
   678         -do_test incrvacuum-12.3 {
          683  +do_test incrvacuum-12.5 {
   679    684     execsql { SELECT * FROM sqlite_master }
   680    685     execsql { PRAGMA auto_vacuum }
   681    686   } {1}
   682    687   
   683    688   #----------------------------------------------------------------------
   684    689   # Special case #2: What if one process prepares a "PRAGMA auto_vacuum = XXX"
   685    690   # statement when the database is empty, but doesn't execute it until

Changes to test/vacuum2.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the VACUUM statement.
    13     13   #
    14         -# $Id: vacuum2.test,v 1.9 2008/11/10 18:20:16 shane Exp $
           14  +# $Id: vacuum2.test,v 1.10 2009/02/18 20:31:18 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # If the VACUUM statement is disabled in the current build, skip all
    20     20   # the tests in this file.
    21     21   #
................................................................................
   151    151     } {1}
   152    152     do_test vacuum2-4.3 {
   153    153       execsql {
   154    154         pragma integrity_check
   155    155       }
   156    156     } {ok}
   157    157     do_test vacuum2-4.4 {
          158  +    db close
          159  +    sqlite3 db test.db
   158    160       execsql {
   159    161         pragma auto_vacuum;
   160    162       }
   161    163     } {1}
          164  +  do_test vacuum2-4.5 {  # Ticket #3663
          165  +    execsql {
          166  +      pragma auto_vacuum=2;
          167  +      vacuum;
          168  +      pragma auto_vacuum;
          169  +    }
          170  +  } {2}
          171  +  do_test vacuum2-4.6 {
          172  +    execsql {
          173  +      pragma integrity_check
          174  +    }
          175  +  } {ok}
          176  +  do_test vacuum2-4.7 {
          177  +    db close
          178  +    sqlite3 db test.db
          179  +    execsql {
          180  +      pragma auto_vacuum;
          181  +    }
          182  +  } {2}
   162    183   }
   163    184   
   164    185   finish_test