Skip to content

Commit 674bb56

Browse files
committed
[FAB-12205] fix data race creating fs blocksItr
updateCheckpoint can run concurrent with the construction of a blocks iterator. When this happens, serialization is needed between the update of the checkpoint info and the read done by the construction of the iterator. Change-Id: I4fba0400820abd2c6d7c511286a8382b801563e9 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent 6e7eef1 commit 674bb56

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

common/ledger/blkstorage/fsblkstorage/blocks_itr.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ type blocksItr struct {
3333
}
3434

3535
func newBlockItr(mgr *blockfileMgr, startBlockNum uint64) *blocksItr {
36+
mgr.cpInfoCond.L.Lock()
37+
defer mgr.cpInfoCond.L.Unlock()
3638
return &blocksItr{mgr, mgr.cpInfo.lastBlockNumber, startBlockNum, nil, false, &sync.Mutex{}}
3739
}
3840

0 commit comments

Comments
 (0)