Skip to content

Commit 10b5eff

Browse files
committed
recon: disable by not storing the missing data entries
Added flag to enable/disable missing data reconciliation. When disabled, no missing data entries are stored in the pvtstore. FAB-12019 #done Change-Id: Ifaf980942f92a57a3f4d23024846956951e84124 Signed-off-by: senthil <cendhu@gmail.com>
1 parent c29724a commit 10b5eff

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/ledger/ledgerstorage/store.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
)
2222

2323
var logger = flogging.MustGetLogger("ledgerstorage")
24+
var isMissingDataReconEnabled = false
2425

2526
// Provider encapusaltes two providers 1) block store provider and 2) and pvt data store provider
2627
type Provider struct {
@@ -88,6 +89,8 @@ func (s *Store) Init(btlPolicy pvtdatapolicy.BTLPolicy) {
8889
// CommitWithPvtData commits the block and the corresponding pvt data in an atomic operation
8990
func (s *Store) CommitWithPvtData(blockAndPvtdata *ledger.BlockAndPvtData) error {
9091
blockNum := blockAndPvtdata.Block.Header.Number
92+
missingDataList := blockAndPvtdata.Missing
93+
9194
s.rwlock.Lock()
9295
defer s.rwlock.Unlock()
9396

@@ -105,7 +108,11 @@ func (s *Store) CommitWithPvtData(blockAndPvtdata *ledger.BlockAndPvtData) error
105108
for _, v := range blockAndPvtdata.BlockPvtData {
106109
pvtdata = append(pvtdata, v)
107110
}
108-
if err := s.pvtdataStore.Prepare(blockAndPvtdata.Block.Header.Number, pvtdata, blockAndPvtdata.Missing); err != nil {
111+
if !isMissingDataReconEnabled {
112+
// should not store any entries for missing data
113+
missingDataList = nil
114+
}
115+
if err := s.pvtdataStore.Prepare(blockAndPvtdata.Block.Header.Number, pvtdata, missingDataList); err != nil {
109116
return err
110117
}
111118
writtenToPvtStore = true

0 commit comments

Comments
 (0)