Commit 674bb563 authored by Matthew Sykes's avatar Matthew Sykes
Browse files

[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: default avatarMatthew Sykes <sykesmat@us.ibm.com>
parent 6e7eef15
......@@ -33,6 +33,8 @@ type blocksItr struct {
}
func newBlockItr(mgr *blockfileMgr, startBlockNum uint64) *blocksItr {
mgr.cpInfoCond.L.Lock()
defer mgr.cpInfoCond.L.Unlock()
return &blocksItr{mgr, mgr.cpInfo.lastBlockNumber, startBlockNum, nil, false, &sync.Mutex{}}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment