From: dan Date: Mon, 26 Sep 2011 19:32:47 +0000 (+0000) Subject: Changes to the analyzer script to make it work with zipvfs databases. X-Git-Tag: version-3.7.9~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64b41c71320bddf95b7279f87ed45dbb288308d1;p=thirdparty%2Fsqlite.git Changes to the analyzer script to make it work with zipvfs databases. FossilOrigin-Name: d82cffab6acafcf9d91fea4ac47cad73f6f09775 --- diff --git a/manifest b/manifest index 7223849835..42eac2a0a0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\san\sopen\sas\sread/write\sfails,\sdo\snot\stry\sto\sreopen\sas\sread-only\sif\sin\nexclusive\saccess\smode. -D 2011-09-25T17:49:26.535 +C Changes\sto\sthe\sanalyzer\sscript\sto\smake\sit\swork\swith\szipvfs\sdatabases. +D 2011-09-26T19:32:47.615 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in a162fe39e249b8ed4a65ee947c30152786cfe897 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -953,7 +953,7 @@ F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 F tool/showwal.c f09e5a80a293919290ec85a6a37c85a5ddcf37d9 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b -F tool/spaceanal.tcl 537f35d9e432695990ec855314d72eba9b999fe4 +F tool/spaceanal.tcl a7ffc29ba8db2fd791b4de83ee0a2a0436c07171 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355 F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff @@ -964,7 +964,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 87946c627f7230bea3739fd6aeec3e56115a3f93 -R 45c74df3a651dc62ff2bf197449037d8 -U drh -Z 9e8d9a9ad0cf791e3b92c0613c836ce2 +P 263c5fb2802f8c84835e42fc66acb1065b7e42b9 +R 653cfc1894df476a0aac3944fac55ae4 +U dan +Z 3c688ce814d5c4f405619c4d3e366aaa diff --git a/manifest.uuid b/manifest.uuid index fb3a0aea69..4ad4ea9b90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -263c5fb2802f8c84835e42fc66acb1065b7e42b9 \ No newline at end of file +d82cffab6acafcf9d91fea4ac47cad73f6f09775 \ No newline at end of file diff --git a/tool/spaceanal.tcl b/tool/spaceanal.tcl index bb5c1a0c3c..52d8251b6e 100644 --- a/tool/spaceanal.tcl +++ b/tool/spaceanal.tcl @@ -34,8 +34,8 @@ if {[file size $file_to_analyze]<512} { sqlite3 db $file_to_analyze register_dbstat_vtab db -set pageSize [db one {PRAGMA page_size}] db eval {SELECT count(*) FROM sqlite_master} +set pageSize [db one {PRAGMA page_size}] # In-memory database for collecting statistics. This script loops through # the tables and indices in the database being analyzed, adding a row for each @@ -357,8 +357,15 @@ proc autovacuum_overhead {filePages pageSize} { # (not including sqlite_master) # user_percent: $user_payload as a percentage of total file size. -set file_bytes [file size $file_to_analyze] -set file_pgcnt [expr {$file_bytes/$pageSize}] +### The following, setting $file_bytes based on the actual size of the file +### on disk, causes this tool to choke on zipvfs databases. So set it based +### on the return of [PRAGMA page_count] instead. +if 0 { + set file_bytes [file size $file_to_analyze] + set file_pgcnt [expr {$file_bytes/$pageSize}] +} +set file_pgcnt [db one {PRAGMA page_count}] +set file_bytes [expr $file_pgcnt * $pageSize] set av_pgcnt [autovacuum_overhead $file_pgcnt $pageSize] set av_percent [percent $av_pgcnt $file_pgcnt]