-C Tighter\scompression\sof\sthe\skeyword\shash\stable.\s(CVS\s3920)
-D 2007-05-04T17:07:53
+C Change\sincremental\svacuum\sto\sbe\striggered\sby\sa\spragma\srather\sthan\sa\scommand.\nWe\shave\sa\slot\sto\slearn\sabout\sthis\syet\sand\swe\sdo\snot\swant\sto\spaint\sourselves\ninto\sa\scorner\sby\scommiting\sto\sspecific\ssyntax\stoo\searly.\s(CVS\s3921)
+D 2007-05-04T18:30:41
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f
F src/btree.c ebf16f19fc9e732c93b98083c4dfdbadad247e5c
F src/btree.h 2c187d60cf76d74c2b4767294d6b5fa267037ff0
-F src/build.c 470c3d39ab87bc817858493a32446630d6f553f3
+F src/build.c 0dd6f0d0a5d304be91374f4c7228a3e9b00ff7f1
F src/callback.c 6414ed32d55859d0f65067aa5b88d2da27b3af9e
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c c34a9c86ffd6da4cb3903ea038d977ec539d07e2
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c f01e0e577b7b54c3cdba24a30ecc585a805f23fa
F src/pager.h d652ddf092d2318d00e41f8539760fe8e57c157c
-F src/parse.y 502cec813c863f864cb951d95121dbabd56b9396
-F src/pragma.c 4fdefc03c3fd0ee87f8aad82bf80ba9bf1cdf416
+F src/parse.y a5bdc301e970ceb3826b56a84898b8966d5353f8
+F src/pragma.c 3f16c1274bc25afb630b61a3630ea19a2fd0b5dc
F src/prepare.c 03277063bc4f5860efbf23548fa0123ac0f6eaec
F src/printf.c 0c6f40648770831341ac45ab32423a80b4c87f05
F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
F src/shell.c d07ae326b3815d80f71c69b3c7584382e47f6447
F src/sqlite.h.in a666300976897eced975b448f722a722b362c6b1
F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890
-F src/sqliteInt.h 478ca87a2a08b56db820e36935b134fd30da8d17
+F src/sqliteInt.h 93ac1a9f1c8facfd861cf548845d2abc36039670
F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d
F src/tclsqlite.c cd87bbaffd115ded71b4b9c03be7b5b213c4ba7a
F src/test1.c 29a39fdde51f4612082ecf3f5af54dac93766f87
F src/utf.c e64a48bc21aa973eb622dd47da87d56a4cdcf528
F src/util.c 9f9fec5dc7ffab8ff982508d03af37269a59ff91
F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
-F src/vdbe.c 74f348b125187f4bebd8bbba381e9be7de0a2bcf
+F src/vdbe.c 725a808e9bdc317aba963f33054db2dbebdfeecd
F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
F src/vdbeInt.h cb02cbbceddf3b40d49012e9f41576f17bcbec97
F src/vdbeapi.c 37d793559390bec8a00c556f651f21b5f9e589af
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
F test/incrblob.test ebfee15334f33dae682d3161acff9c4d169d4672
F test/incrblob_err.test 9f78c159279c992fa5ce49c06f50b680fc470520
-F test/incrvacuum.test 2173bc075c7b3b96ccf228d737dd4f5c29500dc4
-F test/incrvacuum2.test c8c33a6e2b7ddfaa7256ae84a776e22cce9c920e
-F test/incrvacuum_ioerr.test 0ebc382bcc2036ec58cf49cc5ffada45f75d907b
+F test/incrvacuum.test f490c8ae86f2ecca622425d02e27d3119058cb21
+F test/incrvacuum2.test a1457ad2441e49e99fbc4d74f9575dd9f7ddbde3
+F test/incrvacuum_ioerr.test cb331403b8dea3c5bae6163861ff25037b0df56a
F test/index.test e65df12bed94b2903ee89987115e1578687e9266
F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
-F tool/mkkeywordhash.c 39eb0ff0bc3faf8deea67b44fddcb64a29a27521
+F tool/mkkeywordhash.c fe15d1cbc61c2b0375634b6d8c1ef24520799ea0
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/mksqlite3c.tcl fa0429d32cb0756b23def531ec863bc0e216f375
F tool/mksqlite3internalh.tcl a85bb0c812db1a060e6e6dfab4e4c817f53d194b
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P ed713f9ccb5d0f306a79ab9931e43db2327fb435
-R 5a6e4b5dc3429e2f2a7bdff2ac75dece
+P 681216767d7fabfccb0b12f6a81b18b6d1c252bf
+R 95c89ba898130ee0ba9ae5e0f60736ff
U drh
-Z 72fb146ed224d9e10bb3659cbe4d7ad5
+Z f926a6c2de5eba8d75508bc0c0193258
-681216767d7fabfccb0b12f6a81b18b6d1c252bf
\ No newline at end of file
+b13e497a326697ab42b429993a1eee7df3c0c3eb
\ No newline at end of file
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.424 2007/05/04 16:14:38 drh Exp $
+** $Id: build.c,v 1.425 2007/05/04 18:30:41 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
}
return pKey;
}
-
-#ifndef SQLITE_OMIT_AUTOVACUUM
-/*
-** This is called to compile a statement of the form "INCREMENTAL VACUUM".
-*/
-void sqlite3IncrVacuum(Parse *pParse, Token *pLimit){
- Vdbe *v = sqlite3GetVdbe(pParse);
- int iLimit;
- if( pLimit==0 || !sqlite3GetInt32((char*)pLimit->z, &iLimit) ){
- iLimit = 0x7fffffff;
- }
- if( v ){
- int addr;
- sqlite3BeginWriteOperation(pParse, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemInt, iLimit, 0);
- addr = sqlite3VdbeAddOp(v, OP_IncrVacuum, 0, 0);
- sqlite3VdbeAddOp(v, OP_Callback, 0, 0);
- sqlite3VdbeAddOp(v, OP_MemIncr, -1, 0);
- sqlite3VdbeAddOp(v, OP_IfMemPos, 0, addr);
- sqlite3VdbeJumpHere(v, addr);
- }
-}
-#endif /* #ifndef SQLITE_OMIT_AUTOVACUUM */
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.221 2007/05/04 16:14:38 drh Exp $
+** @(#) $Id: parse.y,v 1.222 2007/05/04 18:30:41 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
%fallback ID
ABORT AFTER ANALYZE ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
- INCREMENTAL IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH PLAN
+ IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH PLAN
QUERY KEY OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW
TEMP TRIGGER VACUUM VIEW VIRTUAL
%ifdef SQLITE_OMIT_COMPOUND_SELECT
%endif SQLITE_OMIT_ATTACH
%endif SQLITE_OMIT_VACUUM
-%ifndef SQLITE_OMIT_AUTOVACUUM
-cmd ::= INCREMENTAL VACUUM. {sqlite3IncrVacuum(pParse, 0);}
-cmd ::= INCREMENTAL VACUUM INTEGER(X). {sqlite3IncrVacuum(pParse, &X);}
-%endif
-
///////////////////////////// The PRAGMA command /////////////////////////////
//
%ifndef SQLITE_OMIT_PRAGMA
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.133 2007/04/26 14:42:36 danielk1977 Exp $
+** $Id: pragma.c,v 1.134 2007/05/04 18:30:41 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
}else
#endif
+ /*
+ ** PRAGMA [database.]incremental_vacuum(N)
+ **
+ ** Do N steps of incremental vacuuming on a database.
+ */
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( sqlite3StrICmp(zLeft,"incremental_vacuum")==0 ){
+ int iLimit, addr;
+ if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
+ iLimit = 0x7fffffff;
+ }
+ sqlite3BeginWriteOperation(pParse, 0, iDb);
+ sqlite3VdbeAddOp(v, OP_MemInt, iLimit, 0);
+ addr = sqlite3VdbeAddOp(v, OP_IncrVacuum, iDb, 0);
+ sqlite3VdbeAddOp(v, OP_Callback, 0, 0);
+ sqlite3VdbeAddOp(v, OP_MemIncr, -1, 0);
+ sqlite3VdbeAddOp(v, OP_IfMemPos, 0, addr);
+ sqlite3VdbeJumpHere(v, addr);
+ }else
+#endif
+
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** PRAGMA [database.]cache_size
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.555 2007/05/04 16:14:38 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.556 2007/05/04 18:30:41 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
FuncDef *sqlite3VtabOverloadFunction(FuncDef*, int nArg, Expr*);
void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);
int sqlite3Reprepare(Vdbe*);
-void sqlite3IncrVacuum(Parse *pParse, Token*);
#ifdef SQLITE_SSE
#include "sseInt.h"
** 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.606 2007/05/04 13:15:56 drh Exp $
+** $Id: vdbe.c,v 1.607 2007/05/04 18:30:41 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#endif
#if !defined(SQLITE_OMIT_AUTOVACUUM)
-/* Opcode: IncrVacuum * P2 *
+/* Opcode: IncrVacuum P1 P2 *
**
** Perform a single step of the incremental vacuum procedure on
-** the main database. If the vacuum has finished, jump to instruction
+** the P1 database. If the vacuum has finished, jump to instruction
** P2. Otherwise, fall through to the next instruction.
*/
case OP_IncrVacuum: { /* no-push */
- Btree *pBt = db->aDb[0].pBt;
+ Btree *pBt;
+
+ assert( pOp->p1>=0 && pOp->p1<db->nDb );
+ pBt = db->aDb[pOp->p1].pBt;
rc = sqlite3BtreeIncrVacuum(pBt);
if( rc==SQLITE_DONE ){
pc = pOp->p2 - 1;
# Note: There are also some tests for incremental vacuum and IO
# errors in incrvacuum_ioerr.test.
#
-# $Id: incrvacuum.test,v 1.5 2007/05/02 17:54:56 drh Exp $
+# $Id: incrvacuum.test,v 1.6 2007/05/04 18:30:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#---------------------------------------------------------------------
# Try to run a very simple incremental vacuum. Also verify that
-# INCREMENTAL VACUUM is a harmless no-op against a database that
+# PRAGMA incremental_vacuum is a harmless no-op against a database that
# does not support auto-vacuum.
#
do_test incrvacuum-4.1 {
} {5}
do_test incrvacuum-4.3 {
set ::nStep 0
- db eval {INCREMENTAL VACUUM} {
+ db eval {pragma incremental_vacuum(10)} {
incr ::nStep
}
list [expr {[file size test.db] / 1024}] $::nStep
execsql {
BEGIN;
DROP TABLE tbl2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
COMMIT;
}
expr {[file size test.db] / 1024}
BEGIN;
CREATE TABLE tbl1(a);
INSERT INTO tbl1 VALUES($::str);
- INCREMENTAL VACUUM; -- this is a no-op.
+ PRAGMA incremental_vacuum; -- this is a no-op.
COMMIT;
}
expr {[file size test.db] / 1024}
do_test incrvacuum-5.2.3 {
execsql {
BEGIN;
- INCREMENTAL VACUUM; -- Vacuum up the two pages.
+ PRAGMA incremental_vacuum; -- Vacuum up the two pages.
CREATE TABLE tbl2(b); -- Use one free page as a table root.
INSERT INTO tbl2 VALUES('a nice string');
COMMIT;
execsql {
DROP TABLE tbl1;
DROP TABLE tbl2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
}
expr {[file size test.db] / 1024}
} {1}
INSERT INTO t2 SELECT a, b FROM t1;
INSERT INTO t1 SELECT b, a FROM t2;
UPDATE t2 SET b = '';
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
} {
UPDATE t2 SET b = (SELECT b FROM t1 WHERE t1.oid = t2.oid);
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
} {
CREATE TABLE t3(a, b);
INSERT INTO t3 SELECT * FROM t2;
DROP TABLE t2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
} {
CREATE INDEX t3_i ON t3(a);
COMMIT;
} {
BEGIN;
DROP INDEX t3_i;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
INSERT INTO t3 VALUES('hello', 'world');
ROLLBACK;
} {
execsql {
DROP TABLE IF EXISTS tbl1;
DROP TABLE IF EXISTS tbl2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
CREATE TABLE tbl1(a, b);
CREATE TABLE tbl2(a, b);
BEGIN;
set ::nRow 0
db eval {SELECT a FROM tbl2} {} {
if {$a == [expr $jj*100]} {
- db eval {INCREMENTAL VACUUM}
+ db eval {PRAGMA incremental_vacuum}
}
incr ::nRow
}
execsql {
DROP TABLE IF EXISTS tbl1;
DROP TABLE IF EXISTS tbl2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
CREATE TABLE tbl1(a, b);
CREATE TABLE tbl2(a, b);
BEGIN;
do_test incrvacuum-7.${::iWrite}.2 {
set ::nRow 0
- db eval {INCREMENTAL VACUUM} {
+ db eval {PRAGMA incremental_vacuum} {
incr ::nRow
if {$::nRow == $::iWrite} {
db eval {
# This file implements regression tests for SQLite library. The
# focus of this file is testing the incremental vacuum feature.
#
-# $Id: incrvacuum2.test,v 1.1 2007/05/04 16:14:39 drh Exp $
+# $Id: incrvacuum2.test,v 1.2 2007/05/04 18:30:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#
do_test incrvacuum2-1.2 {
execsql {
- INCREMENTAL VACUUM 1
+ PRAGMA incremental_vacuum(1);
}
file size test.db
} {31744}
#
do_test incrvacuum2-1.3 {
execsql {
- INCREMENTAL VACUUM 5
+ PRAGMA incremental_vacuum(5);
}
file size test.db
} {26624}
#
do_test incrvacuum2-1.4 {
execsql {
- INCREMENTAL VACUUM 1000
+ PRAGMA incremental_vacuum(1000);
}
file size test.db
} {3072}
+# Make sure incremental vacuum works on attached databases.
+#
+do_test incrvacuum2-2.1 {
+ file delete -force test2.db test2.db-journal
+ execsql {
+ ATTACH DATABASE 'test2.db' AS aux;
+ PRAGMA aux.auto_vacuum=incremental;
+ CREATE TABLE aux.t2(x);
+ INSERT INTO t2 VALUES(zeroblob(30000));
+ INSERT INTO t1 SELECT * FROM t2;
+ DELETE FROM t2;
+ DELETE FROM t1;
+ }
+ list [file size test.db] [file size test2.db]
+} {32768 32768}
+do_test incrvacuum2-2.2 {
+ execsql {
+ PRAGMA aux.incremental_vacuum(1)
+ }
+ list [file size test.db] [file size test2.db]
+} {32768 31744}
+do_test incrvacuum2-2.3 {
+ execsql {
+ PRAGMA aux.incremental_vacuum(5)
+ }
+ list [file size test.db] [file size test2.db]
+} {32768 26624}
+do_test incrvacuum2-2.4 {
+ execsql {
+ PRAGMA main.incremental_vacuum(5)
+ }
+ list [file size test.db] [file size test2.db]
+} {27648 26624}
+do_test incrvacuum2-2.5 {
+ execsql {
+ PRAGMA aux.incremental_vacuum
+ }
+ list [file size test.db] [file size test2.db]
+} {27648 3072}
+do_test incrvacuum2-2.6 {
+ execsql {
+ PRAGMA incremental_vacuum(1)
+ }
+ list [file size test.db] [file size test2.db]
+} {26624 3072}
+
+
+
finish_test
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
-# $Id: incrvacuum_ioerr.test,v 1.1 2007/04/28 15:47:45 danielk1977 Exp $
+# $Id: incrvacuum_ioerr.test,v 1.2 2007/05/04 18:30:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
BEGIN;
CREATE TABLE abc2(a);
DELETE FROM abc;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
COMMIT;
}
db eval COMMIT
} -sqlbody {
BEGIN;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
DELETE FROM abc WHERE (oid%3)==0;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
INSERT INTO abc SELECT a || '1234567890' FROM abc WHERE oid%2;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
CREATE INDEX abc_i ON abc(a);
DELETE FROM abc WHERE (oid%2)==0;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
DROP INDEX abc_i;
- INCREMENTAL VACUUM;
+ PRAGMA incremental_vacuum;
COMMIT;
}
finish_test
-
"**\n"
"** The code in this file has been automatically generated by\n"
"**\n"
- "** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.29 2007/05/04 17:07:53 drh Exp $\n"
+ "** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.30 2007/05/04 18:30:41 drh Exp $\n"
"**\n"
"** The code in this file implements a function that determines whether\n"
"** or not a given identifier is really an SQL keyword. The same thing\n"
{ "IGNORE", "TK_IGNORE", CONFLICT|TRIGGER },
{ "IMMEDIATE", "TK_IMMEDIATE", ALWAYS },
{ "IN", "TK_IN", ALWAYS },
- { "INCREMENTAL", "TK_INCREMENTAL", AUTOVACUUM },
{ "INDEX", "TK_INDEX", ALWAYS },
{ "INITIALLY", "TK_INITIALLY", FKEY },
{ "INNER", "TK_JOIN_KW", ALWAYS },