Skip to content

docs(readme): separate a lost index entry from genuinely missing data on 23503 - #188

Merged
robrigo merged 1 commit into
mainfrom
docs/fk-lookup-index-corruption
Aug 22, 2026
Merged

docs(readme): separate a lost index entry from genuinely missing data on 23503#188
robrigo merged 1 commit into
mainfrom
docs/fk-lookup-index-corruption

Conversation

@robrigo

@robrigo robrigo commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Why

The Troubleshooting entry for 23503 assumed the parent row is absent. A row that is present but unreachable through the constraint's unique index raises the identical error, and an operator following the entry reaches the wrong repair.

Real case: a node reported atomicassets_assets_schemas_fkey on (drawncompany, karenbsk, atomicassets), and every diagnostic the entry prescribed came back clean. The schema row was present with the right creation block, the schema count matched a healthy node exactly, the block histogram showed no gap, and a scoped orphan scan returned nothing. The row was there the whole time. What differs is which index each lookup uses: the entry's own diagnostic filters on collection_name with an ILIKE on schema_name, which cannot use the primary key, while the constraint resolves its parent through that primary key.

All three key columns are character varying, so those btrees order by collation. Moving a data directory onto a base image with a different glibc or ICU invalidates them silently, which is exactly what an image upgrade does. The failure then looks like missing data and is not, and pointing that operator at an 88 GB dump restore would have left every other text index in the database equally wrong.

Validation

Documentation only, no code paths touched. Verified against the code: nothing in src/ or definitions/ deletes from atomicassets_schemas, and the processor throws on a non-present delta rather than deleting, so a vanished parent row cannot come from the filler. Confirmed the two indexes involved differ, atomicassets_schemas_pkey on (contract, collection_name, schema_name) against atomicassets_schemas_collection_schema on (collection_name, schema_name), which is what lets one lookup miss while the other succeeds. Checked the added lines for em-dash and over-length wrapping, and the fence count stays even.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expands troubleshooting for PostgreSQL 23503 failures by distinguishing missing parent rows from stale or corrupt indexes.

Changes:

  • Adds index-versus-sequential-scan diagnostics.
  • Documents collation-version checks and index repair.
  • Clarifies missing-data investigation guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
… on 23503

The entry sent every 23503 report down the missing-data path, but a present row
the constraint cannot resolve produces the identical error. The foreign key
finds its parent through a unique index on three varchar columns, so a btree
left stale by a glibc or ICU change fails the check while the operator's own
queries still return the row, and the counts they are told to compare come back
clean. That reading points at a dump restore when the database is intact and
one REINDEX away from correct, and it leaves every other text index in the same
database quietly wrong. The forced-seqscan comparison separates the two in one
step, so it now runs before the row-count work rather than after it.

Signed-off-by: Rob Konsdorf <rob@facings.io>
@robrigo
robrigo force-pushed the docs/fk-lookup-index-corruption branch from ca06e7a to cb7c252 Compare August 22, 2026 00:26
@robrigo
robrigo merged commit 6758c03 into main Aug 22, 2026
7 checks passed
@robrigo
robrigo deleted the docs/fk-lookup-index-corruption branch August 22, 2026 00:28
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