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

sectors update-state checks if sector exists before changing its state #7762

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

geoff-vball
Copy link
Contributor

Closes issue #7754

@geoff-vball geoff-vball requested a review from a team as a code owner December 11, 2021 02:06
@geoff-vball
Copy link
Contributor Author

geoff-vball commented Dec 11, 2021

Haven't been able to test yet. Will get to it Sunday.

Current approach will not allow state update for sectors in UndefinedSectorState. I'm unsure what the desired behaviour here is.

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #7762 (27e48d7) into master (a0d76bd) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7762      +/-   ##
==========================================
- Coverage   39.57%   39.55%   -0.03%     
==========================================
  Files         640      640              
  Lines       68468    68471       +3     
==========================================
- Hits        27095    27081      -14     
- Misses      36722    36734      +12     
- Partials     4651     4656       +5     
Impacted Files Coverage Δ
cmd/lotus-miner/sectors.go 14.75% <0.00%> (-0.05%) ⬇️
markets/loggers/loggers.go 89.28% <0.00%> (-10.72%) ⬇️
chain/actors/builtin/miner/diff.go 48.52% <0.00%> (-10.30%) ⬇️
markets/retrievaladapter/client_blockstore.go 62.50% <0.00%> (-6.25%) ⬇️
chain/stmgr/call.go 67.87% <0.00%> (-3.64%) ⬇️
chain/types/tipset_key.go 85.96% <0.00%> (-3.51%) ⬇️
node/hello/hello.go 63.63% <0.00%> (-3.41%) ⬇️
miner/miner.go 55.29% <0.00%> (-1.99%) ⬇️
chain/vm/vm.go 61.89% <0.00%> (-1.12%) ⬇️
chain/gen/gen.go 68.61% <0.00%> (-0.62%) ⬇️
... and 14 more

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 a0d76bd...27e48d7. Read the comment docs.

Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

LGTM, @magik6k express opinions on the undef state thing.

}
}
if !sectorExists {
return xerrors.Errorf("sector %s not found, could not change state", cctx.Args().Get(0))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return xerrors.Errorf("sector %s not found, could not change state", cctx.Args().Get(0))
return xerrors.Errorf("sector %d not found, could not change state", id)
Suggested change
return xerrors.Errorf("sector %s not found, could not change state", cctx.Args().Get(0))
return xerrors.Errorf("sector %s not found, could not change state", cctx.Args().Get(0))

return xerrors.Errorf("could not get list of sectors: %w", err)
}
var sectorExists = false
for _, x := range list {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this variable is usually called v for value

@@ -1648,6 +1648,21 @@ var sectorsUpdateCmd = &cli.Command{
return xerrors.Errorf("could not parse sector number: %w", err)
}

list, err := nodeApi.SectorsList(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not SectorsStatus? Getting a full list will be somewhat slow for bigger miners.

@geoff-vball geoff-vball force-pushed the feat/sectors-update-state-guard branch from ff3958b to 27e48d7 Compare December 17, 2021 19:32
@arajasek arajasek merged commit dd20829 into master Dec 18, 2021
@arajasek arajasek deleted the feat/sectors-update-state-guard branch December 18, 2021 00:21
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