From f727f1db2663f7d5d15feee6d0f92b9873b384fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 1 Apr 2020 22:37:34 +0200 Subject: [PATCH] bufbs: Env var to disable blockstore buffering --- lib/bufbstore/buf_bstore.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/bufbstore/buf_bstore.go b/lib/bufbstore/buf_bstore.go index b3421537e..0e7716684 100644 --- a/lib/bufbstore/buf_bstore.go +++ b/lib/bufbstore/buf_bstore.go @@ -2,13 +2,17 @@ package bufbstore import ( "context" + "os" block "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" bstore "github.com/ipfs/go-ipfs-blockstore" + logging "github.com/ipfs/go-log/v2" ) +var log = logging.Logger("bufbs") + type BufferedBS struct { read bstore.Blockstore write bstore.Blockstore @@ -16,6 +20,11 @@ type BufferedBS struct { func NewBufferedBstore(base bstore.Blockstore) *BufferedBS { buf := bstore.NewBlockstore(ds.NewMapDatastore()) + if os.Getenv("LOTUS_DISABLE_VM_BUF") == "iknowitsabadidea" { + log.Warn("VM BLOCKSTORE BUFFERING IS DISABLED") + buf = base + } + return &BufferedBS{ read: base, write: buf,