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.
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 https://github.com/graphprotocol/graph-node/issues/5530