Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Refresh full-text segments before checking database pages - #7650

Open
jtoledo1974 wants to merge 1 commit into
Sinity:masterfrom
jtoledo1974:refresh-full-text-before-quick-check
Open

jtoledo1974 wants to merge 1 commit into
Sinity:masterfrom
jtoledo1974:refresh-full-text-before-quick-check

Conversation

@jtoledo1974

Copy link
Copy Markdown

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, 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, RELEASE repeats 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 repeated RELEASE error, and I did not confirm that the existing unreadable_vector_pages_under_an_intact_schema_are_reported reaches 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

`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

No deployments
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.

1 participant