From 4cddfd1074ba9d78871cff6978518e30653ef314 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 4 Feb 2022 14:29:50 +0200 Subject: [PATCH 01/12] background cold object reification --- blockstore/splitstore/splitstore.go | 14 ++ blockstore/splitstore/splitstore_reify.go | 181 ++++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 blockstore/splitstore/splitstore_reify.go diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 6a65e01df36..0d7ad07797e 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -161,6 +161,12 @@ type SplitStore struct { txnSyncCond sync.Cond txnSync bool + // background cold object reification + reifyMx sync.Mutex + reifyCond sync.Cond + reifyPend map[cid.Cid]struct{} + reifyInProgress map[cid.Cid]struct{} + // registered protectors protectors []func(func(cid.Cid) error) error } @@ -202,6 +208,10 @@ func Open(path string, ds dstore.Datastore, hot, cold bstore.Blockstore, cfg *Co ss.txnSyncCond.L = &ss.txnSyncMx ss.ctx, ss.cancel = context.WithCancel(context.Background()) + ss.reifyCond.L = &ss.reifyMx + ss.reifyPend = make(map[cid.Cid]struct{}) + ss.reifyInProgress = make(map[cid.Cid]struct{}) + if enableDebugLog { ss.debug, err = openDebugLog(path) if err != nil { @@ -645,6 +655,9 @@ func (s *SplitStore) Start(chain ChainAccessor, us stmgr.UpgradeSchedule) error } } + // spawn the reifier + go s.reifyOrchestrator() + // watch the chain chain.SubscribeHeadChanges(s.HeadChange) @@ -676,6 +689,7 @@ func (s *SplitStore) Close() error { } } + s.reifyCond.Broadcast() s.cancel() return multierr.Combine(s.markSetEnv.Close(), s.debug.Close()) } diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go new file mode 100644 index 00000000000..f60100d8aec --- /dev/null +++ b/blockstore/splitstore/splitstore_reify.go @@ -0,0 +1,181 @@ +package splitstore + +import ( + "runtime" + "sync/atomic" + + "golang.org/x/xerrors" + + blocks "github.com/ipfs/go-block-format" + cid "github.com/ipfs/go-cid" +) + +func (s *SplitStore) reifyColdObject(c cid.Cid) { + if isUnitaryObject(c) { + return + } + + s.reifyMx.Lock() + defer s.reifyMx.Unlock() + + _, ok := s.reifyInProgress[c] + if ok { + return + } + + s.reifyPend[c] = struct{}{} + s.reifyCond.Broadcast() +} + +func (s *SplitStore) reifyOrchestrator() { + workers := runtime.NumCPU() / 4 + if workers < 2 { + workers = 2 + } + + workch := make(chan cid.Cid, workers) + defer close(workch) + + for i := 0; i < workers; i++ { + go s.reifyWorker(workch) + } + + for { + s.reifyMx.Lock() + for len(s.reifyPend) == 0 && atomic.LoadInt32(&s.closing) == 0 { + s.reifyCond.Wait() + } + + if atomic.LoadInt32(&s.closing) != 0 { + s.reifyMx.Unlock() + return + } + + reifyPend := s.reifyPend + s.reifyPend = make(map[cid.Cid]struct{}) + s.reifyMx.Unlock() + + for c := range reifyPend { + select { + case workch <- c: + case <-s.ctx.Done(): + return + } + } + } +} + +func (s *SplitStore) reifyWorker(workch chan cid.Cid) { + for c := range workch { + s.doReify(c) + } +} + +func (s *SplitStore) doReify(c cid.Cid) { + var toreify, totrack, toforget []cid.Cid + + defer func() { + s.reifyMx.Lock() + defer s.reifyMx.Unlock() + + for _, c := range toreify { + delete(s.reifyInProgress, c) + } + for _, c := range totrack { + delete(s.reifyInProgress, c) + } + for _, c := range toforget { + delete(s.reifyInProgress, c) + } + }() + + s.txnLk.RLock() + defer s.txnLk.RUnlock() + + err := s.walkObject(c, newTmpVisitor(), + func(c cid.Cid) error { + if isUnitaryObject(c) { + return errStopWalk + } + + s.reifyMx.Lock() + _, inProgress := s.reifyInProgress[c] + if !inProgress { + s.reifyInProgress[c] = struct{}{} + } + s.reifyMx.Unlock() + + if inProgress { + return errStopWalk + } + + has, err := s.hot.Has(s.ctx, c) + if err != nil { + return xerrors.Errorf("error checking hotstore: %w", err) + } + + if has { + if s.txnMarkSet != nil { + hasMark, err := s.txnMarkSet.Has(c) + if err != nil { + log.Warnf("error checking markset: %s", err) + } else if hasMark { + toforget = append(toforget, c) + return errStopWalk + } + } else { + totrack = append(totrack, c) + return errStopWalk + } + } + + toreify = append(toreify, c) + return nil + }) + + if err != nil { + log.Warnf("error walking cold object for reification (cid: %s): %s", c, err) + return + } + + log.Debugf("reifying %d objects rooted at %s", len(toreify), c) + + batch := make([]blocks.Block, 0, len(toreify)) + for _, c := range toreify { + blk, err := s.cold.Get(s.ctx, c) + if err != nil { + log.Warnf("error retrieving cold object for reification (cid: %s): %s", c, err) + continue + } + + if err := s.checkClosing(); err != nil { + return + } + + batch = append(batch, blk) + } + + if len(batch) > 0 { + err = s.hot.PutMany(s.ctx, batch) + if err != nil { + log.Warnf("error reifying cold object (cid: %s): %s", c, err) + return + } + } + + if s.txnMarkSet != nil { + if len(toreify) > 0 { + s.markLiveRefs(toreify) + } + if len(totrack) > 0 { + s.markLiveRefs(totrack) + } + } else { + if len(toreify) > 0 { + s.trackTxnRefMany(toreify) + } + if len(totrack) > 0 { + s.trackTxnRefMany(totrack) + } + } +} From 268366e4467d179c2b9a2e4350e2b0078612803c Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 4 Feb 2022 16:07:58 +0200 Subject: [PATCH 02/12] cold object reification context option --- blockstore/context.go | 21 +++++++++++++++++++++ blockstore/splitstore/splitstore.go | 21 +++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 blockstore/context.go diff --git a/blockstore/context.go b/blockstore/context.go new file mode 100644 index 00000000000..61cb93b30f3 --- /dev/null +++ b/blockstore/context.go @@ -0,0 +1,21 @@ +package blockstore + +import ( + "context" +) + +type hotViewKey struct{} + +var hotView = hotViewKey{} + +// WithHotView constructs a new context with an option that provides a hint to the blockstore +// (e.g. the splitstore) that the object (and its ipld references) should be kept hot. +func WithHotView(ctx context.Context) context.Context { + return context.WithValue(ctx, hotView, struct{}{}) +} + +// GetHotView returns true if the hot view option is set in the context +func GetHotView(ctx context.Context) bool { + v := ctx.Value(hotView) + return v != nil +} diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 0d7ad07797e..5c2cf7203f7 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -274,7 +274,13 @@ func (s *SplitStore) Has(ctx context.Context, cid cid.Cid) (bool, error) { return true, nil } - return s.cold.Has(ctx, cid) + has, err = s.cold.Has(ctx, cid) + if has && bstore.GetHotView(ctx) { + s.reifyColdObject(cid) + } + + return has, err + } func (s *SplitStore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) { @@ -318,8 +324,11 @@ func (s *SplitStore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) blk, err = s.cold.Get(ctx, cid) if err == nil { - stats.Record(s.ctx, metrics.SplitstoreMiss.M(1)) + if bstore.GetHotView(ctx) { + s.reifyColdObject(cid) + } + stats.Record(s.ctx, metrics.SplitstoreMiss.M(1)) } return blk, err @@ -369,6 +378,10 @@ func (s *SplitStore) GetSize(ctx context.Context, cid cid.Cid) (int, error) { size, err = s.cold.GetSize(ctx, cid) if err == nil { + if bstore.GetHotView(ctx) { + s.reifyColdObject(cid) + } + stats.Record(s.ctx, metrics.SplitstoreMiss.M(1)) } return size, err @@ -546,6 +559,10 @@ func (s *SplitStore) View(ctx context.Context, cid cid.Cid, cb func([]byte) erro err = s.cold.View(ctx, cid, cb) if err == nil { + if bstore.GetHotView(ctx) { + s.reifyColdObject(cid) + } + stats.Record(s.ctx, metrics.SplitstoreMiss.M(1)) } return err From 929a05e8981c1b08b1e3619a2c7764258b933b6c Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 4 Feb 2022 16:16:34 +0200 Subject: [PATCH 03/12] add reification test --- blockstore/splitstore/splitstore_test.go | 130 +++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/blockstore/splitstore/splitstore_test.go b/blockstore/splitstore/splitstore_test.go index 27d58bf1043..6b7e60e6c50 100644 --- a/blockstore/splitstore/splitstore_test.go +++ b/blockstore/splitstore/splitstore_test.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io/ioutil" + "math/rand" "os" "sync" "sync/atomic" @@ -387,6 +388,135 @@ func TestSplitStoreSuppressCompactionNearUpgrade(t *testing.T) { } } +func testSplitStoreReification(t *testing.T, f func(context.Context, blockstore.Blockstore, cid.Cid) error) { + ds := dssync.MutexWrap(datastore.NewMapDatastore()) + hot := newMockStore() + cold := newMockStore() + + mkRandomBlock := func() blocks.Block { + data := make([]byte, 128) + _, err := rand.Read(data) + if err != nil { + t.Fatal(err) + } + + return blocks.NewBlock(data) + } + + block1 := mkRandomBlock() + block2 := mkRandomBlock() + block3 := mkRandomBlock() + + hdr := mock.MkBlock(nil, 0, 0) + hdr.Messages = block1.Cid() + hdr.ParentMessageReceipts = block2.Cid() + hdr.ParentStateRoot = block3.Cid() + block4, err := hdr.ToStorageBlock() + if err != nil { + t.Fatal(err) + } + + allBlocks := []blocks.Block{block1, block2, block3, block4} + for _, blk := range allBlocks { + err := cold.Put(context.Background(), blk) + if err != nil { + t.Fatal(err) + } + } + + path, err := ioutil.TempDir("", "splitstore.*") + if err != nil { + t.Fatal(err) + } + + t.Cleanup(func() { + _ = os.RemoveAll(path) + }) + + ss, err := Open(path, ds, hot, cold, &Config{MarkSetType: "map"}) + if err != nil { + t.Fatal(err) + } + defer ss.Close() //nolint + + ss.warmupEpoch = 1 + go ss.reifyOrchestrator() + + waitForReification := func() { + for { + ss.reifyMx.Lock() + ready := len(ss.reifyPend) == 0 && len(ss.reifyInProgress) == 0 + ss.reifyMx.Unlock() + + if ready { + return + } + + time.Sleep(time.Millisecond) + } + } + + // first access using the standard view + err = f(context.Background(), ss, block4.Cid()) + if err != nil { + t.Fatal(err) + } + + // nothing should be reified + waitForReification() + for _, blk := range allBlocks { + has, err := hot.Has(context.Background(), blk.Cid()) + if err != nil { + t.Fatal(err) + } + + if has { + t.Fatal("block unexpectedly reified") + } + } + + // now make the hot/reifying view and ensure access reifies + err = f(blockstore.WithHotView(context.Background()), ss, block4.Cid()) + if err != nil { + t.Fatal(err) + } + + // everything should be reified + waitForReification() + for i, blk := range allBlocks { + has, err := hot.Has(context.Background(), blk.Cid()) + if err != nil { + t.Fatal(err) + } + + if !has { + t.Fatalf("block%d was not reified", i+1) + } + } +} + +func TestSplitStoreReification(t *testing.T) { + t.Log("test reification with Has") + testSplitStoreReification(t, func(ctx context.Context, s blockstore.Blockstore, c cid.Cid) error { + _, err := s.Has(ctx, c) + return err + }) + t.Log("test reification with Get") + testSplitStoreReification(t, func(ctx context.Context, s blockstore.Blockstore, c cid.Cid) error { + _, err := s.Get(ctx, c) + return err + }) + t.Log("test reification with GetSize") + testSplitStoreReification(t, func(ctx context.Context, s blockstore.Blockstore, c cid.Cid) error { + _, err := s.GetSize(ctx, c) + return err + }) + t.Log("test reification with View") + testSplitStoreReification(t, func(ctx context.Context, s blockstore.Blockstore, c cid.Cid) error { + return s.View(ctx, c, func(_ []byte) error { return nil }) + }) +} + type mockChain struct { t testing.TB From 73c741f20ce4fff4bd15824dd75e2110bcfa4c8b Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 4 Feb 2022 16:19:28 +0200 Subject: [PATCH 04/12] reify cold objects on block validation/application --- chain/consensus/filcns/compute_state.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index f7f6284d0a0..34bc439ac19 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -32,6 +32,7 @@ import ( /* inline-gen end */ + "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -106,7 +107,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager LookbackState: stmgr.LookbackStateGetterForTipset(sm, ts), } - return sm.VMConstructor()(ctx, vmopt) + return sm.VMConstructor()(blockstore.WithHotView(ctx), vmopt) } runCron := func(vmCron *vm.VM, epoch abi.ChainEpoch) error { From 9d92b6eb9213cfd968fda564bc63fb16aa5bad5d Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 4 Feb 2022 16:57:08 +0200 Subject: [PATCH 05/12] correctly wrap hotview in the context for compute_state --- chain/consensus/filcns/compute_state.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chain/consensus/filcns/compute_state.go b/chain/consensus/filcns/compute_state.go index 34bc439ac19..44b79285420 100644 --- a/chain/consensus/filcns/compute_state.go +++ b/chain/consensus/filcns/compute_state.go @@ -93,6 +93,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager partDone() }() + ctx = blockstore.WithHotView(ctx) makeVmWithBaseStateAndEpoch := func(base cid.Cid, e abi.ChainEpoch) (*vm.VM, error) { vmopt := &vm.VMOpts{ StateBase: base, @@ -107,7 +108,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context, sm *stmgr.StateManager LookbackState: stmgr.LookbackStateGetterForTipset(sm, ts), } - return sm.VMConstructor()(blockstore.WithHotView(ctx), vmopt) + return sm.VMConstructor()(ctx, vmopt) } runCron := func(vmCron *vm.VM, epoch abi.ChainEpoch) error { From a32b7a32f3f91dadb8d44e7676f2cf40e0114a39 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 5 Feb 2022 20:00:15 +0200 Subject: [PATCH 06/12] directly mark objects in cold object reification --- blockstore/splitstore/splitstore_reify.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index f60100d8aec..ad51687c178 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -165,10 +165,10 @@ func (s *SplitStore) doReify(c cid.Cid) { if s.txnMarkSet != nil { if len(toreify) > 0 { - s.markLiveRefs(toreify) + s.txnMarkSet.MarkMany(toreify) } if len(totrack) > 0 { - s.markLiveRefs(totrack) + s.txnMarkSet.MarkMany(totrack) } } else { if len(toreify) > 0 { From 713edd565ccaf9483cbf812ee8585caee2188b2c Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 5 Feb 2022 21:30:53 +0200 Subject: [PATCH 07/12] fix lint --- blockstore/splitstore/splitstore_reify.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index ad51687c178..3c65bbce807 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -165,10 +165,14 @@ func (s *SplitStore) doReify(c cid.Cid) { if s.txnMarkSet != nil { if len(toreify) > 0 { - s.txnMarkSet.MarkMany(toreify) + if err := s.txnMarkSet.MarkMany(toreify); err != nil { + log.Warnf("error marking reified objects: %s", err) + } } if len(totrack) > 0 { - s.txnMarkSet.MarkMany(totrack) + if err := s.txnMarkSet.MarkMany(totrack); err != nil { + log.Warnf("error marking tracked objects: %s", err) + } } } else { if len(toreify) > 0 { From b576785aac0e1cbcde8a0f59eb0cfc196e9c03dc Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 14 Feb 2022 16:03:17 +0200 Subject: [PATCH 08/12] rename GetHotView to IsHotView --- blockstore/context.go | 4 ++-- blockstore/splitstore/splitstore.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blockstore/context.go b/blockstore/context.go index 61cb93b30f3..ebb6fafe337 100644 --- a/blockstore/context.go +++ b/blockstore/context.go @@ -14,8 +14,8 @@ func WithHotView(ctx context.Context) context.Context { return context.WithValue(ctx, hotView, struct{}{}) } -// GetHotView returns true if the hot view option is set in the context -func GetHotView(ctx context.Context) bool { +// IsHotView returns true if the hot view option is set in the context +func IsHotView(ctx context.Context) bool { v := ctx.Value(hotView) return v != nil } diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 5c2cf7203f7..6f499b366b4 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -275,7 +275,7 @@ func (s *SplitStore) Has(ctx context.Context, cid cid.Cid) (bool, error) { } has, err = s.cold.Has(ctx, cid) - if has && bstore.GetHotView(ctx) { + if has && bstore.IsHotView(ctx) { s.reifyColdObject(cid) } @@ -324,7 +324,7 @@ func (s *SplitStore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) blk, err = s.cold.Get(ctx, cid) if err == nil { - if bstore.GetHotView(ctx) { + if bstore.IsHotView(ctx) { s.reifyColdObject(cid) } @@ -378,7 +378,7 @@ func (s *SplitStore) GetSize(ctx context.Context, cid cid.Cid) (int, error) { size, err = s.cold.GetSize(ctx, cid) if err == nil { - if bstore.GetHotView(ctx) { + if bstore.IsHotView(ctx) { s.reifyColdObject(cid) } @@ -559,7 +559,7 @@ func (s *SplitStore) View(ctx context.Context, cid cid.Cid, cb func([]byte) erro err = s.cold.View(ctx, cid, cb) if err == nil { - if bstore.GetHotView(ctx) { + if bstore.IsHotView(ctx) { s.reifyColdObject(cid) } From a428f4479356260cf035add6867d3c7a20c8a307 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 14 Feb 2022 16:04:39 +0200 Subject: [PATCH 09/12] don't reify objects while still warming up --- blockstore/splitstore/splitstore_reify.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index 3c65bbce807..3e6d7cd22ed 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -11,6 +11,10 @@ import ( ) func (s *SplitStore) reifyColdObject(c cid.Cid) { + if !s.isWarm() { + return + } + if isUnitaryObject(c) { return } From 6c7ababd3f145bb494691d073bab6cd4bb6a4930 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 14 Feb 2022 16:06:12 +0200 Subject: [PATCH 10/12] add comment about trackTxnRefs being noops if txnActive is false --- blockstore/splitstore/splitstore_reify.go | 1 + 1 file changed, 1 insertion(+) diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index 3e6d7cd22ed..daa10c51332 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -179,6 +179,7 @@ func (s *SplitStore) doReify(c cid.Cid) { } } } else { + // if txnActive is false these are noops if len(toreify) > 0 { s.trackTxnRefMany(toreify) } From 4524fbe936134f60e1005326418b6deafb002c63 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 14 Feb 2022 16:10:54 +0200 Subject: [PATCH 11/12] wait for reify workers to finish when closing --- blockstore/splitstore/splitstore.go | 2 ++ blockstore/splitstore/splitstore_reify.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/blockstore/splitstore/splitstore.go b/blockstore/splitstore/splitstore.go index 6f499b366b4..a351df76a46 100644 --- a/blockstore/splitstore/splitstore.go +++ b/blockstore/splitstore/splitstore.go @@ -162,6 +162,7 @@ type SplitStore struct { txnSync bool // background cold object reification + reifyWorkers sync.WaitGroup reifyMx sync.Mutex reifyCond sync.Cond reifyPend map[cid.Cid]struct{} @@ -707,6 +708,7 @@ func (s *SplitStore) Close() error { } s.reifyCond.Broadcast() + s.reifyWorkers.Wait() s.cancel() return multierr.Combine(s.markSetEnv.Close(), s.debug.Close()) } diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index daa10c51332..cb86c9789e9 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -41,6 +41,7 @@ func (s *SplitStore) reifyOrchestrator() { defer close(workch) for i := 0; i < workers; i++ { + s.reifyWorkers.Add(1) go s.reifyWorker(workch) } @@ -70,6 +71,7 @@ func (s *SplitStore) reifyOrchestrator() { } func (s *SplitStore) reifyWorker(workch chan cid.Cid) { + defer s.reifyWorkers.Done() for c := range workch { s.doReify(c) } From 6bcade5e6decb3dfd1671cc0247fba308834cce3 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 14 Feb 2022 16:13:54 +0200 Subject: [PATCH 12/12] add comment about bigness of reification batch --- blockstore/splitstore/splitstore_reify.go | 1 + 1 file changed, 1 insertion(+) diff --git a/blockstore/splitstore/splitstore_reify.go b/blockstore/splitstore/splitstore_reify.go index cb86c9789e9..14648a65217 100644 --- a/blockstore/splitstore/splitstore_reify.go +++ b/blockstore/splitstore/splitstore_reify.go @@ -146,6 +146,7 @@ func (s *SplitStore) doReify(c cid.Cid) { log.Debugf("reifying %d objects rooted at %s", len(toreify), c) + // this should not get too big, maybe some 100s of objects. batch := make([]blocks.Block, 0, len(toreify)) for _, c := range toreify { blk, err := s.cold.Get(s.ctx, c)