Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Give the instance database one write policy

8f6548a6249e86bfb4741a85cc6ca7efe8b3a064 · Keenan Nemetz · 3d ago · parent 1eac8552

Give the instance database one write policy

instance.db has one writer per file, and the server, the push hook, and
sshd's key command all open it. Each store picked its own pragmas, so a
transaction that read and then wrote could be refused with SQLITE_BUSY
without the busy timeout applying. And the push hook opened every store
with the writer open, which ran each schema inside a push: runs.Open
dropped and rebuilt the runs_once index on every call, over a run table
that is never pruned, while the server might be committing a lease.

Open every file through internal/sqlstore instead: WAL, synchronous=NORMAL,
and immediate write transactions, with a read-only mode for the processes
that only read. The hook and sshd's key lookup use that read-only mode, so a
push can no longer write a schema.

The queue's shape is applied once per database and recorded in a
schema_versions row, so reopening it does no DDL and an old unversioned
queue still upgrades. Write transactions that only touch the database retry
a lock conflict instead of failing the operation.

Refs #398

ARCHITECTURE.md +10

@@ -76,6 +76,16 @@ user-facing
76 76 inventories each path and its backup requirements;
77 77 [Operations](docs/operations.md#back-up-an-instance) provides the procedure.
78 78
79 SQLite has one writer per file, and the instance has several: a push, a merge, a
80 runner reporting a result. They queue rather than collide, and the settings that
81 make that true live in one place (`internal/sqlstore`): WAL so a reader never waits
82 for a writer, immediate transactions so a writer takes the lock up front instead of
83 failing to upgrade, and a busy timeout so a second process waits its turn. A process
84 that only reads — the push hook, sshd's key lookup — opens a read-only handle and
85 cannot write a schema. The write-ahead log is synced at a checkpoint rather than at
86 every commit, so a power loss can drop the newest commits but cannot corrupt the
87 file.
88
79 89 The web index is derived from each repository's `vole` branch. Post-receive applies
80 90 a push's delta as the push lands, so a page does not pay for the work the push
81 91 already did. Every read still checks the branch it was built from — reading the