Skip to content

inspect: resurrect the inspect command - #9655

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

williambanfield merged 40 commits into
mainfrom
wb/inspect

Conversation

@williambanfield

@williambanfield williambanfield commented Nov 1, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

@williambanfield

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@thanethomson thanethomson left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread cmd/tendermint/commands/inspect.go Resolved
Comment thread cmd/tendermint/commands/inspect.go Resolved
Comment thread docs/tools/debugging/pro.md Resolved
Comment thread docs/tools/debugging/pro.md Resolved
Comment thread docs/tools/debugging/pro.md Resolved
Comment thread inspect/inspect.go Resolved

@cmwaters cmwaters left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread cmd/tendermint/commands/inspect.go Resolved
Comment thread docs/tools/debugging/pro.md Resolved
Comment thread inspect/inspect.go Resolved
Comment thread inspect/inspect.go Resolved
Comment thread rpc/client/local/local.go Resolved
Comment thread rpc/core/tx.go Resolved
Comment thread rpc/core/tx.go Resolved
Comment thread rpc/core/routes.go Resolved

@cmwaters cmwaters left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread inspect/rpc/rpc.go Resolved
Comment thread inspect/inspect.go Resolved
@tac0turtle

Copy link
Copy Markdown
Contributor

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

@williambanfield

Copy link
Copy Markdown
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.

Comment thread rpc/core/status.go
// 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
Copy Markdown
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

@cmwaters cmwaters left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@thanethomson thanethomson left a comment •

Copy link
Copy Markdown
Contributor

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.

Comment thread rpc/core/status.go
// 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
Copy Markdown
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
Copy Markdown
Contributor

Is there a chance this could get backported to 0.34?

@williambanfield

Copy link
Copy Markdown
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
Copy Markdown
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