diff --git a/manifest b/manifest index 6c00dba6e7..bc4fda1370 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Explicit\scollations\salways\soverride\simplicit\scollations.\s\sThis\sis\nbackwards\scompatible\ssince\sSQLite\shas\snot\spreviously\ssupported\nexplicit\scollations.\sNeed\sto\sadd\stests\sof\sthis\snew\sbehavior.\s(CVS\s3633) -D 2007-02-07T13:09:46 +C Changes\sto\ssupport\sfragmentation\sanalysis\sin\ssqlite3_analyzer.\s(CVS\s3634) +D 2007-02-10T19:22:36 F Makefile.in 7fa74bf4359aa899da5586e394d17735f221315f F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -57,7 +57,7 @@ F src/alter.c 2c79ec40f65e33deaf90ca493422c74586e481a3 F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a F src/attach.c b11eb4d5d3fb99a10a626956bccc7215f6b68b16 F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f -F src/btree.c 51aef6a4b18df165b83b332befd1447c011b4389 +F src/btree.c 4d4bef16fbf4f53ec3b161cfe5bb19bbc27a281d F src/btree.h 066444ee25bd6e6accb997bfd2cf5ace14dbcd00 F src/build.c 6bd68dc730b01c1727738f8e4b5c730eb0ddb421 F src/callback.c 31d22b4919c7645cbcbb1591ce2453e8c677c558 @@ -102,7 +102,7 @@ F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06 F src/tclsqlite.c cd2b3b86ab07c0e0779f6c6e71e72c6c7dc1e704 F src/test1.c cb314bfa3e9251b545fa3669ec80a8c8a0a86310 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b -F src/test3.c 875126eab6749f9d9e2b60b6ee6a65825b3d1fed +F src/test3.c ed494a126221c4b9f66f8f0445554ad749764709 F src/test4.c 8b784cd82de158a2317cb4ac4bc86f91ad315e25 F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de @@ -360,6 +360,7 @@ F test/where2.test 61d5b20d9bedc8788a773bbdc5b2ef887725928e F test/where3.test 0a30fe9808b0fa01c46d0fcf4fac0bf6cf75bb30 F test/where4.test 3fcf53c5ea7af1db3980b3293c2a45b56605f26a F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b +F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/lemon.c 2938bec507110397c937bd8a03b0c9596a709a04 F tool/lempar.c fdc1672e97f72f72e76553038501da40fec9d251 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133 @@ -373,7 +374,7 @@ F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816 F tool/showdb.c a086a3d788c7a23cb008317c3180ceb19f20bce0 F tool/showjournal.c ec3b171be148656827c4949fbfb8ab4370822f87 F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b -F tool/spaceanal.tcl f4ca4843c137db16124d680523f466044d5f0ba2 +F tool/spaceanal.tcl 2614b0c929852547138d608f58535f33a49d27ec F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf @@ -431,7 +432,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 2bd4b62a20219f939ac2ac22440dc7fc0449f766 -R 7101481de1358da4b073980f7790ac38 +P 3638823a629164e4158f76d03ff2cea1eab34e9d +R 51a9ab370b25f99fa741aa9c670f3eea U drh -Z 02cb54f9b44027c71a4480afa634e551 +Z bcbf10610bf7092c876385c4549956cc diff --git a/manifest.uuid b/manifest.uuid index fee0860a9b..eb3f657c95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3638823a629164e4158f76d03ff2cea1eab34e9d \ No newline at end of file +bd6bc3b8f06919000fb082087dff7bbd335d07e9 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 8ac469ded9..2a223df898 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.334 2007/01/27 02:24:55 drh Exp $ +** $Id: btree.c,v 1.335 2007/02/10 19:22:36 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -5890,6 +5890,7 @@ int sqlite3BtreePageDump(Btree *p, int pgno, int recursive){ ** aResult[7] = Header size in bytes ** aResult[8] = Local payload size ** aResult[9] = Parent page number +** aResult[10]= Page number of the first overflow page ** ** This routine is used for testing and debugging only. */ @@ -5938,6 +5939,11 @@ int sqlite3BtreeCursorInfo(BtCursor *pCur, int *aResult, int upCnt){ }else{ aResult[9] = pPage->pParent->pgno; } + if( tmpCur.info.iOverflow ){ + aResult[10] = get4byte(&tmpCur.info.pCell[tmpCur.info.iOverflow]); + }else{ + aResult[10] = 0; + } releaseTempCursor(&tmpCur); return SQLITE_OK; } diff --git a/src/test3.c b/src/test3.c index 0f0184d0f4..99753ab6d2 100644 --- a/src/test3.c +++ b/src/test3.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test3.c,v 1.69 2007/01/27 02:24:56 drh Exp $ +** $Id: test3.c,v 1.70 2007/02/10 19:22:36 drh Exp $ */ #include "sqliteInt.h" #include "pager.h" @@ -577,7 +577,7 @@ static int btree_integrity_check( } pBt = sqlite3TextToPtr(argv[1]); nRoot = argc-2; - aRoot = malloc( sizeof(int)*(argc-2) ); + aRoot = (int*)malloc( sizeof(int)*(argc-2) ); for(i=0; i$prev_pgno+$MAXGAP) && $prev_pgno>0} { + incr gap_cnt + } + set prev_pgno $pg + } } btree_close_cursor $csr @@ -250,6 +274,7 @@ foreach {name rootpage} [db eval $sql] { append sql ",$unused_int" append sql ",$unused_leaf" append sql ",$unused_ovfl" + append sql ",$gap_cnt" append sql ); mem eval $sql } @@ -279,6 +304,8 @@ foreach {name tbl_name rootpage} [db eval $sql] { set mx_payload $wideZero ;# Maximum payload size set ovfl_pages $wideZero ;# Number of overflow pages used set leaf_pages $wideZero ;# Number of leaf pages + set gap_cnt 0 ;# Number of holes in the page sequence + set prev_pgno 0 ;# Last page number seen # As the btree is traversed, the array variable $seen($pgno) is set to 1 # the first time page $pgno is encountered. @@ -324,6 +351,11 @@ foreach {name tbl_name rootpage} [db eval $sql] { set seen($ci(page_no)) 1 incr leaf_pages incr unused_leaf $ci(page_freebytes) + set pg $ci(page_no) + if {$prev_pgno>0 && ($prev_pgno<$pg-$MAXGAP || $prev_pgno>$pg)} { + incr gap_cnt + } + set prev_pgno $ci(page_no) } } btree_close_cursor $csr @@ -355,6 +387,7 @@ foreach {name tbl_name rootpage} [db eval $sql] { append sql ",0" append sql ",$unused_leaf" append sql ",$unused_ovfl" + append sql ",$gap_cnt" append sql ); mem eval $sql } @@ -420,7 +453,8 @@ proc subreport {title where} { int(sum(ovfl_pages)) AS ovfl_pages, int(sum(leaf_unused)) AS leaf_unused, int(sum(int_unused)) AS int_unused, - int(sum(ovfl_unused)) AS ovfl_unused + int(sum(ovfl_unused)) AS ovfl_unused, + int(sum(gap_cnt)) AS gap_cnt FROM space_used WHERE $where" {} {} # Output the sub-report title, nicely decorated with * characters. @@ -450,6 +484,7 @@ proc subreport {title where} { set total_unused [expr {$ovfl_unused+$int_unused+$leaf_unused}] set avg_payload [divide $payload $nleaf] set avg_unused [divide $total_unused $nleaf] + set fragmentation [percent $gap_cnt $total_pages {fragmentation}] if {$int_pages>0} { # TODO: Is this formula correct? set nTab [mem eval " @@ -476,6 +511,9 @@ proc subreport {title where} { if {[info exists avg_fanout]} { statline {Average fanout} $avg_fanout } + if {$total_pages>1} { + statline {Fragmentation} $fragmentation + } statline {Maximum payload per entry} $mx_payload statline {Entries that use overflow} $ovfl_cnt $ovfl_cnt_percent if {$int_pages>0} {