mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Auto-vacuum bug: Don't set meta(3) to a pointer-map page number when deleting a table. (CVS 2066)
FossilOrigin-Name: 44a015b3a3bbecc4ec1e02bb371d3274e2b6edf3
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sallocation\sof\stables\sin\san\sauto-vacuum\sdatabase\swhen\sthe\srequired\sroot-page\sis\son\sthe\sfree-list.\s(CVS\s2065)
|
||||
D 2004-11-05T12:27:02
|
||||
C Auto-vacuum\sbug:\sDon't\sset\smeta(3)\sto\sa\spointer-map\spage\snumber\swhen\sdeleting\sa\stable.\s(CVS\s2066)
|
||||
D 2004-11-05T12:58:25
|
||||
F Makefile.in c4d2416860f472a1e3393714d0372074197565df
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
|
||||
@@ -29,7 +29,7 @@ F sqlite3.def dbaeb20c153e1d366e8f421b55a573f5dfc00863
|
||||
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
|
||||
F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
|
||||
F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
|
||||
F src/btree.c 659bb0c16b7b2429ff93a2260a051576ccde0a0b
|
||||
F src/btree.c 6a61345b550be1040b208c5191911676fd9fee72
|
||||
F src/btree.h 3166388fa58c5594d8064d38b43440d79da38fb6
|
||||
F src/build.c dc8b9ab836f2323d9b313c2d703b00b2e9441382
|
||||
F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad
|
||||
@@ -87,7 +87,7 @@ F test/attach.test e305dd59a375e37c658c6d401f19f8a95880bf9a
|
||||
F test/attach2.test 399128a7b3b209a339a8dbf53ca2ed42eb982d1a
|
||||
F test/attach3.test 287af46653e7435b2d1eda10d8115dcc8a6883e2
|
||||
F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21
|
||||
F test/autovacuum.test b2ba86ec6ab2734232f299769be0c7c0c41939a1
|
||||
F test/autovacuum.test 7878efa67268228299ed3759694bb43795b9ffa0
|
||||
F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f
|
||||
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
|
||||
F test/bind.test fa74f98417cd313f28272acff832a8a7d04a0916
|
||||
@@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
|
||||
P fdcc31f0c6106dacfed6612b173fe4be3c02546a
|
||||
R 07fa558cc5210292e3d2899ca22b721c
|
||||
P 4e2433378e06210f0274c317c6d12b48236211fe
|
||||
R 26dd7f873a531a66e4d8d063a7f19d9e
|
||||
U danielk1977
|
||||
Z e28ed5c0b538966881c79d2d34296784
|
||||
Z 498d47c900b187710dd7df26608c1fd2
|
||||
|
@@ -1 +1 @@
|
||||
4e2433378e06210f0274c317c6d12b48236211fe
|
||||
44a015b3a3bbecc4ec1e02bb371d3274e2b6edf3
|
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.208 2004/11/05 12:27:02 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.209 2004/11/05 12:58:25 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@@ -4582,7 +4582,11 @@ int sqlite3BtreeDropTable(Btree *pBt, int iTable, int *piMoved){
|
||||
*piMoved = maxRootPgno;
|
||||
}
|
||||
|
||||
rc = sqlite3BtreeUpdateMeta(pBt, 4, maxRootPgno-1);
|
||||
maxRootPgno--;
|
||||
if( maxRootPgno==PTRMAP_PAGENO(pBt->pageSize, maxRootPgno) ){
|
||||
maxRootPgno--;
|
||||
}
|
||||
rc = sqlite3BtreeUpdateMeta(pBt, 4, maxRootPgno);
|
||||
}else{
|
||||
rc = freePage(pPage);
|
||||
releasePage(pPage);
|
||||
|
@@ -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.7 2004/11/05 12:27:03 danielk1977 Exp $
|
||||
# $Id: autovacuum.test,v 1.8 2004/11/05 12:58:26 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -249,5 +249,46 @@ do_test autovacuum-2.4.3 {
|
||||
}
|
||||
} {3 4 5 6 7 8 9 10}
|
||||
|
||||
# Right now there are 5 free pages in the database. Consume and then free
|
||||
# a 520 pages. Then create 520 tables. This ensures that at least some of the
|
||||
# desired root-pages reside on the second free-list trunk page, and that the
|
||||
# trunk itself is required at some point.
|
||||
do_test autovacuum-2.4.4 {
|
||||
execsql "
|
||||
INSERT INTO av3 VALUES ('[make_str abcde [expr 1020*520 + 500]]');
|
||||
DELETE FROM av3;
|
||||
"
|
||||
} {}
|
||||
set root_page_list [list]
|
||||
for {set i 3} {$i<=532} {incr i} {
|
||||
# 207 and 412 are pointer-map pages.
|
||||
if { $i!=207 && $i!=412 } {
|
||||
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)"
|
||||
}
|
||||
execsql {
|
||||
SELECT rootpage FROM sqlite_master ORDER by rootpage
|
||||
}
|
||||
} $root_page_list
|
||||
|
||||
# Just for fun, delete all those tables and see if the database is 1 page.
|
||||
do_test autovacuum-2.4.6 {
|
||||
execsql COMMIT;
|
||||
file_pages
|
||||
} 561
|
||||
integrity_check autovacuum-2.4.6
|
||||
do_test autovacuum-2.4.7 {
|
||||
execsql BEGIN
|
||||
for {set i 3} {$i<=530} {incr i} {
|
||||
execsql "DROP TABLE av$i"
|
||||
}
|
||||
execsql COMMIT
|
||||
file_pages
|
||||
} 1
|
||||
|
||||
finish_test
|
||||
|
||||
|
Reference in New Issue
Block a user