aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest16
-rw-r--r--manifest.uuid2
-rw-r--r--src/btree.c6
-rw-r--r--src/vacuum.c14
-rw-r--r--test/pagesize.test124
5 files changed, 135 insertions, 27 deletions
diff --git a/manifest b/manifest
index 3cbdd4753..7bf627a5e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scomment.\s(CVS\s1938)
-D 2004-09-03T23:32:19
+C Make\sVACUUM\swork\swhen\sthe\spage\ssize\sis\sdifferent\sthan\sthe\sdefault\s1024.\nTicket\s#890.\s(CVS\s1939)
+D 2004-09-05T00:33:43
F Makefile.in 65a7c43fcaf9a710d62f120b11b6e435eeb4a450
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -28,7 +28,7 @@ F sqlite3.def 84215604aa7b547d75e0f7b437966e7ad18fa8b2
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
F src/attach.c 0bd4f11da6999665da30625665a4096ba7898de6
F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
-F src/btree.c fd5e339c83459ea42fb055f0e59c0a682b0da422
+F src/btree.c fe763fde639793ef2010d5388d0d135ecc02b4eb
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
F src/build.c 35275654d9c5ce6c1c0c78e391f85e6915a8a66b
F src/date.c edff4aa851eeca8abbc737dc3933a2f0671156ce
@@ -74,7 +74,7 @@ F src/trigger.c 40e10f4b219b55e56478bc17480ce77654300e8d
F src/update.c bbe126c67529bd699016af2d72bc4ceb8fd41527
F src/utf.c 328890099db492dda5620ee5f924e244c6e57ff7
F src/util.c d5aaf211543fb6e285654fada50252c857ac78aa
-F src/vacuum.c 47bf6837d39f5849b8eda7d037d3e21a26f736bc
+F src/vacuum.c c5f11bf25e49479940133d1bb882ad2a5d6fa021
F src/vdbe.c 45f659497b479f001c2f4e8251474aba3975b9f8
F src/vdbe.h e081c72cd0f7c19d49b1927460aeefcf0fbc85ac
F src/vdbeInt.h f8df57a9dc272967991f806e612628e0aa57e705
@@ -151,7 +151,7 @@ F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
F test/pager.test 059cc5c58d3b5a851343dff8c56cf7286425d03a
F test/pager2.test 55469c7c1c1a54d6b32d7b3cc99001e90101a1ce
F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b
-F test/pagesize.test ada866e3d8bad7ec252d5131e2fd4d892b8fef8d
+F test/pagesize.test f8b46ec46b9fe9f708a8d757dda232588dfb7217
F test/pragma.test 66a66b7f3b273b93325c9a5794acb418f52fdcbf
F test/printf.test 5a30fb0d736148fca64cb1b7ed0390be7414e024
F test/progress.test 76c722f090b1ccb575e7e4e203a71608c5763beb x
@@ -248,7 +248,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 4595292f936bdbec10734f42682824e91ff71d11
-R a6a2c4ff901213b63bfaa0048bce9198
+P af44ddeea110576bf9c475b5e6e3540ee50c5edf
+R afb470c685b393383d09d5ee609f260e
U drh
-Z c9eae4290234a644b3110522f8908fc1
+Z 341c14103181636b02bfc0ae91fe7a33
diff --git a/manifest.uuid b/manifest.uuid
index 774a88702..28bb6118f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-af44ddeea110576bf9c475b5e6e3540ee50c5edf \ No newline at end of file
+fa82becae7e41c47a6387061932f692c6f9f472e \ No newline at end of file
diff --git a/src/btree.c b/src/btree.c
index 9470d6008..669ef1973 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.187 2004/09/03 23:32:19 drh Exp $
+** $Id: btree.c,v 1.188 2004/09/05 00:33:43 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -1145,7 +1145,7 @@ int sqlite3BtreeSetPageSize(Btree *pBt, int pageSize, int nReserve){
if( nReserve<0 ){
nReserve = pBt->pageSize - pBt->usableSize;
}
- if( pageSize>512 && pageSize<SQLITE_MAX_PAGE_SIZE ){
+ if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE ){
pBt->pageSize = pageSize;
sqlite3pager_set_pagesize(pBt->pPager, pageSize);
}
@@ -1225,7 +1225,6 @@ static int lockBtree(Btree *pBt){
}
assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
pBt->pPage1 = pPage1;
- pBt->pageSizeFixed = 1;
return SQLITE_OK;
page1_init_failed:
@@ -1283,6 +1282,7 @@ static int newDatabase(Btree *pBt){
data[23] = pBt->minLeafFrac;
memset(&data[24], 0, 100-24);
zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );
+ pBt->pageSizeFixed = 1;
return SQLITE_OK;
}
diff --git a/src/vacuum.c b/src/vacuum.c
index 5602ed501..9141cfe8e 100644
--- a/src/vacuum.c
+++ b/src/vacuum.c
@@ -14,7 +14,7 @@
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
-** $Id: vacuum.c,v 1.29 2004/09/02 15:27:42 drh Exp $
+** $Id: vacuum.c,v 1.30 2004/09/05 00:33:43 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -98,6 +98,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){
int nFilename; /* number of characters in zFilename[] */
char *zTemp = 0; /* a temporary file in same directory as zFilename */
int i; /* Loop counter */
+ Btree *pMain; /* The database being vacuumed */
Btree *pTemp;
char *zSql = 0;
@@ -111,7 +112,8 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){
/* Get the full pathname of the database file and create a
** temporary filename in the same directory as the original file.
*/
- zFilename = sqlite3BtreeGetFilename(db->aDb[0].pBt);
+ pMain = db->aDb[0].pBt;
+ zFilename = sqlite3BtreeGetFilename(pMain);
assert( zFilename );
if( zFilename[0]=='\0' ){
/* The in-memory database. Do nothing. Return directly to avoid causing
@@ -150,7 +152,11 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){
sqliteFree(zSql);
zSql = 0;
if( rc!=SQLITE_OK ) goto end_of_vacuum;
- execSql(db, "PRAGMA vacuum_db.synchronous = off;");
+ assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
+ pTemp = db->aDb[db->nDb-1].pBt;
+ sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), 0);
+ assert( sqlite3BtreeGetPageSize(pTemp)==sqlite3BtreeGetPageSize(pMain) );
+ execSql(db, "PRAGMA vacuum_db.synchronous=OFF");
/* Begin a transaction */
rc = execSql(db, "BEGIN;");
@@ -206,9 +212,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){
** opened for writing. This way, the SQL transaction used to create the
** temporary database never needs to be committed.
*/
- pTemp = db->aDb[db->nDb-1].pBt;
if( sqlite3BtreeIsInTrans(pTemp) ){
- Btree *pMain = db->aDb[0].pBt;
u32 meta;
assert( 0==sqlite3BtreeIsInTrans(pMain) );
diff --git a/test/pagesize.test b/test/pagesize.test
index cebce11aa..f794a8f45 100644
--- a/test/pagesize.test
+++ b/test/pagesize.test
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA.
#
-# $Id: pagesize.test,v 1.2 2004/09/02 15:49:08 drh Exp $
+# $Id: pagesize.test,v 1.3 2004/09/05 00:33:44 drh Exp $
set testdir [file dirname $argv0]
@@ -30,27 +30,131 @@ do_test pagesize-1.3 {
PRAGMA page_size;
}
} 1024
+
do_test pagesize-1.4 {
db close
file delete -force test.db
sqlite3 db test.db
execsql {
- PRAGMA page_size=2048;
- CREATE TABLE t1(a);
+ PRAGMA page_size=511;
PRAGMA page_size;
}
-} 2048
+} 1024
do_test pagesize-1.5 {
- db close
- sqlite3 db test.db
execsql {
- PRAGMA page_size
+ PRAGMA page_size=512;
+ PRAGMA page_size;
}
-} 2048
+} 512
do_test pagesize-1.6 {
- file size test.db
-} 4096
+ execsql {
+ PRAGMA page_size=8192;
+ PRAGMA page_size;
+ }
+} 8192
+do_test pagesize-1.7 {
+ execsql {
+ PRAGMA page_size=65537;
+ PRAGMA page_size;
+ }
+} 8192
+
+foreach PGSZ {512 2000 2048 3000 4096} {
+ do_test pagesize-2.$PGSZ.1 {
+ db close
+ file delete -force test.db
+ sqlite3 db test.db
+ execsql "PRAGMA page_size=$PGSZ"
+ execsql {
+ CREATE TABLE t1(x);
+ PRAGMA page_size;
+ }
+ } $PGSZ
+ do_test pagesize-2.$PGSZ.2 {
+ db close
+ sqlite3 db test.db
+ execsql {
+ PRAGMA page_size
+ }
+ } $PGSZ
+ do_test pagesize-2.$PGSZ.3 {
+ file size test.db
+ } [expr {$PGSZ*2}]
+ do_test pagesize-2.$PGSZ.4 {
+ execsql {VACUUM}
+ } {}
+ integrity_check pagesize-2.$PGSZ.5
+ do_test pagesize-2.$PGSZ.6 {
+ db close
+ sqlite3 db test.db
+ execsql {PRAGMA page_size}
+ } $PGSZ
+ do_test pagesize-2.$PGSZ.7 {
+ execsql {
+ INSERT INTO t1 VALUES(randstr(10,9000));
+ INSERT INTO t1 VALUES(randstr(10,9000));
+ INSERT INTO t1 VALUES(randstr(10,9000));
+ BEGIN;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ SELECT count(*) FROM t1;
+ }
+ } 48
+ do_test pagesize-2.$PGSZ.8 {
+ execsql {
+ ROLLBACK;
+ SELECT count(*) FROM t1;
+ }
+ } 3
+ integrity_check pagesize-2.$PGSZ.9
+ do_test pagesize-2.$PGSZ.10 {
+ db close
+ sqlite3 db test.db
+ execsql {PRAGMA page_size}
+ } $PGSZ
+ do_test pagesize-2.$PGSZ.11 {
+ execsql {
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ INSERT INTO t1 SELECT x||x FROM t1;
+ SELECT count(*) FROM t1;
+ }
+ } 192
+ do_test pagesize-2.$PGSZ.12 {
+ execsql {
+ BEGIN;
+ DELETE FROM t1 WHERE rowid%5!=0;
+ SELECT count(*) FROM t1;
+ }
+ } 38
+ do_test pagesize-2.$PGSZ.13 {
+ execsql {
+ ROLLBACK;
+ SELECT count(*) FROM t1;
+ }
+ } 192
+ integrity_check pagesize-2.$PGSZ.14
+ do_test pagesize-2.$PGSZ.15 {
+ execsql {
+ DELETE FROM t1 WHERE rowid%5!=0;
+ VACUUM;
+ SELECT count(*) FROM t1;
+ }
+ } 38
+ do_test pagesize-2.$PGSZ.16 {
+ execsql {
+ DROP TABLE t1;
+ VACUUM;
+ }
+ } {}
+ integrity_check pagesize-2.$PGSZ.17
+}
finish_test