Skip to content

Add embedded-mode options to bypass DB cache and fail fast on journal lock contention#10363

Merged
coffeegoddd merged 5 commits intomainfrom
db/fixes
Jan 27, 2026
Merged

Add embedded-mode options to bypass DB cache and fail fast on journal lock contention#10363
coffeegoddd merged 5 commits intomainfrom
db/fixes

Conversation

@coffeegoddd
Copy link
Copy Markdown
Contributor

This PR adds opt-in controls for embedded/driver use-cases that need deterministic reopen semantics under contention:
• Disable local singleton DB caching for file-backed databases via a new dbfactory param, so each open constructs a fresh store.
• Fail fast on journal manifest lock timeout via a new dbfactory param, returning a sentinel error instead of falling back to read-only.
• Plumb DB load parameters through the SQL engine / env so an embedded driver can thread these options into Dolt database creation.

Key changes

• dbfactory:
• Adds DisableSingletonCacheParam (disable_singleton_cache)
• Adds FailOnJournalLockTimeoutParam (fail_on_journal_lock_timeout)
• Bypasses the singleton cache in FileFactory.CreateDB when disable_singleton_cache is set.
• nbs:
• Adds ErrDatabaseLocked
• Adds JournalingStoreOptions + NewLocalJournalingStoreWithOptions
• Updates newJournalManifest(..., failOnTimeout) to return ErrDatabaseLocked on lock timeout when enabled.
• SQL engine / env plumbing:
• Adds DBLoadParams to engine.SqlEngineConfig and threads them into env.DoltEnv prior to DB loading.
• Adds DBLoadParams to env.DoltEnv and merges them into both DB load paths (LoadDoltDB and LoadDoltDBWithParams).
• Updates env.MultiEnvForDirectory to respect a caller-provided *DoltEnv to avoid preloading before params are set.

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
86988af ok 5937471
version total_tests
86988af 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
bb6fef3 ok 5937471
version total_tests
bb6fef3 5937471
correctness_percentage
100.0

Copy link
Copy Markdown
Contributor

@reltuk reltuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a pass. Just a couple suggestions for a helper method and improving the semantics of a changed function at one point.

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
3851398 ok 5937471
version total_tests
3851398 5937471
correctness_percentage
100.0

@coffeegoddd coffeegoddd merged commit cd1cf0c into main Jan 27, 2026
23 of 26 checks passed
@coffeegoddd coffeegoddd deleted the db/fixes branch January 27, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants