stores: Report storage changes quickly
This commit is contained in:
parent
95d9084899
commit
fbc05fa5a8
34
extern/sector-storage/stores/local.go
vendored
34
extern/sector-storage/stores/local.go
vendored
@ -298,24 +298,28 @@ func (st *Local) reportHealth(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
st.localLk.RLock()
|
||||
st.reportStorage(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
toReport := map[ID]HealthReport{}
|
||||
for id, p := range st.paths {
|
||||
stat, err := p.stat(st.localStorage)
|
||||
func (st *Local) reportStorage(ctx context.Context) {
|
||||
st.localLk.RLock()
|
||||
|
||||
toReport[id] = HealthReport{
|
||||
Stat: stat,
|
||||
Err: err,
|
||||
}
|
||||
toReport := map[ID]HealthReport{}
|
||||
for id, p := range st.paths {
|
||||
stat, err := p.stat(st.localStorage)
|
||||
|
||||
toReport[id] = HealthReport{
|
||||
Stat: stat,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
st.localLk.RUnlock()
|
||||
st.localLk.RUnlock()
|
||||
|
||||
for id, report := range toReport {
|
||||
if err := st.index.StorageReportHealth(ctx, id, report); err != nil {
|
||||
log.Warnf("error reporting storage health for %s (%+v): %+v", id, report, err)
|
||||
}
|
||||
for id, report := range toReport {
|
||||
if err := st.index.StorageReportHealth(ctx, id, report); err != nil {
|
||||
log.Warnf("error reporting storage health for %s (%+v): %+v", id, report, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -568,6 +572,8 @@ func (st *Local) removeSector(ctx context.Context, sid abi.SectorID, typ storifa
|
||||
log.Errorf("removing sector (%v) from %s: %+v", sid, spath, err)
|
||||
}
|
||||
|
||||
st.reportStorage(ctx) // report freed space
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -623,6 +629,8 @@ func (st *Local) MoveStorage(ctx context.Context, s abi.SectorID, ssize abi.Sect
|
||||
}
|
||||
}
|
||||
|
||||
st.reportStorage(ctx) // report space use changes
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user