From e92f8e565b5fa6da9a0564228505d7efa0f486ab Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Sep 2024 11:14:10 +0000 Subject: [PATCH] Further enhancement to PTRMAP display in showdb: Show the details of invalid entries that are within the range of the database file. Continue to ignore invalid entries beyond the end of the database file. FossilOrigin-Name: 4cad385b90eaca2d90e3375e473472145af4134160b81097a8535d06638c2e4a --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/showdb.c | 11 +++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index edc637fa6a..87fe20a989 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhancement\sto\sthe\s"showdb"\sutility\ssuch\sthat\sthe\s"ptrmap"\scommand\sshows\nPTRMAP\sentries\sthat\sextend\soff\sthe\send\sof\sthe\sdatabase,\sas\slong\sas\sthey\nappear\sto\sbe\swell-formatted. -D 2024-09-12T21:58:31.168 +C Further\senhancement\sto\sPTRMAP\sdisplay\sin\sshowdb:\s\sShow\sthe\sdetails\sof\sinvalid\nentries\sthat\sare\swithin\sthe\srange\sof\sthe\sdatabase\sfile.\s\sContinue\sto\signore\ninvalid\sentries\sbeyond\sthe\send\sof\sthe\sdatabase\sfile. +D 2024-09-13T11:14:10.057 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2157,7 +2157,7 @@ F tool/replace.tcl 511c61acfe563dfb58675efb4628bb158a13d48ff8322123ac447e9d25a82 F tool/restore_jrnl.tcl 1079ecba47cc82fa82115b81c1f68097ab1f956f357ee8da5fc4b2589af6bd98 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/run-speed-test.sh f95d19fd669b68c4c38b6b475242841d47c66076 -F tool/showdb.c 14215f764f3e9adcbf49f8ed730a520f27283a1d875c2feb78d9c687c772b66e +F tool/showdb.c 81b04bfaa9a63665f75945947323aa68b820570aa156b1574f440fc8276092c6 F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 @@ -2212,8 +2212,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P db702dd78500a0839b0b2810a580d3634df49275470787b170973a86b73826d3 -R 96b15683ae71ad8973e2164a9c586273 +P a9f95fe5ce90ab9864165e603f3a34013c3c98d03f1db689996f4a32086e2ed6 +R 5fde967f0ed3ce1cc53a6d5bcb8024a9 U drh -Z e7a5988d3eebb0fdadfa92bbc6a99e53 +Z 8b78883255183c9952b265920384a36e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ecf65c614a..cf7caf5259 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a9f95fe5ce90ab9864165e603f3a34013c3c98d03f1db689996f4a32086e2ed6 +4cad385b90eaca2d90e3375e473472145af4134160b81097a8535d06638c2e4a diff --git a/tool/showdb.c b/tool/showdb.c index 9a38658d23..12c2e271b7 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -1085,7 +1085,7 @@ static void ptrmap_coverage_report(const char *zDbName){ pgno+1, pgno+perPage); a = fileRead((pgno-1)*g.pagesize, usable); for(i=0; i+5<=usable; i+=5){ - const char *zType = "???"; + const char *zType; u32 iFrom = decodeInt32(&a[i+1]); const char *zExtra = pgno+1+i/5>g.mxPage ? " (off end of DB)" : ""; switch( a[i] ){ @@ -1094,7 +1094,14 @@ static void ptrmap_coverage_report(const char *zDbName){ case 3: zType = "first page of overflow"; break; case 4: zType = "later page of overflow"; break; case 5: zType = "b-tree non-root page"; break; - default: zType = 0; break; + default: { + if( zExtra[0]==0 ){ + printf("%5llu: invalid (0x%02x), parent=%u\n", + pgno+1+i/5, a[i], iFrom); + } + zType = 0; + break; + } } if( zType ){ printf("%5llu: %s, parent=%u%s\n", pgno+1+i/5, zType, iFrom, zExtra);