-
Notifications
You must be signed in to change notification settings - Fork 20.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/geth: add db commands: stats, compact, put, get, delete #22014
Conversation
Rebased + squashed, PTAL |
Suggestions from triage:
|
One thing that I'm having some problems with.. Three cases:
What should happen in these cases? A) Only one works, the others show some kind of error + help (which one should work?) RIght now, I'm at C, which is obviously incorrect. But should A or B be the target? |
Ok, nevermind, I'll go with A). Canon form is |
I added a commit which makes the ArgsUsage show:
After:
And
|
Before this PR:
After this PR:
Checking the
Checking
The last example brings down
|
cmd/geth/dbcmd.go
Outdated
_, chainDb := utils.MakeChain(ctx, node, true) | ||
defer chainDb.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, open in read-only
Fixed most of the concerns, with the exception of not opening the db in readonly mode for put, get, deleteCheck unclean shutdown marker (note: now in
Overwrite unclean shutdown marker
Check it
Put it back
Delete it
Verify delete:
Restore it
inspectAdded uncleanShutdownMarker to the stats. This is still not
statsNote
compact
|
This PR supersedes #21991 and #21887 (those PRs contain more info and examples.
This PR introduces
db.put
to put a value into the databasedb.get
to read a value from the databasedb.delete
to delete a value from the databasedb.stats
to check compaction info from the databasedb.compact
to trigger a db compactionIt also moves
inspectdb
todb.inspect