Fix perf issue by key-endorsement to regular chaincode
Key-level endorsement needs to access the metadata for each of the keys in the write-set. Even the chaincodes that do not use this feature will end up paying this additional penality. Especially, in an environment that uses couchdb, the performance regression will be visible for the existing chaincodes. The major reason is that the metadata is accessed one at a time during validation and commit path whereas, couchdb is better used if the data can be loaded in bulk. Ideally, the data required by key-level endorsement for the entire block should be loaded in a single bulk load call. Which would benefit even the chaincodes that leverage this feature. However, this would need some refactoring that can be taken up in a future release. This CR introduces a fix which would save the regular chaincodes (that do not use key-level endorsement feature) from paying the avobe mentioned penality. In this fix, we track the chaincodes that do not use metadata and for such chaincodes, the GetStateMetadata call simply returns nil without going to the underlying db. Even when we start using the bulk-load for key-level endorsement, this fix will still be relevant in the sense that the bulkload call will be avoided for regular chaincodes FAB-11700 #done Change-Id: Icfc654b7d27f727f1811a5a300400e92b6e8be9d Signed-off-by: manish <email@example.com>
This diff is collapsed.