Skip to content

inspect: resurrect the inspect command#9655

Merged
williambanfield merged 40 commits intomainfrom
wb/inspect
Dec 7, 2022
Merged

inspect: resurrect the inspect command#9655
williambanfield merged 40 commits intomainfrom
wb/inspect

Conversation

@williambanfield
Copy link
Contributor

@williambanfield williambanfield commented Nov 1, 2022

WIP: resurrect the inspect command from #6785


PR checklist

  • Tests written/updated, or no tests needed
  • CHANGELOG_PENDING.md updated, or no changelog entry needed
  • Updated relevant documentation (docs/) and code comments, or no
    documentation updates needed

tychoish and others added 15 commits November 1, 2022 16:37
EDIT: Updated, see [comment below]( #6785 (comment))

This change adds a sketch of the `Debug` mode.

This change adds a `Debug` struct to the node package. This `Debug` struct is intended to be created and started by a command in the `cmd` directory. The `Debug` struct runs the RPC server on the data directories: both the state store and the block store.

This change required a good deal of refactoring. Namely, a new `rpc.go` file was added to the `node` package. This file encapsulates functions for starting RPC servers used by nodes. A potential additional change is to further factor this code into shared code _in_ the `rpc` package.

Minor API tweaks were also made that seemed appropriate such as the mechanism for fetching routes from the `rpc/core` package.

Additional work is required to register the `Debug` service as a command in the `cmd` directory but I am looking for feedback on if this direction seems appropriate before diving much further.

closes: #5908
@williambanfield williambanfield self-assigned this Nov 3, 2022
@thanethomson
Copy link
Contributor

Just to confirm here, the idea's to backport this to v0.34 and v0.37, right?

@williambanfield
Copy link
Contributor Author

Just to confirm here, the idea's to backport this to v0.34 and v0.37, right?

At the moment the goal was to get this up and running with main. It could certainly be backported with a bit of extra work in a non-breaking way if it's important to do so. The changes introduced in v0.36 to remove the package global state in favor of using a type with methods implemented on it is, makes the backport a bit trickier but, again, it can be done definitely if it's important.

@tac0turtle, can you help judge how important it is to backport this to v0.34?

@tac0turtle
Copy link
Contributor

I would say it's a nice to have. As we want to encourage users to upgrade, back porting everything enables them to stick around on the older versions for longer.

@williambanfield williambanfield marked this pull request as ready for review November 9, 2022 17:25
@williambanfield williambanfield requested a review from a team November 9, 2022 17:25
@williambanfield
Copy link
Contributor Author

Opening this as a full PR to the tip of main. We can continue to discuss backport strategy here.

Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this PR pulled in a whole bunch of other unrelated changes to the RPC system as well?

Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup as well.

As this PR has a few different additions (not just inspect but modifications to rpc and Canceled instead of Cancelled, make sure you document all of them in the changelog.

Other than a few minor documentation things I see nothing wrong with the PR semantically

williambanfield and others added 4 commits November 10, 2022 13:55
Co-authored-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Callum Waters <cmwaters19@gmail.com>
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you need to appease the linter and add a entry to the changelog. Other than that looks good

@tac0turtle
Copy link
Contributor

does setting the db into readonly mode for this provide extra performance benefits?

@williambanfield
Copy link
Contributor Author

@tac0turtle Unlikely. I checked goleveldb. It uses that information to check whether to open the files it uses in readonly mode and if it should perform a scheduled compaction. Compactions occur already when the DB is under load, so this should not be a massive performance issue from the perspective of readonly tendermint workloads.

// hash, app hash, block height and time.
// More: https://docs.tendermint.com/main/rpc/#/Info/status
func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) {
// More: https://docs.tendermint.com/master/rpc/#/Info/status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know why this was changed back to master

Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would've been preferable to have this PR as 3 distinct PRs, each making just one substantial change:

  1. The refactoring of the RPC to remove the global state
  2. The refactoring of the indexing functionality
  3. Implementation of the inspect command

That would've made these changes easier to reason about and quicker to review overall.

// hash, app hash, block height and time.
// More: https://docs.tendermint.com/main/rpc/#/Info/status
func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) {
// More: https://docs.tendermint.com/master/rpc/#/Info/status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// More: https://docs.tendermint.com/master/rpc/#/Info/status
// More: https://docs.tendermint.com/main/rpc/#/Info/status

@tac0turtle
Copy link
Contributor

Is there a chance this could get backported to 0.34?

@williambanfield
Copy link
Contributor Author

Is there a chance this could get backported to 0.34?

It's possible but complicated. There is a breaking change included here that makes it impossible to perform the simple mechanical backport. I had asked above about how pressing it was to backport this, has anything changed with respect to its priority?

@tac0turtle
Copy link
Contributor

I'm building a query only like node and this would help. I can fork the rpc package and pull out what I need as well.

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

Labels

None yet

Projects

Status: Done/Merged

Development

Successfully merging this pull request may close these issues.

5 participants