我正在尝试使用链码查询从区块链中获取数据。我已经在区块链中调用了大约250,000条记录,并尝试使用查询来获取数据。当我运行chaincode并获取对等日志时,出现以下错误。
failed to invoke chaincode name:"scbcch" , error: timeout expired while executing transaction
当我查询较少的数据时,我的代码运行正常,没有这些错误。
任何人都可以帮助我解决问题。
我正在使用Hyperledger Fabric 1.4。
这是我的查询代码:
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)
我的索引是:
{"index":{"fields":["terminationReportID","terminationReportFlag","effectiveDateOfAction","importDate"]},"ddoc":"indexTerminationReportDoc", "name":"indexTerminationReportName","type":"json"}
[任何人都可以帮助我找出并解决问题。我已经坚持了3天以上。
索引部分是否需要更改。我正在重新发布同一问题,因为我对此问题没有任何支持。
问题与链码执行超时有关。您可以在对等方的docker文件中对其进行自定义。
CORE_CHAINCODE_EXECUTETIMEOUT=80s