fabric icon indicating copy to clipboard operation
fabric copied to clipboard

CouchDB index support for implicit collections

Open bkiran6398 opened this issue 1 year ago • 2 comments

Allow CouchDB index creation on implicit collection of organisations.

Indexes can be created for specific organisation's implicit collections at: META-INF/statedb/couchdb/collections/_implicit_org_<MSP_ID> directory of the chaincode package.

Common indexes for all the organisations' implicit collection can be created at: META-INF/statedb/couchdb/collections/_implicit_org_* directory of the chaincode package. ( * acts as wildcard for all organisation MSP ids. )

Type of change

  • New feature

Description

Updated chaincode deployment handler to check if the indexes are for implicit collection if given collection directory name not explicitly defined in collection config. If the implicit collection indexes belong this handling peer's organisation or passed as global implicit collection indexes (using * notation), then indexes are created on corresponding implicit collection.

Additional details

  • Please review the way of fetching localMspId directly using viper at NewDB constructor function.
  • Added few more tar file entries to represent implicit collection indexes in unit tests. (However UT TestHandleChainCodeDeployOnCouchDB was already failing due to some other error)

Related issues

  • #4780

bkiran6398 avatar Apr 04 '24 08:04 bkiran6398

We'll want an integration test for both the single org use case and all org use case. It should be feasible to extend the existing CouchDB index integration test here: https://github.com/hyperledger/fabric/blob/main/integration/ledger/couchdb_indexes_test.go

denyeart avatar Apr 19 '24 12:04 denyeart

Not many people use Windows for Fabric, but still, asterisk is not allowed in Windows directory names. Maybe use _implicit_all_orgs?

denyeart avatar Apr 19 '24 12:04 denyeart