From f8e7b27a6f236c7dcb67120c79bb4369ae477a03 Mon Sep 17 00:00:00 2001 From: "Jason E. Aten" Date: Thu, 29 Oct 2020 22:09:55 +0000 Subject: [PATCH] don't apply startup shard cache to roaring with a specified view path - avoids creating a new empty 8 byte shard file under all the views that don't have them already. --- dbshard.go | 15 +++++++++++++++ txfactory.go | 2 ++ 2 files changed, 17 insertions(+) diff --git a/dbshard.go b/dbshard.go index ae69c8867..81efa7537 100644 --- a/dbshard.go +++ b/dbshard.go @@ -698,6 +698,21 @@ func (per *DBPerShard) TypedDBPerShardGetShardsForIndex(ty txtype, idx *Index, r per.Mu.Lock() defer per.Mu.Unlock() + if ty == roaringTxn && roaringViewPath != "" { + rx := &RoaringTx{ + Index: idx, + } + sos, err := rx.SliceOfShards("", "", "", roaringViewPath) + if err != nil { + return nil, err + } + shardMap = make(map[uint64]bool) + for _, shard := range sos { + shardMap[shard] = true + } + return shardMap, nil + } + i2ss, ok := per.index2shards[ty] if !ok { // index -> shardSet diff --git a/txfactory.go b/txfactory.go index 17ef34c75..e4a868806 100644 --- a/txfactory.go +++ b/txfactory.go @@ -1307,6 +1307,8 @@ func (f *TxFactory) green2blue(holder *Holder) (err error) { return nil } + holder.Logger.Printf("green2blue analysis begins.") + blueDest := f.types[0] greenSrc := f.types[1]