Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Optional parameter in the INCREMENTAL VACUUM statement specifies how many pages to vacuum from the database. (CVS 3919) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ed713f9ccb5d0f306a79ab9931e43db2 |
User & Date: | drh 2007-05-04 16:14:38.000 |
Context
2007-05-04
| ||
17:07 | Tighter compression of the keyword hash table. (CVS 3920) (check-in: 681216767d user: drh tags: trunk) | |
16:14 | Optional parameter in the INCREMENTAL VACUUM statement specifies how many pages to vacuum from the database. (CVS 3919) (check-in: ed713f9ccb user: drh tags: trunk) | |
14:36 | Get tests working with SQLITE_OMIT_AUTOVACUUM=1. (CVS 3918) (check-in: b94d39e4d9 user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** ** $Id: build.c,v 1.424 2007/05/04 16:14:38 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to ** be parsed. Initialize the pParse structure as needed. |
︙ | ︙ | |||
3352 3353 3354 3355 3356 3357 3358 | return pKey; } #ifndef SQLITE_OMIT_AUTOVACUUM /* ** This is called to compile a statement of the form "INCREMENTAL VACUUM". */ | | > > > > > | | | | > | 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 | 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 */ |
Changes to src/parse.y.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** 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 $ */ // All token codes are small integers with #defines that begin with "TK_" %token_prefix TK_ // The type of the data attached to each token is Token. This is also the // default type for non-terminals. |
︙ | ︙ | |||
900 901 902 903 904 905 906 | %ifndef SQLITE_OMIT_ATTACH cmd ::= VACUUM. {sqlite3Vacuum(pParse);} cmd ::= VACUUM nm. {sqlite3Vacuum(pParse);} %endif SQLITE_OMIT_ATTACH %endif SQLITE_OMIT_VACUUM %ifndef SQLITE_OMIT_AUTOVACUUM | | > | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | %ifndef SQLITE_OMIT_ATTACH cmd ::= VACUUM. {sqlite3Vacuum(pParse);} cmd ::= VACUUM nm. {sqlite3Vacuum(pParse);} %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 cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);} cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);} |
︙ | ︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.555 2007/05/04 16:14:38 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ #if defined(SQLITE_TCL) || defined(TCLSH) # include <tcl.h> #endif |
︙ | ︙ | |||
1910 1911 1912 1913 1914 1915 1916 | int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); int sqlite3VtabCallConnect(Parse*, Table*); int sqlite3VtabCallDestroy(sqlite3*, int, const char *); int sqlite3VtabBegin(sqlite3 *, sqlite3_vtab *); FuncDef *sqlite3VtabOverloadFunction(FuncDef*, int nArg, Expr*); void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**); int sqlite3Reprepare(Vdbe*); | | | 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 | int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); int sqlite3VtabCallConnect(Parse*, Table*); int sqlite3VtabCallDestroy(sqlite3*, int, const char *); int sqlite3VtabBegin(sqlite3 *, sqlite3_vtab *); 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" #endif /* ** If the SQLITE_ENABLE IOTRACE exists then the global variable |
︙ | ︙ |
Added test/incrvacuum2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # 2007 May 04 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # 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 $ set testdir [file dirname $argv0] source $testdir/tester.tcl # If this build of the library does not support auto-vacuum, omit this # whole file. ifcapable {!autovacuum || !pragma} { finish_test return } # Create a database in incremental vacuum mode that has many # pages on the freelist. # do_test incrvacuum2-1.1 { execsql { PRAGMA page_size=1024; PRAGMA auto_vacuum=incremental; CREATE TABLE t1(x); INSERT INTO t1 VALUES(zeroblob(30000)); DELETE FROM t1; } file size test.db } {32768} # Vacuum off a single page. # do_test incrvacuum2-1.2 { execsql { INCREMENTAL VACUUM 1 } file size test.db } {31744} # Vacuum off five pages # do_test incrvacuum2-1.3 { execsql { INCREMENTAL VACUUM 5 } file size test.db } {26624} # Vacuum off all the rest # do_test incrvacuum2-1.4 { execsql { INCREMENTAL VACUUM 1000 } file size test.db } {3072} finish_test |