Fix an auto-vacuum problem with the PENDING_BYTE page. Also link the Tcl

variable sqlite_pending_byte to the internal pending-byte location when in test mode. (CVS 2700)

FossilOrigin-Name: 9115e0621d1fdc5a89a0288b87c0a4ce1e4b50c6
This commit is contained in:
danielk1977 2005-09-16 09:52:29 +00:00
parent a2833a0cf6
commit fd5f5b65b4
6 changed files with 34 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Documentation\schanges\sin\spreparation\sfor\sthe\srelease\sof\s3.2.6.\s(CVS\s2698)
D 2005-09-16T02:55:14
C Fix\san\sauto-vacuum\sproblem\swith\sthe\sPENDING_BYTE\spage.\sAlso\slink\sthe\sTcl\nvariable\ssqlite_pending_byte\sto\sthe\sinternal\spending-byte\slocation\swhen\sin\stest\smode.\s(CVS\s2700)
D 2005-09-16T09:52:29
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -32,7 +32,7 @@ F src/alter.c 26d755f2143719dd3f5b8aaf6cbe3c7f95332528
F src/analyze.c 43a2d91242bdd71b6c299378f6b11e896ee5e43d
F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
F src/btree.c a1ee183067f20eb5ba33ca45ed47acbc7214fe44
F src/btree.c b2dedc955bc1778f5e6b23ae4c26625fc24f15d0
F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e
F src/build.c 74653e045581bfbadb8b35a0cb38a62f4a2c850e
F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b
@ -48,7 +48,7 @@ F src/insert.c 484c73bc1309f283a31baa0e114f3ee980536397
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c bf88855445d365b497070d85e3faa0579a9edb91
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h c9fd9f92f176a5ea22e0101fcc1e85d532844dd1
F src/os.h 5a0a42555a750f334b7da973776803a0e3cc263a
F src/os_common.h bd6ede01998c19dbfd3c21fbfd13f4b9532dd7df
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
@ -70,7 +70,7 @@ F src/sqliteInt.h cc685a74a0458bc41a34131e7c0b217654558b6c
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a
F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481
F src/test2.c 4f89ffd7aa96dfbd4b764e62bb823670231554a0
F src/test2.c f5b438bc80110ef17a248f09b58096d7d81d602e
F src/test3.c f4e6a16a602091696619a1171bda25c0e3df49f7
F src/test4.c a8fd681e139e1c61f22a77d07fc3a99cb28fff3f
F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
@ -101,7 +101,7 @@ F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe
F test/attachmalloc.test cdb26c42850f04698377ccec05f5fa89d987837c
F test/auth.test 973ae7274eae32c4453fbbcbd0ec2b80c5b1eeb3
F test/autoinc.test 395fbac8bc158d3599995c73bfb15c418a5429f0
F test/autovacuum.test d2d0b2b86fd3b487d1e100fafcb03b1af6c23057
F test/autovacuum.test 9471d58a08b14dc0d2c15b87583c46d1744343d6
F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31
F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24
F test/autovacuum_ioerr2.test 2f8a3fb31f833fd0ca86ad4ad98913c73e807572
@ -307,7 +307,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 6017b1962517eb206183042bbb718925d9819063
R 4df1cc59dde685a8213cfe530f8669ae
U drh
Z 71dca7c577320c1b910b1be05beabb55
P 243f455c7c4e5c0c56406c197fa78088bc3659ca
R ae1b2d7426cc1dc2c291ee57cc0bc2b2
U danielk1977
Z 374ff94d0d685dd8205cbb0751850154

View File

@ -1 +1 @@
243f455c7c4e5c0c56406c197fa78088bc3659ca
9115e0621d1fdc5a89a0288b87c0a4ce1e4b50c6

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.266 2005/09/08 14:17:20 drh Exp $
** $Id: btree.c,v 1.267 2005/09/16 09:52:29 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -1875,7 +1875,7 @@ static int autoVacuumCommit(Btree *pBt, Pgno *nTrunc){
origSize = sqlite3pager_pagecount(pPager);
nPtrMap = (nFreeList-origSize+PTRMAP_PAGENO(pgsz, origSize)+pgsz/5)/(pgsz/5);
finSize = origSize - nFreeList - nPtrMap;
if( origSize>PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){
if( origSize>=PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){
finSize--;
if( PTRMAP_ISPAGE(pBt->usableSize, finSize) ){
finSize--;

View File

@ -161,8 +161,14 @@
** 1GB boundary.
**
*/
#ifndef SQLITE_TEST
#define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */
/* #define PENDING_BYTE 0x5400 // Page 22 - for testing */
#else
/* Defined in test2.c (pager tests) */
extern unsigned int sqlite3_pending_byte;
#define PENDING_BYTE sqlite3_pending_byte
#endif
#define RESERVED_BYTE (PENDING_BYTE+1)
#define SHARED_FIRST (PENDING_BYTE+2)
#define SHARED_SIZE 510

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test2.c,v 1.32 2005/09/09 10:46:19 drh Exp $
** $Id: test2.c,v 1.33 2005/09/16 09:52:29 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -555,6 +555,10 @@ static int fake_big_file(
}
#endif
#ifdef SQLITE_TEST
unsigned int sqlite3_pending_byte = 0x0010000;
#endif
/*
** Register commands with the TCL interpreter.
*/
@ -596,6 +600,8 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
(char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_diskfull",
(char*)&sqlite3_diskfull, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_pending_byte",
(char*)&sqlite3_pending_byte, TCL_LINK_INT);
Tcl_LinkVar(interp, "pager_pagesize",
(char*)&test_pagesize, TCL_LINK_INT);
return TCL_OK;

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
# $Id: autovacuum.test,v 1.18 2005/09/08 10:37:01 drh Exp $
# $Id: autovacuum.test,v 1.19 2005/09/16 09:52:30 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -279,12 +279,16 @@ do_test autovacuum-2.4.4 {
"
} {}
set root_page_list [list]
set pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
for {set i 3} {$i<=532} {incr i} {
# 207 and 412 are pointer-map pages.
if { $i!=207 && $i!=412 } {
if { $i!=207 && $i!=412 && $i != $pending_byte_page} {
lappend root_page_list $i
}
}
if {$i >= $pending_byte_page} {
lappend root_page_list $i
}
do_test autovacuum-2.4.5 {
for {set i 11} {$i<=530} {incr i} {
execsql "CREATE TABLE av$i (x)"
@ -298,7 +302,7 @@ do_test autovacuum-2.4.5 {
do_test autovacuum-2.4.6 {
execsql COMMIT;
file_pages
} 561
} [expr 561 + (($i >= $pending_byte_page)?1:0)]
integrity_check autovacuum-2.4.6
do_test autovacuum-2.4.7 {
execsql BEGIN