chore: update flatfs
And remove retry logic. This was flatfs specific and we've moved the logic down into flatfs itself. This update: * Retries in more cases when we run out of file descriptors. * Ensures we don't leak temporary files on batch put.
Steven Allen committed
Apr 10, 2020 at 16:41 UTC
8679954f9bb560259fbda2cd42a42f957c07e2a2
3 files changed
+4
-24
core/node/storage.go
+1
-21
@@ -1,12 +1,7 @@
1
package node
2
3
import (
4
- "os"
5
- "syscall"
6
- "time"
7
-
4
"github.com/ipfs/go-datastore"
9
- "github.com/ipfs/go-datastore/retrystore"
5
blockstore "github.com/ipfs/go-ipfs-blockstore"
6
config "github.com/ipfs/go-ipfs-config"
7
"go.uber.org/fx"
@@ -18,15 +13,6 @@ import (
13
"github.com/ipfs/go-ipfs/thirdparty/verifbs"
14
)
15
21
-func isTooManyFDError(err error) bool {
22
- perr, ok := err.(*os.PathError)
23
- if ok && perr.Err == syscall.EMFILE {
24
- return true
25
- }
26
-
27
- return false
28
-}
29
-
16
// RepoConfig loads configuration from the repo
17
func RepoConfig(repo repo.Repo) (*config.Config, error) {
18
return repo.Config()
@@ -43,14 +29,8 @@ type BaseBlocks blockstore.Blockstore
29
// BaseBlockstoreCtor creates cached blockstore backed by the provided datastore
30
func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead bool) func(mctx helpers.MetricsCtx, repo repo.Repo, lc fx.Lifecycle) (bs BaseBlocks, err error) {
31
return func(mctx helpers.MetricsCtx, repo repo.Repo, lc fx.Lifecycle) (bs BaseBlocks, err error) {
46
- rds := &retrystore.Datastore{
47
- Batching: repo.Datastore(),
48
- Delay: time.Millisecond * 200,
49
- Retries: 6,
50
- TempErrFunc: isTooManyFDError,
51
- }
32
// hash security
53
- bs = blockstore.NewBlockstore(rds)
33
+ bs = blockstore.NewBlockstore(repo.Datastore())
34
bs = &verifbs.VerifBS{Blockstore: bs}
35
36
if !nilRepo {
go.mod
+1
-1
@@ -22,7 +22,7 @@ require (
22
github.com/ipfs/go-datastore v0.4.4
23
github.com/ipfs/go-detect-race v0.0.1
24
github.com/ipfs/go-ds-badger v0.2.4
25
- github.com/ipfs/go-ds-flatfs v0.4.2
25
+ github.com/ipfs/go-ds-flatfs v0.4.3
26
github.com/ipfs/go-ds-leveldb v0.4.2
27
github.com/ipfs/go-ds-measure v0.1.0
28
github.com/ipfs/go-filestore v0.0.3
go.sum
+2
-2
@@ -263,8 +263,8 @@ github.com/ipfs/go-ds-badger v0.2.3 h1:J27YvAcpuA5IvZUbeBxOcQgqnYHUPxoygc6Qxxkod
263
github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk=
264
github.com/ipfs/go-ds-badger v0.2.4 h1:UPGB0y7luFHk+mY/tUZrif/272M8o+hFsW+avLUeWrM=
265
github.com/ipfs/go-ds-badger v0.2.4/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk=
266
-github.com/ipfs/go-ds-flatfs v0.4.2 h1:v8VwVkmO+XN7YlrDgpuHl/0bGgu3qD44MKhIlbcfcFY=
267
-github.com/ipfs/go-ds-flatfs v0.4.2/go.mod h1:KiZoBq31WFUR5LmDKPUHhsc0XZgjho+R/AzEPQpaN4U=
266
+github.com/ipfs/go-ds-flatfs v0.4.3 h1:7M8/xpLkJhFJYaLumo2RRgt/cOehetutGW5zigTa5qY=
267
+github.com/ipfs/go-ds-flatfs v0.4.3/go.mod h1:e4TesLyZoA8k1gV/yCuBTnt2PJtypn4XUlB5n8KQMZY=
268
github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc=
269
github.com/ipfs/go-ds-leveldb v0.1.0 h1:OsCuIIh1LMTk4WIQ1UJH7e3j01qlOP+KWVhNS6lBDZY=
270
github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8=