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

feat: nuke storage #2577

Merged
merged 5 commits into from
Oct 11, 2021
Merged

feat: nuke storage #2577

merged 5 commits into from
Oct 11, 2021

Conversation

acud
Copy link
Member

@acud acud commented Oct 6, 2021

Adds a db nuke command to erase local storage and state store data so that the node can start afresh but keep accounting data


This change is Reviewable

@acud acud force-pushed the drop-store branch 2 times, most recently from d2ff26d to d543960 Compare October 7, 2021 08:35
@acud acud self-assigned this Oct 7, 2021
@acud acud added the ready for review The PR is ready to be reviewed label Oct 7, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #2577 (2acedbd) into master (0336b57) will decrease coverage by 0.13%.
The diff coverage is 23.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2577      +/-   ##
==========================================
- Coverage   63.68%   63.55%   -0.14%     
==========================================
  Files         232      232              
  Lines       25799    25869      +70     
==========================================
+ Hits        16430    16440      +10     
- Misses       7877     7937      +60     
  Partials     1492     1492              
Impacted Files Coverage Δ
cmd/bee/cmd/cmd.go 66.04% <ø> (ø)
pkg/statestore/leveldb/migration.go 30.68% <12.12%> (-4.26%) ⬇️
cmd/bee/cmd/db.go 19.76% <16.98%> (-1.30%) ⬇️
pkg/statestore/leveldb/leveldb.go 53.00% <76.92%> (ø)
pkg/p2p/libp2p/peer.go 83.78% <0.00%> (-0.68%) ⬇️
pkg/retrieval/retrieval.go 64.37% <0.00%> (+0.31%) ⬆️
pkg/localstore/subscription_pull.go 86.98% <0.00%> (+2.73%) ⬆️
pkg/blocker/blocker.go 91.66% <0.00%> (+3.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0336b57...2acedbd. Read the comment docs.

Copy link
Contributor

@mrekucci mrekucci left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @acud)


cmd/bee/cmd/db.go, line 162 at r1 (raw file):

			v, err := cmd.Flags().GetString(optionNameVerbosity)
			if err != nil {
				return fmt.Errorf("get verbosity: %v", err)

Use %w verb for err instead of %v. The same in the whole function body.


pkg/statestore/leveldb/leveldb.go, line 26 at r1 (raw file):

var _ storage.StateStorer = (*Store)(nil)

// store uses LevelDB to store values.

Alter also the comment, it should be in the following format 'Store ...`.

Copy link
Contributor

@mrekucci mrekucci left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @acud)

cmd/bee/cmd/db.go Show resolved Hide resolved
// store uses LevelDB to store values.
type store struct {
// Store uses LevelDB to store values.
type Store struct {
Copy link
Member

Choose a reason for hiding this comment

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

why is this suddenly exported? only to execute the nuke function? can't this be added to the interface (or to an extended version of that)?

pkg/statestore/leveldb/migration.go Outdated Show resolved Hide resolved
@acud acud added this to the v1.3.0 milestone Oct 10, 2021
@sonarcloud
Copy link

sonarcloud bot commented Oct 11, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@ralph-pichler ralph-pichler left a comment

Choose a reason for hiding this comment

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

lgtm. please make sure there is documentation (for users) somewhere on what the consequences of nuking the db are (especially in combination with forget-overlay).

@acud acud merged commit 45a3563 into master Oct 11, 2021
@acud acud deleted the drop-store branch October 11, 2021 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants