Skip to content

Comments

Amp-powered subgraphs: Add runtime endBlock completion check#6369

Merged
isum merged 1 commit intomasterfrom
ion/amp-add-end-block-completion-check
Feb 16, 2026
Merged

Amp-powered subgraphs: Add runtime endBlock completion check#6369
isum merged 1 commit intomasterfrom
ion/amp-add-end-block-completion-check

Conversation

@isum
Copy link
Member

@isum isum commented Feb 16, 2026

Summary

  • Add a runtime completion check after the data stream loop that marks indexing as done when the Amp Flight server's latest block reaches or exceeds every data source's endBlock.

Problem

The existing indexing_completed check (at the top of the loop) relies on the persisted block pointer (latest_synced_block) having advanced to endBlock. However, if endBlock itself contains no entity data, the store's block pointer is never advanced to that block number, and the subgraph never reports as synced – it loops indefinitely waiting for a block pointer that will never be written.

Solution

After consuming the data stream in each iteration, check whether the Amp Flight server's latest_block already covers through max_end_block(). If so, mark the deployment as synced and return, bypassing the need for the persisted block pointer to reach endBlock exactly. This is safe because the server's latest block confirms all queries through endBlock have been served.

Future Improvements

This will be replaced by persistent completion (to avoid executing queries on restarts to confirm completion) once the Amp-based block cache or the Amp Admin API is integrated into the graph-node.

@isum isum self-assigned this Feb 16, 2026
Add a runtime check in run_indexing that detects when the Amp Flight
server's latest block covers through every data source's endBlock, even
when no entity data exists at the endBlock itself. Previously, the only
completion check compared the persisted block pointer (which only
advances when data is written) against endBlock, causing an infinite
polling loop when endBlock has no data.

The check compares latest_block (min MAX(_block_num) across
non-completed tables) against max_end_block (max end_block across all
data sources). If latest_block >= max_end_block, all SQL queries have
been served and indexing completes.
@isum isum force-pushed the ion/amp-add-end-block-completion-check branch from 4cf1686 to dd6cb78 Compare February 16, 2026 20:27
@isum isum merged commit eb05cbb into master Feb 16, 2026
6 checks passed
@isum isum deleted the ion/amp-add-end-block-completion-check branch February 16, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants