You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue has been identified in the interaction between the Firefly-fabconnect and Firefly Core services. Firefly-fabconnect is not correctly populating the transactionIndex and eventIndex for events within a single block, causing a UNIQUE constraint violation in the Firefly Core events table.
Details:
Firefly Core has a UNIQUE constraint on a set of fields for its events table. Each event processed by Firefly Core should have a unique combination of these fields to avoid conflicts. Firefly-fabconnect is responsible for generating and assigning unique transactionIndex and eventIndex values for each event in a block. However, it has been observed that Firefly-fabconnect is not correctly populating these indices.
This issue is preventing Firefly Core from processing multiple events of the same type within a single block. This could potentially lead to loss of data or incomplete data processing, impacting the overall functionality and data integrity of the system.
Recommended Actions:
The root cause of the issue appears to be with Firefly-fabconnect's event indexing. It is recommended to investigate why Firefly-fabconnect is not correctly populating transactionIndex and eventIndex for each event within a block. Once identified, a fix should be implemented to ensure that each event in a block is assigned a unique pair of indexes. This will allow Firefly Core to process and insert all events correctly without violating the UNIQUE constraint on its events table.
The text was updated successfully, but these errors were encountered:
I've identified the sporadic place where this issue occurs.
The processNewEvents method digests the events from two possible streams:
when a new blocks arrives
when a chaincode event gets emitted
Inside the chaincode event stream, when assembling the event model here the TransactionIndex and EventIndex fields are missing because, by the protobuf spec, these fields don't get emitted. One possible solution would be to fetch the particular block, parse it and find the event and transaction where the ccEvent occurs.
We tried a different approach, to force the blockEventNotifier stream (by commenting out the first if block, leaving only the block notifier stream) and it works.
We ran a 15 minutes load test for Transfer and with a 6-15 tx/block count, everything went successful both on Fabconnect and Firefly.
Still there are some questions, primarily, is that a valid approach? Can we "force" to use the block notifier with some configuration variable? What are the information that we're losing by removing the chaincode events stream?
Summary:
An issue has been identified in the interaction between the Firefly-fabconnect and Firefly Core services. Firefly-fabconnect is not correctly populating the transactionIndex and eventIndex for events within a single block, causing a UNIQUE constraint violation in the Firefly Core events table.
Details:
Firefly Core has a UNIQUE constraint on a set of fields for its events table. Each event processed by Firefly Core should have a unique combination of these fields to avoid conflicts. Firefly-fabconnect is responsible for generating and assigning unique transactionIndex and eventIndex values for each event in a block. However, it has been observed that Firefly-fabconnect is not correctly populating these indices.
Event creation logic in fabconnect:
Debugger inspector representation of the event in fabconnect:
What is received in Firefly Core:
The error that is thrown:
[2023-05-16T11:09:31.707+03:00] ERROR SQL insert failed: UNIQUE constraint failed: blockchainevents.namespace, blockchainevents.listener_id, blockchainevents.protocol_id sql=[ INSERT INTO blockchainevents (id,source,namespace,name,protocol_id,listener_id,output,info,timestamp,tx_type,tx_id,tx_blockchain_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12) ]: UNIQUE constraint failed: blockchainevents.namespace, blockchainevents.listener_id, blockchainevents.protocol_id dbtx=KzK541m0 ns=default pid=48305 role=event-manager
Impact:
This issue is preventing Firefly Core from processing multiple events of the same type within a single block. This could potentially lead to loss of data or incomplete data processing, impacting the overall functionality and data integrity of the system.
Recommended Actions:
The root cause of the issue appears to be with Firefly-fabconnect's event indexing. It is recommended to investigate why Firefly-fabconnect is not correctly populating transactionIndex and eventIndex for each event within a block. Once identified, a fix should be implemented to ensure that each event in a block is assigned a unique pair of indexes. This will allow Firefly Core to process and insert all events correctly without violating the UNIQUE constraint on its events table.
The text was updated successfully, but these errors were encountered: