Indicate whether a sector has been marked for upgrade

This commit is contained in:
Aayush Rajasekaran 2020-08-21 15:43:30 -04:00
parent bf98ebe33e
commit 984e52acbc
5 changed files with 25 additions and 11 deletions

View File

@ -120,15 +120,16 @@ type SectorLog struct {
} }
type SectorInfo struct { type SectorInfo struct {
SectorID abi.SectorNumber SectorID abi.SectorNumber
State SectorState State SectorState
CommD *cid.Cid CommD *cid.Cid
CommR *cid.Cid CommR *cid.Cid
Proof []byte Proof []byte
Deals []abi.DealID Deals []abi.DealID
Ticket SealTicket Ticket SealTicket
Seed SealSeed Seed SealSeed
Retries uint64 Retries uint64
ToUpgrade bool
LastErr string LastErr string

View File

@ -192,7 +192,7 @@ var sectorsListCmd = &cli.Command{
_, inSSet := commitedIDs[s] _, inSSet := commitedIDs[s]
_, inASet := activeIDs[s] _, inASet := activeIDs[s]
fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\n", fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s, s,
st.State, st.State,
yesno(inSSet), yesno(inSSet),
@ -200,6 +200,7 @@ var sectorsListCmd = &cli.Command{
st.Ticket.Epoch, st.Ticket.Epoch,
st.Seed.Epoch, st.Seed.Epoch,
st.Deals, st.Deals,
st.ToUpgrade,
) )
} }

View File

@ -10,6 +10,13 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/builtin/miner"
) )
func (m *Sealing) IsMarkedForUpgrade(id abi.SectorNumber) bool {
m.upgradeLk.Lock()
_, found := m.toUpgrade[id]
m.upgradeLk.Unlock()
return found
}
func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error { func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error {
m.upgradeLk.Lock() m.upgradeLk.Lock()
defer m.upgradeLk.Unlock() defer m.upgradeLk.Unlock()

View File

@ -153,7 +153,8 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
Value: info.SeedValue, Value: info.SeedValue,
Epoch: info.SeedEpoch, Epoch: info.SeedEpoch,
}, },
Retries: info.InvalidProofs, Retries: info.InvalidProofs,
ToUpgrade: sm.Miner.IsMarkedForUpgrade(sid),
LastErr: info.LastErr, LastErr: info.LastErr,
Log: log, Log: log,

View File

@ -47,3 +47,7 @@ func (m *Miner) RemoveSector(ctx context.Context, id abi.SectorNumber) error {
func (m *Miner) MarkForUpgrade(id abi.SectorNumber) error { func (m *Miner) MarkForUpgrade(id abi.SectorNumber) error {
return m.sealing.MarkForUpgrade(id) return m.sealing.MarkForUpgrade(id)
} }
func (m *Miner) IsMarkedForUpgrade(id abi.SectorNumber) bool {
return m.sealing.IsMarkedForUpgrade(id)
}