Skip to content

Conversation

@cedrickah
Copy link
Contributor

Fix #33212.
This PR remove github.com/olekukonko/tablewriter from dependencies and use a naive stub implementation. github.com/olekukonko/tablewriter is used to format database inspection output neatly. However, it requires custom adjustments for TinyGo and is incompatible with the latest version.

@rjl493456442
Copy link
Member

Thanks for it, i would like to test the db inspection before merging the PR.

@MariusVanDerWijden
Copy link
Member

Looks like it changes the output format

geth db inspect
INFO [11-19|18:42:09.674] Maximum peer count                       ETH=50 total=50
INFO [11-19|18:42:09.677] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [11-19|18:42:09.678] Set global gas cap                       cap=50,000,000
INFO [11-19|18:42:09.679] Initializing the KZG library             backend=gokzg
INFO [11-19|18:42:09.680] Using pebble as the backing database
INFO [11-19|18:42:09.680] Allocated cache and file handles         database=/home/matematik/.ethereum/geth/chaindata cache=512.00MiB handles=262,144
INFO [11-19|18:42:09.739] Opened ancient database                  database=/home/matematik/.ethereum/geth/chaindata/ancient/chain readonly=true
INFO [11-19|18:42:09.739] Opened Era store                         datadir=/home/matematik/.ethereum/geth/chaindata/ancient/chain/era
INFO [11-19|18:42:17.741] Inspecting database                      count=15,064,684 size=5.09GiB elapsed=8.001s
INFO [11-19|18:42:25.740] Inspecting database                      count=27,231,533 size=11.55GiB elapsed=16.000s
INFO [11-19|18:42:26.050] Opened ancient database                  database=/home/matematik/.ethereum/geth/chaindata/ancient/state readonly=true
       Database        |          Category           |    Size    |  Items   
-----------------------+-----------------------------+------------+----------
    Key-Value store    |           Headers           | 49.69 MiB  |  90001   
    Key-Value store    |           Bodies            | 80.93 MiB  |  90001   
    Key-Value store    |        Receipt lists        | 48.10 MiB  |  90001   
    Key-Value store    |  Difficulties (deprecated)  |   0.00 B   |    0     
    Key-Value store    |     Block number->hash      |  3.60 MiB  |  90001   
    Key-Value store    |     Block hash->number      | 47.49 MiB  | 1214620  
    Key-Value store    |      Transaction index      | 91.47 MiB  | 2664597  
    Key-Value store    |  Log index filter-map rows  |   0.00 B   |    0     
    Key-Value store    | Log index last-block-of-map |  48.00 B   |    1     
    Key-Value store    |     Log index block-lv      |  80.00 B   |    4     
    Key-Value store    | Log bloombits (deprecated)  |   0.00 B   |    0     
    Key-Value store    |       Contract codes        |  6.80 MiB  |   3346   
    Key-Value store    |       Hash trie nodes       |   0.00 B   |    0     
    Key-Value store    |   Path trie state lookups   |  3.52 MiB  |  90001   
    Key-Value store    |   Path trie account nodes   | 19.57 MiB  |  167159  
    Key-Value store    |   Path trie storage nodes   | 73.88 MiB  |  747643  
    Key-Value store    | Path state history indexes  |   0.00 B   |    0     
    Key-Value store    |      Verkle trie nodes      |   0.00 B   |    0     
    Key-Value store    |  Verkle trie state lookups  |   0.00 B   |    0     
    Key-Value store    |       Trie preimages        |   0.00 B   |    0     
    Key-Value store    |      Account snapshot       |  5.82 MiB  |  120252  
    Key-Value store    |      Storage snapshot       | 38.12 MiB  |  547932  
    Key-Value store    |     Beacon sync headers     | 11.23 GiB  | 21583890 
    Key-Value store    |      Clique snapshots       |   0.00 B   |    0     
    Key-Value store    |     Singleton metadata      | 23.56 MiB  |    15    
 Ancient store (Chain) |           Headers           | 336.05 MiB | 1124620  
 Ancient store (Chain) |           Hashes            | 40.76 MiB  | 1124620  
 Ancient store (Chain) |           Bodies            | 307.83 MiB | 1124620  
 Ancient store (Chain) |          Receipts           | 126.70 MiB | 1124620  
 Ancient store (State) |        History.Meta         | 13.22 MiB  |  90000   
 Ancient store (State) |        Account.Index        | 26.21 MiB  |  90000   
 Ancient store (State) |        Storage.Index        | 12.35 MiB  |  90000   
 Ancient store (State) |        Account.Data         | 19.29 MiB  |  90000   
 Ancient store (State) |        Storage.Data         |  7.48 MiB  |  90000   
-----------------------+-----------------------------+------------+----------
                       |            Total            | 12.58 GiB  | 27499464 

@MariusVanDerWijden
Copy link
Member

I pushed a commit on top that changes the formatting so it almost matches tablewriter

+-----------------------+-----------------------------+------------+----------+
|       DATABASE        |          CATEGORY           |    SIZE    |  ITEMS   |
+-----------------------+-----------------------------+------------+----------+
| Key-Value store       | Headers                     | 49.69 MiB  |    90001 |
| Key-Value store       | Bodies                      | 80.93 MiB  |    90001 |
| Key-Value store       | Receipt lists               | 48.10 MiB  |    90001 |
| Key-Value store       | Difficulties (deprecated)   | 0.00 B     |        0 |
| Key-Value store       | Block number->hash          | 3.60 MiB   |    90001 |
| Key-Value store       | Block hash->number          | 47.49 MiB  |  1214620 |
| Key-Value store       | Transaction index           | 91.47 MiB  |  2664597 |
| Key-Value store       | Log index filter-map rows   | 0.00 B     |        0 |
| Key-Value store       | Log index last-block-of-map | 48.00 B    |        1 |
| Key-Value store       | Log index block-lv          | 80.00 B    |        4 |
| Key-Value store       | Log bloombits (deprecated)  | 0.00 B     |        0 |
| Key-Value store       | Contract codes              | 6.80 MiB   |     3346 |
| Key-Value store       | Hash trie nodes             | 0.00 B     |        0 |
| Key-Value store       | Path trie state lookups     | 3.52 MiB   |    90001 |
| Key-Value store       | Path trie account nodes     | 19.57 MiB  |   167159 |
| Key-Value store       | Path trie storage nodes     | 73.88 MiB  |   747643 |
| Key-Value store       | Path state history indexes  | 0.00 B     |        0 |
| Key-Value store       | Verkle trie nodes           | 0.00 B     |        0 |
| Key-Value store       | Verkle trie state lookups   | 0.00 B     |        0 |
| Key-Value store       | Trie preimages              | 0.00 B     |        0 |
| Key-Value store       | Account snapshot            | 5.82 MiB   |   120252 |
| Key-Value store       | Storage snapshot            | 38.12 MiB  |   547932 |
| Key-Value store       | Beacon sync headers         | 11.23 GiB  | 21583890 |
| Key-Value store       | Clique snapshots            | 0.00 B     |        0 |
| Key-Value store       | Singleton metadata          | 23.56 MiB  |       15 |
| Ancient store (Chain) | Headers                     | 336.05 MiB |  1124620 |
| Ancient store (Chain) | Hashes                      | 40.76 MiB  |  1124620 |
| Ancient store (Chain) | Bodies                      | 307.83 MiB |  1124620 |
| Ancient store (Chain) | Receipts                    | 126.70 MiB |  1124620 |
| Ancient store (State) | Account.Index               | 26.21 MiB  |    90000 |
| Ancient store (State) | Storage.Index               | 12.35 MiB  |    90000 |
| Ancient store (State) | Account.Data                | 19.29 MiB  |    90000 |
| Ancient store (State) | Storage.Data                | 7.48 MiB   |    90000 |
| Ancient store (State) | History.Meta                | 13.22 MiB  |    90000 |
+-----------------------+-----------------------------+------------+----------+
|                                    TOTAL            | 12.58 GIB  | 27499464 |
+-----------------------+-----------------------------+------------+----------+

After:

+-----------------------+-----------------------------+------------+----------+
|       Database        |          Category           |    Size    |  Items   |
+-----------------------+-----------------------------+------------+----------+
|    Key-Value store    |           Headers           | 49.69 MiB  |  90001   |
|    Key-Value store    |           Bodies            | 80.93 MiB  |  90001   |
|    Key-Value store    |        Receipt lists        | 48.10 MiB  |  90001   |
|    Key-Value store    |  Difficulties (deprecated)  |   0.00 B   |    0     |
|    Key-Value store    |     Block number->hash      |  3.60 MiB  |  90001   |
|    Key-Value store    |     Block hash->number      | 47.49 MiB  | 1214620  |
|    Key-Value store    |      Transaction index      | 91.47 MiB  | 2664597  |
|    Key-Value store    |  Log index filter-map rows  |   0.00 B   |    0     |
|    Key-Value store    | Log index last-block-of-map |  48.00 B   |    1     |
|    Key-Value store    |     Log index block-lv      |  80.00 B   |    4     |
|    Key-Value store    | Log bloombits (deprecated)  |   0.00 B   |    0     |
|    Key-Value store    |       Contract codes        |  6.80 MiB  |   3346   |
|    Key-Value store    |       Hash trie nodes       |   0.00 B   |    0     |
|    Key-Value store    |   Path trie state lookups   |  3.52 MiB  |  90001   |
|    Key-Value store    |   Path trie account nodes   | 19.57 MiB  |  167159  |
|    Key-Value store    |   Path trie storage nodes   | 73.88 MiB  |  747643  |
|    Key-Value store    | Path state history indexes  |   0.00 B   |    0     |
|    Key-Value store    |      Verkle trie nodes      |   0.00 B   |    0     |
|    Key-Value store    |  Verkle trie state lookups  |   0.00 B   |    0     |
|    Key-Value store    |       Trie preimages        |   0.00 B   |    0     |
|    Key-Value store    |      Account snapshot       |  5.82 MiB  |  120252  |
|    Key-Value store    |      Storage snapshot       | 38.12 MiB  |  547932  |
|    Key-Value store    |     Beacon sync headers     | 11.23 GiB  | 21583890 |
|    Key-Value store    |      Clique snapshots       |   0.00 B   |    0     |
|    Key-Value store    |     Singleton metadata      | 23.56 MiB  |    15    |
| Ancient store (Chain) |           Headers           | 336.05 MiB | 1124620  |
| Ancient store (Chain) |           Hashes            | 40.76 MiB  | 1124620  |
| Ancient store (Chain) |           Bodies            | 307.83 MiB | 1124620  |
| Ancient store (Chain) |          Receipts           | 126.70 MiB | 1124620  |
| Ancient store (State) |        Storage.Data         |  7.48 MiB  |  90000   |
| Ancient store (State) |        History.Meta         | 13.22 MiB  |  90000   |
| Ancient store (State) |        Account.Index        | 26.21 MiB  |  90000   |
| Ancient store (State) |        Storage.Index        | 12.35 MiB  |  90000   |
| Ancient store (State) |        Account.Data         | 19.29 MiB  |  90000   |
+-----------------------+-----------------------------+------------+----------+
|                       |            Total            | 12.58 GiB  | 27499464 |
+-----------------------+-----------------------------+------------+----------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove table printer from the dependency

4 participants