Open
Conversation
Replace the per-EntityCache vid_seq and seq fields with a shared VidGenerator backed by Arc<AtomicU32>. Created once per block and cheaply cloned across all EntityCache instances, this eliminates VID collisions in ipfs.map() callbacks and offchain triggers without manual sequence threading.
The AMP runner previously created an EntityCache with a fake SeqGenerator(0) and shared it across block boundaries, even though an EntityCache should always be tied to a single block. Now only the LfuCache is threaded through, and EntityCache is created locally in process_record_batch_group with the correct block's SeqGenerator.
Add a unit test that simulates the ipfs.map() pattern (multiple EntityCache instances sharing one SeqGenerator) and verifies VIDs are sequential. Extend the file_data_sources runner test so that two offchain triggers in the same block each create an entity, exercising the shared VID generator end-to-end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The way
vid's were created was very brittle and relied on passing a counter around in the right places. We encapsulate this logic in aSeqGeneratorthat can be shared freely for the duration of a block and makes sure that generatedvids are unique@incrypto32 I am asking for your review mostly for the first commit which affects vid generation proper
@isum I am asking for your review mostly for the second commit which changes amp subgraphs