docs(readme): warn that a broken index ordering may have admitted duplicates - #194
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Clarifies PostgreSQL index-corruption diagnosis and recovery guidance.
Changes:
- Explains
item order invariant violated. - Warns that corrupt unique indexes may admit duplicates.
- Documents concurrent reindexing risks.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…licates An operator who reindexes the one index the foreign key needed will see the filler resume and reasonably stop there, while the rest of the database still carries indexes built under the old collation. Worse, the same broken ordering governs uniqueness checks, so a corrupt unique index can have accepted rows it should have rejected. That surfaces as a reindex failing on a duplicate key, which reads as a problem with the reindex rather than as the data damage it is. Naming the amcheck error text as well gives operators something to match against, since the ordering violation aborts the check before the heapallindexed pass it was nominally run for. Signed-off-by: Rob Konsdorf <rob@facings.io>
robrigo
force-pushed
the
docs/reindex-duplicate-risk
branch
from
August 24, 2026 13:42
f2aad36 to
5f90fe6
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.
Why
A live operator case closed the loop on the entry added in #188, and it exposed two gaps.
bt_index_checkreturneditem order invariant violated for index "atomicassets_schemas_pkey", meaning entries were stored out of sort order. The entry told operators an error names the damage but gave them nothing to match against, and the phrasing impliedheapallindexedwas the point of the check when an ordering violation aborts it before that pass ever runs.The repair guidance stopped at the commands. Reindexing the single index the constraint needed makes the filler resume, which invites stopping there while every other index built under the old collation stays wrong. More seriously, uniqueness is enforced through the same ordering, so a corrupt unique index can have admitted rows it should have rejected. That surfaces later as a reindex failing on a duplicate key, and without warning it reads as a reindex problem rather than as data damage that has to be cleaned up first.
Validation
Documentation only, no code paths touched. The added claims are drawn from a confirmed case: the amcheck error text is quoted from an operator's Postgres output, and the reader was wedged at the block immediately before the failing range, consistent with the constraint failing on a row present in the heap. Checked the added lines for em-dash and over-length wrapping, and the fence count stays even.