Skip to content

/go/{libraries,store}: block on lock option#10442

Closed
coffeegoddd wants to merge 9 commits intomainfrom
db/lock
Closed

/go/{libraries,store}: block on lock option#10442
coffeegoddd wants to merge 9 commits intomainfrom
db/lock

Conversation

@coffeegoddd
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the local journaling store’s exclusive manifest lock timeout configurable, plumbing a new option from the file DB factory down into the NBS journaling manifest lock acquisition.

Changes:

  • Add ManifestLockTimeout to nbs.JournalingStoreOptions and thread options through newJournalManifest.
  • Introduce lockWithOptionalTimeout helper to centralize “use default if unset” timeout behavior.
  • Add journal_lock_timeout_ms DBFactory param and a test that verifies a longer timeout allows waiting for lock release.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go/store/nbs/store.go Extends journaling store options with a configurable manifest lock timeout and passes options into journal manifest creation.
go/store/nbs/journal.go Updates newJournalManifest to accept options and use the optional timeout when acquiring the lock.
go/store/nbs/journal_test.go Updates tests for the newJournalManifest signature change.
go/store/nbs/fslock_util.go Adds helper for acquiring fs locks with an optional (defaulted) timeout.
go/store/nbs/file_manifest.go Switches file manifest lock acquisition to use the new helper (no behavioral change intended).
go/libraries/doltcore/dbfactory/file.go Adds journal_lock_timeout_ms param parsing and wires it into nbs.JournalingStoreOptions.
go/libraries/doltcore/dbfactory/file_cache_test.go Adds test validating that increasing the lock timeout allows a second open to wait for lock release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coffeegoddd coffeegoddd requested a review from reltuk February 6, 2026 21:43
@coffeegoddd coffeegoddd changed the title /go/{libraries,store}: make timeout configurable /go/{libraries,store}: block on lock option Feb 6, 2026
@coffeegoddd coffeegoddd requested a review from Copilot February 6, 2026 22:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +558 to +571
if opts.BlockOnLock {
for {
err = lock.TryLock()
if err == nil {
break
}
if !errors.Is(err, fslock.ErrLocked) {
return nil, err
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(10 * time.Millisecond):
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

In the BlockOnLock loop, using time.After inside the retry loop allocates a new timer each iteration and can create unnecessary GC churn if the lock is held for a while. Prefer a single time.Ticker (defer Stop) or a sleep strategy that doesn't allocate per-iteration, and consider hoisting the retry interval into a named const for clarity/tuning.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

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

Copy link
Copy Markdown

Copilot AI commented Feb 6, 2026

@coffeegoddd I've opened a new pull request, #10444, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 5 commits February 6, 2026 22:31
Co-authored-by: coffeegoddd <43383835+coffeegoddd@users.noreply.github.com>
Co-authored-by: coffeegoddd <43383835+coffeegoddd@users.noreply.github.com>
Optimize BlockOnLock retry loop to eliminate per-iteration allocations
@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

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

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
48545c0 ok 5937471
version total_tests
48545c0 5937471
correctness_percentage
100.0

@coffeegoddd coffeegoddd closed this Feb 9, 2026
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.

3 participants