-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subgraph using Aggregations failing randomly #5530
Comments
Running into the same issue: First deployment on arbitrum-sepolia failed on block 64040656 after deploying a new version failed on block 64603832 |
getting same error on multiple subgraphs. note that it can also happen for daily aggregations |
I'm also getting the same error in my subgraph.
|
Running into the same issue. Any updates on this? |
Same issue here. Also would be nice to include a working example of the mapping in https://github.com/graphprotocol/graph-node/blob/master/docs/aggregations.md |
Digging into one such example on Avalanche, this seems to be caused by blocks having the same timestamps. For example, on Avalanche blocks 51482738 and 51482739 both have the timestamp I have to look through the code to see if that truly is the issue, but block times being not monotonic is a bit of a bummer |
The timestamps were a red herring. What's happening is this: when a subgraph starts, we assume that the last time we did a rollup is the block time of the block where we last had an actual write/entity change by looking at the PoI table. But for subgraphs that have big gaps between actual writes, that time doesn't change even though we do rollups as new blocks come in. When a subgraph in that state is restarted, we redo those rollups which causes the unique constraint violation. Until we have a fix, it might help to rewind the subgraph to before the last actual write. Unfortunately, that data is not available in the API anywhere, and you need to run a query like |
When graph-node is restarted, we need to determine for subgraphs with aggregations when the last rollup was triggered to ensure aggregations get filled without gaps or duplication. The code used the `block_time` column in the PoI table for that but that is not correct as the PoI table only records blocks and times for which the subgraph actually has writes. When the subgraph scans through a largish number of blocks without changes, we only update the head pointer but also do rollups as aggregation intervals pass. Because of that, we might perform a rollup without a corresponding entry in the PoI table. With this change, we actually find the maximum timestamp from all aggregation tables to tell us when the last rollup was triggered as that data reflects when rollups happened accurately. For safety, this new behavior can be turned off by setting `GRAPH_STORE_LAST_ROLLUP_FROM_POI=true` to return to the old buggy behavior in case the new behavior causes some other unexpected problems. Fixes #5530
When graph-node is restarted, we need to determine for subgraphs with aggregations when the last rollup was triggered to ensure aggregations get filled without gaps or duplication. The code used the `block_time` column in the PoI table for that but that is not correct as the PoI table only records blocks and times for which the subgraph actually has writes. When the subgraph scans through a largish number of blocks without changes, we only update the head pointer but also do rollups as aggregation intervals pass. Because of that, we might perform a rollup without a corresponding entry in the PoI table. With this change, we actually find the maximum timestamp from all aggregation tables to tell us when the last rollup was triggered as that data reflects when rollups happened accurately. For safety, this new behavior can be turned off by setting `GRAPH_STORE_LAST_ROLLUP_FROM_POI=true` to return to the old buggy behavior in case the new behavior causes some other unexpected problems. Fixes #5530
Hello, |
Sorry that this is happening (again) I am looking into what is causing this, but don't have an ETA for a fix yet. |
Thanks for your response ! Let me know when you have updates on this :) |
Can also confirm the error is back. Error Logs:
Good luck @lutter |
Bug report
This subgraph fails randomly with the error below.
The same block
6284464
which it failed in (QmQZadt6wd8wo8U6opsVnjpAjx2Ysh3iLiPXuydJ65eqT3) is successfully processed in a new deployment (QmYktZYrbaENqm9nS8kvBxnzsRUyh4ueuQ679mYwMdNLpz)Relevant log output
No response
IPFS hash
No response
Subgraph name or link to explorer
No response
Some information to help us out
OS information
None
The text was updated successfully, but these errors were encountered: