hsd icon indicating copy to clipboard operation
hsd copied to clipboard

Include `size_on_disk` on `getblockchaininfo`

Open Falci opened this issue 2 years ago • 6 comments

Falci avatar Jul 02 '22 10:07 Falci

🥪

pinheadmz avatar Jul 02 '22 15:07 pinheadmz

🥪

Did you mean 🍉?

Falci avatar Jul 02 '22 16:07 Falci

No: https://discord.com/channels/822591034202521641/825772593180704768/992125032060944564

Free cheese sandwich to whoever opens issue #100!

pinheadmz avatar Jul 02 '22 16:07 pinheadmz

Which directories/files should we consider? All them?

hsd_data % du -hsx 2>/dev/null *
9.2G    blocks
 11G    chain
 14M    debug.log
 20M    debug_2022-02-04_10-44-02-910.log
 20M    debug_2022-02-10_09-28-29-262.log
 20M    debug_2022-02-19_18-19-25-959.log
 20M    debug_2022-03-04_07-07-09-799.log
 20M    debug_2022-03-31_08-43-33-499.log
 20M    debug_2022-04-17_12-01-03-976.log
 20M    debug_2022-04-18_06-58-51-976.log
 20M    debug_2022-04-18_14-34-50-939.log
 20M    debug_2022-05-03_20-39-59-716.log
 20M    debug_2022-06-11_22-25-42-401.log
 96K    hosts.json
4.0K    key
224K    regtest
 27G    tree
 12M    wallet
4.0K    wallet.log

Falci avatar Jul 04 '22 07:07 Falci

I think size_on_disk in getblockchaininfo should semantically be the same as in bitcoin, so blocks + chain (or spvchain when in spv mode). All full nodes will have around the same total. Including tree makes it a bit dynamic, since it can be compacted at any time and as many times as needed.

We could have another object in hsd-cli info or getblockchaininfo (not sure why we have two, whichever is a better fit):

sizes: {
  blockchain: spv ? size(spvchain) : (size(blocks)+size(chain)),
  tree: size(tree),
  total: size(.), // includes everything: wallet, logs, etc.
},

rithvikvibhu avatar Jul 04 '22 10:07 rithvikvibhu

The chain folder also currently includes the addr and tx indexes. Those will get moved out to their own folder hopefully with indexer refactor in hsd v5 (to pull from bcoin)

Also now that we have treeState object in chainDB I think we can add a gettreeinfo which should cover the size of the Urkel tree on disk.

pinheadmz avatar Jul 05 '22 16:07 pinheadmz