Repository navigation
Fix type errors while another connection loads types - #802
Merged
Merged
Conversation
While a connection loads a batch of new types, other connections read the table without the type server lock. Each entry briefly holds nil, which means unsupported, so a query can fail with "type `x` can not be handled by the types module" for a type that works a moment later. Entries now hold :associating until they are resolved. fetch/2 treats that as unknown, so the caller reloads, waits on the type server for the batch to finish, and reads the finished entry. Types that end up unsupported still store nil and fail as before. The type server owns the table, so a crash mid-batch cannot leave the marker behind. Anonymous records decoded during the window still raise, now with "was not bootstrapped" instead of "can not be handled". Fixes elixir-ecto#801
cyrilghali
marked this pull request as ready for review
October 7, 2026 21:59
Member
|
💚 💙 💜 💛 ❤️ |
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.
A query can fail with "type
xcan not be handled by the types module" while another connection is still loading new types, although the type works a moment later. Types still loading now count as unknown, so the query waits for them and succeeds. A type that stays unsupported still fails as before.The new test fails on master, where a type still loading is reported as unsupported. The full suite passes against PostgreSQL 17, and the issue's script (10 concurrent inserts while 10,000 types load) goes from 10 failed inserts to 0.
Fixes #801