Build ring before publishing pool strategy - #77
Merged
Conversation
marina_pool:sync/3 inserted {token_aware, N} into the foil table
before marina_ring:build/1 had compiled marina_ring_utils. A query
carrying a routing key in that window resolved the token_aware
strategy and called marina_ring_utils:lookup/1 on a module that did
not exist yet, crashing the caller with undef instead of getting
{error, marina_pool_not_started}.
Compile the ring first, so the strategy only becomes visible to
callers once the lookup module is loaded. This also applies to
topology re-syncs, where the same window reopened on every rebuild.
Merged
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.
Summary
marina_pool:sync/3inserted{token_aware, N}into the foil table beforemarina_ring:build/1had compiledmarina_ring_utils. In that window, a query carrying a routing key resolved thetoken_awarestrategy and calledmarina_ring_utils:lookup/1on a module that did not exist yet, crashing the caller withundefinstead of getting{error, marina_pool_not_started}.This reordering compiles the ring first, so the strategy only becomes visible to callers once the lookup module is loaded. The same window reopened on every
{topology_full_sync, _}rebuild, not just at startup; both are covered. Building the ring first has no dependency on the node index —marina_compilerneeds only the token list and the puremarina_pool:node_id/1, and pools are already started by that point.No hot-path cost: the fix is pure ordering, with no guard added around the ring lookup itself.