-2

I am trying to fetch data from blockchain using query in chaincode. I have invoked around 2,50,000 records in blockchain and trying to fetch the data using query. When i run the chaincode and get the peer logs, I am getting the below error.

failed to invoke chaincode name:"scbcch" , error: timeout expired while executing transaction

When i do a query for lesser data my code works fine without these errors.

Can anybody please help me in solving the issue please.

I am using Hyperledger Fabric 1.4.

Here is my Query code:

queryString := fmt.Sprintf("{\"selector\":{\"_id\": {\"$gt\": null},\"$and\":[{\"terminationReportID\":{\"$ne\":\"%s\"}},{\"terminationReportFlag\":{\"$eq\":\"%s\"}},{\"effectiveDateOfAction\":{\"$gt\":\"%s\"}},{\"importDate\":{\"$eq\":\"%s\"}}]},\"fields\": [\"bankID\",\"effectiveDateOfAction\",\"costCentre\"],\"use_index\":[\"_design/indexTerminationReportDoc\",\"indexTerminationReportName\"]}","null", "Yes", "2018-10-31", lastImportDatekey)

queryResultss11, errtr := getQueryResultForQueryString(stub, queryString)

And my Indexing is:

{"index":{"fields":["terminationReportID","terminationReportFlag","effectiveDateOfAction","importDate"]},"ddoc":"indexTerminationReportDoc", "name":"indexTerminationReportName","type":"json"}

Can anyone please help me to figure out and resolve the issue. I am stuck with this for more than 3 days.

Is there anything I have to change on my index part. I am re-posting the same issue as I am not getting any support for this issue.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Priyanka
  • 19
  • 1
  • 8

1 Answers1

0

The issue is with the chaincode execution timeout.You can customize it in the docker file of your peers.

CORE_CHAINCODE_EXECUTETIMEOUT=80s
Shubham Jaiswal
  • 570
  • 5
  • 11
  • Thank you @shubham for the reponse. I have already added this line in my docker compose.yml. But Is it correct if I add it in peer configuration? – Priyanka Apr 01 '20 at 12:25