feat: switch metadata reads to compiled_contracts_metadata - #2942
Draft
marcocastignoli wants to merge 2 commits into
Draft
feat: switch metadata reads to compiled_contracts_metadata#2942marcocastignoli wants to merge 2 commits into
marcocastignoli wants to merge 2 commits into
Conversation
Switches all metadata reads to the side table and stops writing sourcify_matches.metadata, which can then be dropped: - STORED_PROPERTIES_TO_SELECTORS metadata/std_json_output selectors read compiled_contracts_metadata, joined only when those fields are requested (grouping on the side table's PK keeps json selectable) - getCompilationsByIds joins the side table directly instead of the LATERAL detour through sourcify_matches - insertSourcifyMatch/updateSourcifyMatch no longer write metadata Requires the backfill of compiled_contracts_metadata to be complete in production before deployment. See #2924. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kuzdogan
force-pushed
the
feat/2924-metadata-read-switch
branch
from
August 28, 2026 05:40
c7abc62 to
c83d189
Compare
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.
Important
Do not merge until all three are checked — this PR removes the only fallback to
sourcify_matches.metadata:backfill-compiled-contracts-metadata.mjs)--verifyreportsmissingRows=0compiled_contracts_metadataadded to the Datastream mirror (sourcify-matches stream)Summary
Release 2 of 2 for #2924, stacked on #2941. Reads switch to the side table, writes to the old column stop:
STORED_PROPERTIES_TO_SELECTORS(metadata,std_json_output) now readcompiled_contracts_metadata; the table is LEFT JOINed only when one of those fields is requested, and grouped by its PK where a GROUP BY exists (PK grouping is what makes thejsoncolumn selectable).getSourcifyMatchByChainAddressselects metadata via the same join.getCompilationsByIds(similarity search) joins the side table directly on the compilation PK — the LATERAL detour throughsourcify_matchesthat The same metadata is stored 8.5 times over: ~139 GB of a 182 GB table #2924 called out is gone, along with its stale-compilation quirk.insertSourcifyMatch/updateSourcifyMatchno longer take or writemetadata; the column stays in place (nullable, unread) until the drop.assertContractSaved's duplicate check collapses back into one query.After this deploys, the remaining ops task is dropping
sourcify_matches.metadataand reclaiming the ~139 GB withpg_repack.Notes
🤖 Generated with Claude Code