Skip to content

test(sqlite): skip a transient db file that vanishes mid-listing - #1392

Closed
eliseong wants to merge 1 commit into
mainfrom
eliseong-sqlite-files-race-2026-11-23
Closed

eliseong wants to merge 1 commit into
mainfrom
eliseong-sqlite-files-race-2026-11-23

Conversation

@eliseong

Copy link
Copy Markdown
Collaborator

What

The secret_rows test helper files() listed the database directory and read every entry. SQLite can remove the WAL or the shared-memory index when its last connection closes, which pool.close() can return before, so the read answered NotFound and the test panicked. files() now skips an entry that is gone by the time it reads it, and still fails the test on any other read error.

Why

A rare CI flake: the test failed once on an unrelated change that touches no extenddb-storage-sqlite file. The failing call is the one after pool.close(); pool.close() returns before SQLite finishes closing every connection, so a last close can unlink the WAL and the index while the helper is reading the directory. Skipping a vanished file is safe here: every overwrite in this path truncates the WAL first, so a WAL that vanishes holds nothing.

Closes #1132

Testing done

  • cargo test -p extenddb-storage-sqlite: all pass. The affected test ran 10 times with no failure.
  • Reproduced the old flake under load (parallel single-test loops with CPU contention): the old code failed with the reported NotFound signature; the changed code did not fail under the same load.
  • cargo fmt --check: clean. cargo clippy -p extenddb-storage-sqlite --all-targets -- -D warnings: clean.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

Notes on the checklist: this changes one test helper in extenddb-storage-sqlite. I ran that crate's suite and clippy with -D warnings (the setting CI uses); the full cargo test --workspace runs in CI. The change fixes an existing test rather than adding functionality, so no new tests, docs, breaking changes, or RFC apply.

ADR / RFC: n/a. Test-only.


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

The secret_rows test helper files() listed the database directory and read
every entry. SQLite can remove the WAL or the shared-memory index between the
listing and the read, for example when a pooled connection closes, so the read
answered NotFound and the test panicked. Skip an entry that is gone by the time
files() reads it; a vanished transient file holds nothing the main database
does not. Any other read error still fails the test.

Refs #1132
@eliseong

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate of #1113, which makes the same change to files() and predates this one. I will review #1113. It resolves #1132.

@eliseong eliseong closed this Nov 23, 2026
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.

Test a_pass_leaves_no_catalog_key_and_no_old_ciphertext_in_the_files fails when a database file goes away between the listing and the read

1 participant