oasis-core icon indicating copy to clipboard operation
oasis-core copied to clipboard

go/oasis-node: Add new storage inspect command

Open martintomazic opened this issue 1 month ago • 0 comments

Add new oasis-node storage inspect command that displays last retained and latest version for all databases.

E.g.:

Consensus:
    State DB:
        Latest height: [uin64]
        Last retained height: [uin64]
    Block store/history: 
        Latest height: [uin64]
        Last retained height: [uin64]
Runtimes:
    000000000000000000000000000000000000000000000000f80306c9858e7279:
        State DB:
            Latest round: [uin64]
            Last retained round: [uin64]
        Light History:
             Latest round: [uin64]
             Last retained round: [uin64]         

Motivation

Currently to obtain this you need to start the node.

There are cases where you want you data to be static, moreover it takes time for node to actually sync and display this info. Finally, for such simple query you don't want to possibly register and or start serving p2p to then stop the node.

Use cases:

  • Sanity checking state of the node DBs and troubleshooting (!) corrupted state.
  • Useful for creating snapshots with exact start version:
    • Inspect consensus DB offline, calculate number of versions to keep, followed by offline pruning.
    • Relevant for #6423 and https://github.com/oasisprotocol/internal-ops/issues/1221.
  • Sanity checking downloaded snapshots, prior to starting the node.

Implementation space

Add to go/oasis-node/cmd/storage.

Should be "trivial" as we already have helpers there for manually opening databases (with exact same config the actual node has).

martintomazic avatar Dec 10 '25 22:12 martintomazic