Skip to content

Commit b53666d

Browse files
committed
Fix CouchDB transaction manager lock issue
The committer read/write lock was at wrong level, causing a lock that never got unlocked during end-to-end trials. Change-Id: I49b31207844b97f7e6f7e375450728a7ca71e7dd Signed-off-by: denyeart <[email protected]>
1 parent 6ac4ed5 commit b53666d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/ledger/kvledger/txmgmt/couchdbtxmgmt/couchdb_txmgr.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ func (txmgr *CouchDBTxMgr) Commit() error {
264264
panic("validateAndPrepare() method should have been called before calling commit()")
265265
}
266266

267-
for k, v := range txmgr.updateSet.m {
267+
txmgr.commitRWLock.Lock()
268+
defer txmgr.commitRWLock.Unlock()
269+
defer func() { txmgr.updateSet = nil }()
268270

269-
txmgr.commitRWLock.Lock()
270-
defer txmgr.commitRWLock.Unlock()
271-
defer func() { txmgr.updateSet = nil }()
271+
for k, v := range txmgr.updateSet.m {
272272

273273
if couchdb.IsJSON(string(v.value)) {
274274

0 commit comments

Comments
 (0)