Skip to content
  • Srinivasan Muralidharan's avatar
    fab-1475 make CC fmk allow concurrent invokes · 5bdca867
    Srinivasan Muralidharan authored
    https://jira.hyperledger.org/browse/FAB-1475
    
    
    
    Summary
    =======
    With pre-consensus simulation, multiple chains and relaxation by the ledger
    to simulate versions of chaincode state concurrently, we can now allow
    chaincode framework to execute invokes concurrently. This CR enables this.
    
    This CR enables concurrency basically by removing the FSM states that
    enforced serialization (so basically all the FSM changes in chaincode/hander.go
    and chaincode/shim/handler.go).
    
    The CR also has a "Chaincode Checker" program which has the potential for
    much bigger things
       . the tooling test their chaincodes for consistency
       . the tooling for stressing the fabric
    
    The concurrency enablement was tested with the "ccchecker".
    
    Details
    =======
    The submit will basically have 4 things
      . changes to 3 chaincode framework files handler.go files
        to enable concurrency
      . concurrency_test.go to run 100 concurrent invokes followed
        by 100 concurrent queries
      . a complete "ccchecker" example framework for testing and validating
        chaincodes
      . exports some functions under fabric/peer/chaincode CLI for use by
        the above ccchecker example framework
    
    "ccchecker" comes with a sample "newkeyperinvoke" chaincode that should
    NEVER fail ledger consistency checks. To test simply follow these steps
      . vagrant window 1 - start orderer
        ./orderer
    
      . vagrant window 2 - start peer
        peer node start
    
      . vagrant window 3 - bring up chaincode for test
        cd peer
    
        //deploy the chaincode used by ccchecker out of the box
        peer chaincode deploy -n mycc -p github.com/hyperledger/fabric/examples/ccchecker/chaincodes/newkeyperinvoke -c '{"Args":[""]}'
        //wait for commit say for about 10 secs and then issue a query to bring the CC up
        peer chaincode query -n mycc -c '{"Args":["get","a"]}'
    
        //verify the chaincode is up
        docker ps
    
      . vagrant window 4 - run test
        cd examples/ccchecker
        go build
        ./ccchecker
    
    The above reads from ccchecker.json and executes tests concurrently.
    
    Change-Id: I5267b19f03ed10003eb28facf87693525f0dcd1a
    Signed-off-by: default avatarSrinivasan Muralidharan <muralisr@us.ibm.com>
    5bdca867