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

View File

@ -86,14 +86,19 @@ func (f *fs) reserve(typ dataType, size uint64) error {
return err 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 need := overheadMul[typ] * size
if int64(need) > avail { 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 f.reserved[typ] += need