Skip to content

Commit 37c65aa

Browse files
committed
[FAB-10558] Fix bug for bulkupdates of write-only keys
This CR fixes a small bug in the code path of writing the documents to the couchdb using bulkload. The loaded revisions numbers were not getting added to the revision map properly in the case of write-only keys. Change-Id: I7977b75a87d13156dd889f20b2e81e75a8c5b7d4 Signed-off-by: manish <manish.sethi@gmail.com>
1 parent df69ad4 commit 37c65aa

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

core/ledger/kvledger/txmgmt/statedb/statecouchdb/commit_handling.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,13 @@ func addRevisionsForMissingKeys(revisions map[string]string, db *couchdb.CouchDa
175175
missingKeys = append(missingKeys, key)
176176
}
177177
}
178+
logger.Debugf("Pulling revisions for the [%d] keys for namsespace [%s] that were not part of the readset", len(missingKeys), db.DBName)
178179
retrievedMetadata, err := retrieveNsMetadata(db, missingKeys)
179180
if err != nil {
180181
return err
181182
}
182183
for _, metadata := range retrievedMetadata {
183-
revisions[metadata.ID] = revisions[metadata.Rev]
184+
revisions[metadata.ID] = metadata.Rev
184185
}
185186
return nil
186187
}

core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
)
2626

2727
func TestMain(m *testing.M) {
28+
flogging.SetModuleLevel("statecouchdb", "debug")
29+
flogging.SetModuleLevel("couchdb", "debug")
2830
os.Exit(testMain(m))
2931
}
3032

0 commit comments

Comments
 (0)