Merge pull request #956 from filecoin-project/feat/sb-better-oos-err

sectorbuilder: Improve 'not enough space' error
This commit is contained in:
Jakub Sztandera 2019-12-17 15:55:36 +01:00 committed by GitHub
commit 791f01cead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -157,7 +157,7 @@ jobs:
test-short:
<<: *test
build_macos:
build-macos:
description: build darwin lotus binary
macos:
xcode: "10.0.0"
@ -187,11 +187,11 @@ jobs:
chmod +x $HOME/.bin/jq
- restore_cache:
name: restore go mod and cargo cache
key: v1-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.mod" }}
key: v2-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.mod" }}
- install-deps
- go/mod-download
- run:
command: make build
command: make buildall
no_output_timeout: 30m
- store_artifacts:
path: lotus
@ -199,9 +199,8 @@ jobs:
path: lotus-storage-miner
- save_cache:
name: save go mod and cargo cache
key: v1-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.mod" }}
key: v2-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.mod" }}
paths:
- "~/go/pkg"
- "~/go/src/github.com"
- "~/go/src/golang.org"
- "~/.rustup"
@ -262,7 +261,4 @@ workflows:
go-test-flags: "--timeout 10m --short"
- mod-tidy-check
- build-all
- build_macos:
filters:
branches:
only: master
- build-macos

View File

@ -86,14 +86,19 @@ func (f *fs) reserve(typ dataType, size uint64) error {
return err
}
avail := int64(fsstat.Bavail) * int64(fsstat.Bsize)
fsavail := int64(fsstat.Bavail) * int64(fsstat.Bsize)
avail -= f.reservedBytes()
avail := fsavail - f.reservedBytes()
need := overheadMul[typ] * size
if int64(need) > avail {
return xerrors.Errorf("not enough space in '%s', need %s, available %s", f.path, types.NewInt(need).SizeStr(), types.NewInt(uint64(avail)).SizeStr())
return xerrors.Errorf("not enough space in '%s', need %s, available %s (fs: %s, reserved: %s)",
f.path,
types.NewInt(need).SizeStr(),
types.NewInt(uint64(avail)).SizeStr(),
types.NewInt(uint64(fsavail)).SizeStr(),
types.NewInt(uint64(f.reservedBytes())).SizeStr())
}
f.reserved[typ] += need