Skip to content

Commit

Permalink
[FAB-8347] Fix re-entrant lock isuue
Browse files Browse the repository at this point in the history
This CR fixes a re-entrant lock issue that happens
during the block commit in the presence of pvt data

Change-Id: I61b42a17c5b95e6411cf9698265b2d066a3ea26d
Signed-off-by: manish <manish.sethi@gmail.com>
  • Loading branch information
manish-sethi committed May 1, 2018
1 parent 661cb94 commit df9dd48
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ func (txmgr *LockBasedTxMgr) Commit() error {
}()

logger.Debugf("Committing updates to state database")
txmgr.commitRWLock.Lock()
logger.Debugf("Write lock acquired for committing updates to state database")
if txmgr.current == nil {
panic("validateAndPrepare() method should have been called before calling commit()")
}
Expand All @@ -153,6 +151,8 @@ func (txmgr *LockBasedTxMgr) Commit() error {
return err
}

txmgr.commitRWLock.Lock()
logger.Debugf("Write lock acquired for committing updates to state database")
commitHeight := version.NewHeight(txmgr.current.blockNum(), txmgr.current.maxTxNumber())
if err := txmgr.db.ApplyPrivacyAwareUpdates(txmgr.current.batch, commitHeight); err != nil {
return err
Expand Down

0 comments on commit df9dd48

Please sign in to comment.