Merge pull request #10172 from ribasushi/fix/respect_nofsync
fix: extend LOTUS_CHAIN_BADGERSTORE_DISABLE_FSYNC to the markset
This commit is contained in:
+3
-13
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
"github.com/filecoin-project/lotus/system"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -479,19 +480,8 @@ func (fsr *fsLockedRepo) Blockstore(ctx context.Context, domain BlockstoreDomain
|
||||
return
|
||||
}
|
||||
|
||||
//
|
||||
// Tri-state environment variable LOTUS_CHAIN_BADGERSTORE_DISABLE_FSYNC
|
||||
// - unset == the default (currently fsync enabled)
|
||||
// - set with a false-y value == fsync enabled no matter what a future default is
|
||||
// - set with any other value == fsync is disabled ignored defaults (recommended for day-to-day use)
|
||||
//
|
||||
if nosyncBs, nosyncBsSet := os.LookupEnv("LOTUS_CHAIN_BADGERSTORE_DISABLE_FSYNC"); nosyncBsSet {
|
||||
nosyncBs = strings.ToLower(nosyncBs)
|
||||
if nosyncBs == "" || nosyncBs == "0" || nosyncBs == "false" || nosyncBs == "no" {
|
||||
opts.SyncWrites = true
|
||||
} else {
|
||||
opts.SyncWrites = false
|
||||
}
|
||||
if system.BadgerFsyncDisable {
|
||||
opts.SyncWrites = false
|
||||
}
|
||||
|
||||
bs, err := badgerbs.Open(opts)
|
||||
|
||||
Reference in New Issue
Block a user