Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-10558

Blind writes to CouchDB fails on bulk update API



    • Bug
    • Status: Closed
    • High
    • Resolution: Done
    • None
    • v1.2.0
    • fabric-ledger
    • None


      When testing private data as in FAB-10162, the transfer marble function shows a Warning:

      2018-06-06 05:46:01.976 EDT [couchdb] BatchUpdateDocuments -> DEBU 80c Exiting BatchUpdateDocuments() _bulk_docs response=[[{"id":"marble1","error":"conflict","reason":"Document update conflict."}]
      2018-06-06 05:46:01.976 EDT [statecouchdb] commitUpdates -> WARN 80d CouchDB batch document update encountered an problem. Retrying update for document ID:marble1

      The bulk update API _bulk_docs fails for the private key, causing a retry of individual documents, which ends up succeeding. 

      The bulk update API works for the hashed key.

      The difference is that with the hashed key, the couchdb revision is already in the cache from the MVCC check, and it gets placed correctly in the bulk docs JSON, like this:


      However with the private key, it is a blind write (no entry in readset), which means that the couchdb revision is not yet in the cache.  Note that the revision is missing in the bulk docs JSON:



      Interestingly, the missing revision did kick off a batch retrieve as expected, to retrieve the revision id:

      2018-06-06 05:46:01.971 EDT [couchdb] BatchRetrieveDocumentMetadata -> DEBU 7fb Entering BatchRetrieveDocumentMetadata()  keys=[marble1]
      2018-06-06 05:46:01.971 EDT [couchdb] handleRequest -> DEBU 7fc Entering handleRequest()  method=POST  url=$$pcollection$marbles/_all_docs?include_docs=true

      But somehow the revision id did not make it into the eventual bulk docs update API JSON.

      I suspect the problem got introduced during the CouchDB batch processing refactor  https://gerrit.hyperledger.org/r/#/c/19093/ , but wasn't noticed initially since the individual retries would hide any problem with the bulk API.


        Issue Links



              manish-sethi Manish Sethi
              denyeart David Enyeart
              0 Vote for this issue
              3 Start watching this issue