This commit is contained in:
Łukasz Magiera 2020-08-18 18:27:28 +02:00
parent baf91f08a1
commit e7d65be90a
7 changed files with 20 additions and 22 deletions
cli
cmd/lotus-storage-miner
extern/storage-sealing
node/config

View File

@ -13,7 +13,7 @@ import (
) )
var pprofCmd = &cli.Command{ var pprofCmd = &cli.Command{
Name: "pprof", Name: "pprof",
Hidden: true, Hidden: true,
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
PprofGoroutines, PprofGoroutines,
@ -42,7 +42,7 @@ var PprofGoroutines = &cli.Command{
return err return err
} }
addr = "http://" + addr + "/debug/pprof/goroutine?debug=2" addr = "http://" + addr + "/debug/pprof/goroutine?debug=2"
r, err := http.Get(addr) r, err := http.Get(addr)
if err != nil { if err != nil {
@ -56,4 +56,3 @@ var PprofGoroutines = &cli.Command{
return r.Body.Close() return r.Body.Close()
}, },
} }

View File

@ -9,7 +9,7 @@ import (
) )
var configCmd = &cli.Command{ var configCmd = &cli.Command{
Name: "config", Name: "config",
Usage: "Output default configuration", Usage: "Output default configuration",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
comm, err := config.ConfigComment(config.DefaultStorageMiner()) comm, err := config.ConfigComment(config.DefaultStorageMiner())

View File

@ -70,12 +70,12 @@ func TestHappyPath(t *testing.T) {
func TestSeedRevert(t *testing.T) { func TestSeedRevert(t *testing.T) {
ma, _ := address.NewIDAddress(55151) ma, _ := address.NewIDAddress(55151)
m := test{ m := test{
s: &Sealing{ s: &Sealing{
maddr: ma, maddr: ma,
stats: SectorStats{ stats: SectorStats{
bySector: map[abi.SectorID]statSectorState{}, bySector: map[abi.SectorID]statSectorState{},
}, },
}, },
t: t, t: t,
state: &SectorInfo{State: Packing}, state: &SectorInfo{State: Packing},
} }
@ -117,12 +117,12 @@ func TestSeedRevert(t *testing.T) {
func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) { func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {
ma, _ := address.NewIDAddress(55151) ma, _ := address.NewIDAddress(55151)
m := test{ m := test{
s: &Sealing{ s: &Sealing{
maddr: ma, maddr: ma,
stats: SectorStats{ stats: SectorStats{
bySector: map[abi.SectorID]statSectorState{}, bySector: map[abi.SectorID]statSectorState{},
}, },
}, },
t: t, t: t,
state: &SectorInfo{State: Committing}, state: &SectorInfo{State: Committing},
} }

View File

@ -13,4 +13,3 @@ type Config struct {
WaitDealsDelay time.Duration WaitDealsDelay time.Duration
} }

View File

@ -297,7 +297,7 @@ func (m *Sealing) newDealSector() (abi.SectorNumber, error) {
var best abi.SectorNumber = math.MaxUint64 var best abi.SectorNumber = math.MaxUint64
for sn, info := range m.unsealedInfoMap.infos { for sn, info := range m.unsealedInfoMap.infos {
if info.stored + 1 > mostStored + 1 { // 18446744073709551615 + 1 = 0 if info.stored+1 > mostStored+1 { // 18446744073709551615 + 1 = 0
best = sn best = sn
} }
} }

View File

@ -7,6 +7,7 @@ import (
) )
type statSectorState int type statSectorState int
const ( const (
sstSealing statSectorState = iota sstSealing statSectorState = iota
sstFailed sstFailed
@ -18,7 +19,7 @@ type SectorStats struct {
lk sync.Mutex lk sync.Mutex
bySector map[abi.SectorID]statSectorState bySector map[abi.SectorID]statSectorState
totals [nsst]uint64 totals [nsst]uint64
} }
func (ss *SectorStats) updateSector(id abi.SectorID, st SectorState) { func (ss *SectorStats) updateSector(id abi.SectorID, st SectorState) {
@ -35,7 +36,6 @@ func (ss *SectorStats) updateSector(id abi.SectorID, st SectorState) {
ss.totals[sst]++ ss.totals[sst]++
} }
// return the number of sectors currently in the sealing pipeline // return the number of sectors currently in the sealing pipeline
func (ss *SectorStats) curSealing() uint64 { func (ss *SectorStats) curSealing() uint64 {
ss.lk.Lock() ss.lk.Lock()

View File

@ -139,11 +139,11 @@ func DefaultFullNode() *FullNode {
func DefaultStorageMiner() *StorageMiner { func DefaultStorageMiner() *StorageMiner {
cfg := &StorageMiner{ cfg := &StorageMiner{
Common: defCommon(), Common: defCommon(),
Sealing: SealingConfig{ Sealing: SealingConfig{
MaxWaitDealsSectors: 2, // 64G with 32G sectors MaxWaitDealsSectors: 2, // 64G with 32G sectors
MaxSealingSectors: 0, MaxSealingSectors: 0,
WaitDealsDelay: Duration(time.Hour), WaitDealsDelay: Duration(time.Hour),
}, },
Storage: sectorstorage.SealerConfig{ Storage: sectorstorage.SealerConfig{