-
Notifications
You must be signed in to change notification settings - Fork 107
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
go/oasis-node/cmd: unsafe-reset check datadir validity #4702
Conversation
c841ecd
to
964ddd2
Compare
@@ -67,6 +68,21 @@ func doUnsafeReset(cmd *cobra.Command, args []string) { | |||
return | |||
} | |||
|
|||
// Do a state dir sanity check. | |||
glob := filepath.Join(dataDir, tendermintCommon.StateDir) |
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.
Could maybe check for some other files/folders as well
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.
Maybe identity.NodeKeyPubFilename
as well?
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.
added
2c83399
to
4b1d03e
Compare
Codecov Report
@@ Coverage Diff @@
## master #4702 +/- ##
==========================================
- Coverage 67.18% 66.86% -0.32%
==========================================
Files 436 436
Lines 48977 48990 +13
==========================================
- Hits 32906 32758 -148
- Misses 12014 12188 +174
+ Partials 4057 4044 -13
Continue to review full report at Codecov.
|
return | ||
} | ||
if len(matches) == 0 && !cmdFlags.Force() { | ||
fmt.Printf("Expected path: '%s' not found. Not removing any files. Use --force to run the command regardless.\n", glob) |
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.
Maybe just say something like:
fmt.Printf("Expected path: '%s' not found. Not removing any files. Use --force to run the command regardless.\n", glob) | |
fmt.Printf("%s does not look like an oasis-node data directory, not removing any files. Use --force to run the command regardless.\n", dataDir) |
// Completely reset state for one of the compute nodes so we can test initial sync. | ||
sc.Logger.Info("completely resetting state for one of the compute nodes") | ||
cli := cli.New(childEnv, sc.Net, sc.Logger) | ||
if err = cli.UnsafeReset(sc.Net.ComputeWorkers()[1].DataDir(), false, false); err != nil { | ||
if err = cli.UnsafeReset(sc.Net.ComputeWorkers()[1].DataDir(), false, false, true); err != nil { |
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.
Why is force needed here?
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.
Because unsafe-reset
is already run for all nodes in the DumpRestoreNetwork
, so the tendermint directory will already be cleared on this node that we run unsafe-reset (without perserving any runtime dirs) again.
4b1d03e
to
3c16987
Compare
No description provided.