Skip to content

fix: prevent destructive fallback when opening database files - #17

Merged
MugdhoAI merged 1 commit into
mainfrom
fix/phase2-safe-database-open
Nov 3, 2026
Merged

MugdhoAI merged 1 commit into
mainfrom
fix/phase2-safe-database-open

Conversation

@MugdhoAI

@MugdhoAI MugdhoAI commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Do not fall back to w+b when opening an existing database fails for reasons other than nonexistence.
  • Create new database files exclusively with C11 x mode to avoid truncating a file created concurrently.
  • Retry a normal read/write open if another process wins the create race.

Validation

GitHub Actions will run the full test suite, strict-warning build, benchmark smoke test, and ASan/UBSan suite.

Risk addressed

The previous r+b → w+b fallback could truncate an existing database after a non-ENOENT open failure. This change removes that destructive path.

@MugdhoAI
MugdhoAI marked this pull request as ready for review November 3, 2026 21:21
@MugdhoAI
MugdhoAI merged commit ecf524b into main Nov 3, 2026
2 checks passed
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