Repository navigation
Refresh full-text segments before checking database pages - #7650
Open
jtoledo1974 wants to merge 1 commit into
Open
jtoledo1974 wants to merge 1 commit into
jtoledo1974 wants to merge 1 commit into
Conversation
`status --verify` runs `quick_check` on each SQLite database through a connection that stays open. FTS5 compares an index against the segment list the connection last loaded and does not reload it. When another connection merged segments after that load, the check reported an intact index as corrupt, though a fresh connection found nothing wrong. Search each FTS5 table of the checked database once before the check, inside one savepoint, so the segment list is reloaded for the snapshot the check then reads. Real damage still fails the search or the check. When the pages cannot be read, `RELEASE` repeats the error the check returned. That error is the one reported as the database's problem, and the savepoint is rolled back so a pooled reader is not left inside it. One test rewrites entries through a second connection until segments merge, checking after each round that no problem is reported and that FTS5's own integrity check passes. Another deletes a data row and expects the problem to be reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
status --verifyrunsquick_checkon each SQLite database through a connection that stays open. FTS5 compares an index against the segment list the connection last loaded and does not reload it. When another connection merged segments after that load, for instance the writer finishing a re-parse during a long verification, the check reported an intact full-text index as corrupt. A fresh connection found nothing wrong.Search each FTS5 table of the checked database once before the check, inside one savepoint. A search reloads the segment list for the current snapshot, so the check reads the same snapshot. The search is for a three-character word that matches nothing, which is one token for both the word and the trigram tokenizers. Real damage still fails the search or the check.
When the pages cannot be read,
RELEASErepeats the error the check returned. Propagating that second error would abort verification instead of reporting the database's problem. The check's error is now the one reported, and the savepoint is rolled back (and the transaction too, if the savepoint had opened it) so a pooled reader is not left inside it.Two tests use two connections to one contentless FTS5 file. One rewrites entries until segments merge, 60 rounds, checking after each round that no problem is reported, and ends with FTS5's own
integrity-check. The other deletes a data row and expects the damage to be reported. I did not add a test for the repeatedRELEASEerror, and I did not confirm that the existingunreadable_vector_pages_under_an_intact_schema_are_reportedreaches the rollback branch.Verification
In a container with Rust 1.98.1, the pinned toolchain, on this change on top of master at 1dbfd5d:
cargo fmt --check: clean.cargo clippy --locked -p polylogue-store --all-targets --features fixture,faults -- -D warnings: clean.cargo nextest run --locked -p polylogue-store --features fixture,faults -E 'test(verify)': 15 tests run, 15 passed, 1262 skipped, including both new tests.Not run:
cargo xtask check, Clippy over the whole workspace, the full Store suite, the Nix checks and the browser extension checks. I left those to the hosted check. I did not run the new tests against the unpatched code, so I have not confirmed that the merge test fails without the change.Changed test expectations
None.
Left open
Nothing.
Task: none (outside contribution)
🤖 Generated with Claude Code