dolthub / dolthub/doltlite

Crash recovery and OOM C tests are not gated; oracles accept MISUSE and either-state

Closed
#2,896 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
268
Forks
18
Avg merge
2h 26m
Merged PRs (30d)
454

Description

`AGENTS.md` says `test/run_c_tests.sh` covers crash recovery. It does not.

`crash_recovery_test` is not in `DOLTLITE_C_TESTS` (`main.mk`) or in the `COVERAGE_TESTS` / `SPECIALIZED_TESTS` lists in `test/run_c_tests.sh`. The native binary is built ad hoc and run only on Ubuntu (`platform-test.yml`). The `SQLITE_TEST` twin (`crash_recovery_test_sqlite_test`) is smoke-only. ASan never sees either.

The replacements for quarantined upstream suites are weaker than what they replace:

- `crash2` / `savepoint4` (`#2072`) map to `test/doltlite_recover_crash_commit.test`, which accepts either the pre-crash or the committed state.
- `test/oom_dolt_fault_test.c` treats `SQLITE_MISUSE`, `SQLITE_ERROR`, `SQLITE_ABORT`, and generic `SQLITE_IOERR` as success after an injected allocation failure. That can hide use-after-free as a handled OOM.
- Specialized C tests (OOM, multiproc, concurrent write) run on Ubuntu checked builds only — not in the coverage C job, not under ASan.

**Fix**
- Add `crash_recovery_test` and `concurrent_branch_test` to `DOLTLITE_C_TESTS` and `run_c_tests.sh`.
- Run `run_c_tests.sh . all` (or at least coverage + `oom_dolt_fault_test` + `crash_recovery_test`) in the sanitizer and coverage-native C jobs.
- After each injected OOM: reopen the file, `PRAGMA integrity_check`, assert refs still resolve, and reject `SQLITE_MISUSE` / `SQLITE_CORRUPT`. `SQLITE_NOMEM` / `SQLITE_IOERR_NOMEM` / `SQLITE_FULL` are the success-shaped failures.
- Replace “either consistent outcome” crash sweeps with a write-offset injector at the WAL root/sync point: never a torn catalog, never a ref to a missing commit, never a conflicted working set on disk.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with main.mk, test/run_c_tests.sh, platform-test.yml, test/oom_dolt_fault_test.c, and test/doltlite_recover_crash_commit.test to trace current registration, job coverage, and oracle behavior. Run the existing C test command and the named specialized tests before changing coverage. Done means the crash, concurrent-branch, OOM, coverage, and sanitizer paths run in the requested jobs and reject invalid or torn database states.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sqlite
Domain
ci-cd, databases, testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.