Merge pull request #51 from filecoin-project/fix/cache-check-paths

Fix/cache check paths
This commit is contained in:
Łukasz Magiera 2020-06-18 09:32:00 +02:00 committed by GitHub
commit d9de9b7cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package sectorstorage
import ( import (
"context" "context"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
@ -57,9 +58,10 @@ func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredSealProof
lp.Sealed: 1, lp.Sealed: 1,
filepath.Join(lp.Cache, "t_aux"): 0, filepath.Join(lp.Cache, "t_aux"): 0,
filepath.Join(lp.Cache, "p_aux"): 0, filepath.Join(lp.Cache, "p_aux"): 0,
filepath.Join(lp.Cache, "sc-02-data-tree-r-last.dat"): 0,
} }
addCachePathsForSectorSize(toCheck, lp.Cache, ssize)
for p, sz := range toCheck { for p, sz := range toCheck {
st, err := os.Stat(p) st, err := os.Stat(p)
if err != nil { if err != nil {
@ -87,4 +89,17 @@ func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredSealProof
return bad, nil return bad, nil
} }
func addCachePathsForSectorSize(chk map[string]int64, cacheDir string, ssize abi.SectorSize) {
switch ssize {
case 512 << 20:
chk[filepath.Join(cacheDir, "sc-02-data-tree-r-last.dat")] = 0
case 32 << 30:
for i := 0; i < 8; i++ {
chk[filepath.Join(cacheDir, fmt.Sprintf("sc-02-data-tree-r-last-%d.dat", i))] = 0
}
default:
log.Warnf("not checking cache files of %s sectors for faults", ssize)
}
}
var _ FaultTracker = &Manager{} var _ FaultTracker = &Manager{}