You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background — an orchestrator's need. We manage the dolt sql-server lifecycle (start/stop/restart) from a supervisor that also coordinates other processes against the same data dir. To restart safely we need to know when the previous server has actually released its hold on a database and when a new server can take it — without guessing. Today we wait on the noms LOCK file with an arbitrary timeout (60s) because the lock's contract isn't documented anywhere.
What's unclear today (and what the code actually does). From reading go/store/nbs:
LOCK is an advisory fslock at <data_dir>/<db>/.dolt/noms/LOCK (journal.go:576; lockFileName, file_manifest.go:45), held from DB open (newJournalManifest) until Close() — i.e. for the entire server lifetime, not a short critical section.
It's unspecified whether the lock survives a hard crash as a stale lock, how an operator clears it, and whether an external process may itself flock() the file to coordinate.
Proposal. Document the LOCK contract in the dolt docs (and/or a noms/LOCK README), covering: (a) it is an advisory flock held for the server's lifetime — there is no "max hold time," the correct wait is "until the holding process exits / closes"; (b) dolt's own 100ms acquire timeout and the read-only fallback, so operators understand why a too-fast restart yields a read-only or "locked" server; (c) crash/staleness behavior and the safe way to clear a stale lock; (d) explicitly, whether an external supervisor may flock() these files to coordinate hand-off, or whether that risks corrupting dolt's own locking.
Docs + a supported readiness/lock-state query. Expose lock-held state (e.g. via the readiness signal in the companion request, or a dolt subcommand) so supervisors coordinate on a supported signal instead of poking the LOCK file directly — removes the need for external flock entirely.
Filing as a documentation/clarity request; option 1 alone would unblock us. Thanks.
Filed from a downstream orchestrator (Gas City) that manages the dolt sql-server lifecycle; verified against current dolthub/dolt source.
Background — an orchestrator's need. We manage the
dolt sql-serverlifecycle (start/stop/restart) from a supervisor that also coordinates other processes against the same data dir. To restart safely we need to know when the previous server has actually released its hold on a database and when a new server can take it — without guessing. Today we wait on the nomsLOCKfile with an arbitrary timeout (60s) because the lock's contract isn't documented anywhere.What's unclear today (and what the code actually does). From reading
go/store/nbs:LOCKis an advisoryfslockat<data_dir>/<db>/.dolt/noms/LOCK(journal.go:576;lockFileName,file_manifest.go:45), held from DB open (newJournalManifest) untilClose()— i.e. for the entire server lifetime, not a short critical section.lockFileTimeout = 100ms(file_manifest.go:46); on timeout it either errors withErrDatabaseLockedor silently falls back to read-only. This appears to be the root of the recurring "database is read only" / "locked by another process" reports (CLI writes fail with 'database is read only' due to stale journal lock after process exit #10852, Dolt Fails to Start After Restart in Kubernetes STS with ProxySQL – Reports Database Locked by Another Process #11036, Feature request: The error message from Dolt when failing a write because the database is read-only should be better. #10858).flock()the file to coordinate.Proposal. Document the LOCK contract in the dolt docs (and/or a
noms/LOCKREADME), covering: (a) it is an advisory flock held for the server's lifetime — there is no "max hold time," the correct wait is "until the holding process exits / closes"; (b) dolt's own 100ms acquire timeout and the read-only fallback, so operators understand why a too-fast restart yields a read-only or "locked" server; (c) crash/staleness behavior and the safe way to clear a stale lock; (d) explicitly, whether an external supervisor mayflock()these files to coordinate hand-off, or whether that risks corrupting dolt's own locking.Design options (≥2):
doltsubcommand) so supervisors coordinate on a supported signal instead of poking the LOCK file directly — removes the need for external flock entirely.Filing as a documentation/clarity request; option 1 alone would unblock us. Thanks.
Filed from a downstream orchestrator (Gas City) that manages the
dolt sql-serverlifecycle; verified against currentdolthub/doltsource.