Skip to content
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: fixes db unavailability for chain commands #21415

Merged
merged 4 commits into from
Aug 6, 2020

Conversation

renaynay
Copy link
Contributor

@renaynay renaynay commented Aug 5, 2020

Related to #21412, fixes database unavailability issues stemming from the eth service and trying to open node's DB simultaneously.

@holiman
Copy link
Contributor

holiman commented Aug 5, 2020

Some quick testing:

  • build/bin/geth dump 0
  • echo "lalala" > deleteme; build/bin/geth import-preimages deleteme ; rm deleteme
  • build/bin/geth export-preimages deleteme
  • build/bin/geth --datadir=/tmp/foo copydb /home/user/.ethereum/geth/chaindata /home/user/.ethereum/geth/chaindata/ancient/

EDIT: all good!

@fjl fjl changed the title cmd: fixes db unavailability for chain commands cmd/geth: fixes db unavailability for chain commands Aug 5, 2020

stack, _ := makeConfigNode(ctx)
defer stack.Close()
// Initialize a new chain for the running node to sync into
Copy link
Member

Choose a reason for hiding this comment

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

Code style nit, pls leave an empty line before a comment. Loosens the code up a bit :)

Copy link
Member

Choose a reason for hiding this comment

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

Here again imho the original location was better. Mind you, you don't need an empty line there because } on itself is already loose enough :)

stack, _ := makeConfigNode(ctx)
defer stack.Close()

// Open an initialise both full and light databases
Copy link
Member

Choose a reason for hiding this comment

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

Code style nit, pls leave an empty line before a comment. Loosens the code up a bit :)

Copy link
Member

Choose a reason for hiding this comment

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

"an" -> "and"

Copy link
Member

Choose a reason for hiding this comment

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

Also I don't see why this comment was moved really. I thin the original place is correct. The role of the comment was to explain in general what the next section does.

Copy link
Member

Choose a reason for hiding this comment

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

Mind you, you don't need an empty line there because } on itself is already loose enough :)

Copy link
Contributor Author

@renaynay renaynay Aug 6, 2020

Choose a reason for hiding this comment

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

Ah yeah, sorry for shifting these around, I was originally commenting as to why I was making a makeConfigNode rather than makeFullNode but we shifted those comments to the functions themselves. Just moved it back, thanks for the feedback!

@renaynay renaynay requested a review from karalabe August 6, 2020 07:14
@@ -425,7 +425,8 @@ func exportPreimages(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
stack, _ := makeFullNode(ctx)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karalabe is this type of extra space fine or not necessary because of the } ?

Copy link
Member

@karalabe karalabe Aug 6, 2020

Choose a reason for hiding this comment

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

I'll leave it up to you :)

In general I only add an extra empty line if there's something super different coming up, but in that case I also add a comment :) All in all I don't want to micro manage people at this insanely low level, I just don't want comments to merge completely together with code :)

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

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

SGTM

@karalabe karalabe added this to the 1.9.19 milestone Aug 6, 2020
@karalabe karalabe merged commit d21303f into ethereum:master Aug 6, 2020
enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this pull request Mar 10, 2021
* chaincmd should make config nodes instead of full nodes

* add documentation for using makeConfigNode instead of makeFullNode;

* add documentation to functions

* code style
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.

3 participants